Пример #1
0
 public function __construct($ID)
 {
     parent::__construct();
     $this->admissionID = $ID;
     $productQuery = $this->dbh->prepare("SELECT ID, Description + ' ' + ProductSize AS TheProduct FROM vwProducts WHERE ID NOT IN (403, 412, 221) AND ID IN (SELECT ProductID FROM AT_CMNProducts WHERE AdmissionID = :admissionID)");
     $productQuery->execute(array(':admissionID' => $this->admissionID));
     while ($row = $productQuery->fetch(\PDO::FETCH_ASSOC)) {
         $this->products[] = new \OnlineOrders\Product($row['ID'], $row['TheProduct']);
     }
     $admissionQuery = $this->dbh->prepare("SELECT (SELECT NPI FROM AT_ProviderInfo P WHERE P.ID = A.ProviderID) As NPI, Saline, PartABed, IsHH, Location, PatientID, PlanCode, PhyRefusesToSign, CompTicket, DoctorSig, ClinicID, CMNDate, CMNValidDays FROM AT_Admission A WHERE ID = :admissionID");
     $admissionQuery->execute(array(':admissionID' => $this->admissionID));
     $row = $admissionQuery->fetch(\PDO::FETCH_ASSOC);
     $this->clinicID = $row['ClinicID'];
     $this->signatureInfo['PhyRefusesToSign'] = $row['PhyRefusesToSign'];
     $this->signatureInfo['DoctorSig'] = $row['DoctorSig'];
     $this->providerNPI = $row['NPI'];
     $this->compTicket = $row['CompTicket'];
     $this->planCode = $row['PlanCode'];
     $this->patientID = $row['PatientID'];
     $this->CMNDate = $row['CMNDate'];
     $this->saline = $row['Saline'];
     $this->partA = $row['PartABed'];
     $this->hospice = $row['IsHH'];
     $this->location = $row['Location'];
     $this->expirationDate = date("Y-m-d", strtotime("+" . $row['CMNValidDays'] . " days", strtotime($row['CMNDate'])));
 }
Пример #2
0
 public function __construct($ID)
 {
     parent::__construct();
     $this->clinicID = $ID;
     $clinicInfoQuery = $this->dbh->prepare("SELECT * FROM webVW_Clinics WHERE ID = :clinicID");
     $clinicInfoQuery->execute(array('clinicID' => $this->clinicID));
     $this->clinicInfo = $clinicInfoQuery->fetch(\PDO::FETCH_ASSOC);
     $ownerNameQuery = $this->dbh->prepare("SELECT OwnedBy FROM Contact WHERE ID = :clinicID");
     $ownerNameQuery->execute(array(':clinicID' => $this->clinicID));
     $ownerName = $ownerNameQuery->fetchColumn();
     $ownerInfoQuery = $this->dbh->prepare("SELECT FirstName, LastName, Email FROM RMUsers WHERE Email = :user");
     $ownerInfoQuery->execute(array(':user' => $ownerName));
     $this->ownerInfo = $ownerInfoQuery->fetch(\PDO::FETCH_ASSOC);
     // $providerQuery = $this->dbh->prepare("SELECT doc.PhysicianName, doc.NPI, doc.UPIN, info.City, info.STATE_CODE, info.Phone_Number, info.DCFaxPhone FROM (SELECT * FROM AT_ProviderInfo WHERE NPI <> '') AS info JOIN AT_Physician doc ON info.NPI = doc.NPI WHERE doc.ClinicID = :clinicID");
     // $providerQuery->execute( array('clinicID' => $this->clinicID) );
     // while($provider = $providerQuery->fetch(\PDO::FETCH_ASSOC)) {
     // 	//$address = new \OnlineOrders\Address();
     // 	$this->providers[] = new \OnlineOrders\Provider($provider['NPI']);
     // }
     $templateQuery = $this->dbh->prepare("SELECT * FROM CMNTemplate WHERE ClinicID = :ClinicID");
     $templateQuery->execute(array(':ClinicID' => $this->clinicID));
     $template = array();
     while ($row = $templateQuery->fetch(\PDO::FETCH_ASSOC)) {
         $template[] = $row;
     }
     if (count($template) == 1) {
         $this->cmnTemplate = $template;
     } else {
         $this->cmnTemplate = array('Message' => 'Invalid or nonexistent template.');
     }
 }
Пример #3
0
 /**
  * User instance constructor
  *
  *@param string $userID
  *
  **/
 public function __construct($userID)
 {
     parent::__construct();
     $this->userID = $userID;
     $this->userInfo = array();
     //Prepare and execute statement to count results and store the number of results
     //We do this in case multiple entries have been made with the same username
     $stmt = $this->dbh->prepare("SELECT COUNT(*) FROM AT_WebUsers WHERE UserID = :user AND Inactive = 0");
     $stmt->execute(array('user' => $this->userID));
     $results = $stmt->fetchColumn();
     //If one result returned, store user info in object.  Otherwise throw exception.
     //@TODO - Catch Exceptions below.
     if ($results == 1) {
         $stmt = $this->dbh->prepare("SELECT ID, FName, LName, UserRole, NPI, Logins, ChangePass, Inactive, Verified FROM AT_WebUsers WHERE UserID = :user AND Inactive = 0");
         $stmt->execute(array('user' => $this->userID));
         $row = $stmt->fetch();
         $this->userInfo = $row;
         if ($row['NPI']) {
             $this->isPhysician = TRUE;
         }
     } else {
         if ($results > 1) {
             throw new \Exception('tooManyFail');
         } else {
             throw new \Exception('usernameFail');
         }
     }
 }
Пример #4
0
 public function __construct($ID)
 {
     parent::__construct();
     $this->productID = $ID;
     $productQuery = $this->dbh->prepare("SELECT Description, ProductSize FROM vwProducts WHERE ID = :productID");
     $productQuery->execute(array(':productID' => $this->productID));
     $row = $productQuery->fetch(\PDO::FETCH_ASSOC);
     $this->description = trim($row['Description']) . ' (' . trim($row['ProductSize'] . ')');
 }
Пример #5
0
 public function __construct($orderID)
 {
     parent::__construct();
     $this->orderID = $orderID;
     $orderQuery = $this->dbh->prepare("SELECT * FROM AT_Orders WHERE ID = :orderID");
     $orderQuery->execute(array(':orderID' => $this->orderID));
     $order = $orderQuery->fetch(\PDO::FETCH_ASSOC);
     $this->status = $order['Status'];
     $this->admissionID = $order['AdmissionID'];
     $this->shipDate = $order['ShipDate'];
     $this->trackingNum = $order['TrackingNum'];
     $this->financials['TotalAmt'] = $order['TotalAmt'];
     $this->financials['TotalCost'] = $order['TotalCost'];
 }
Пример #6
0
 public function __construct($NPI)
 {
     parent::__construct();
     $this->NPI = $NPI;
     $providerQuery = $this->dbh->prepare("SELECT info.ID, doc.PhysicianName, doc.NPI, doc.UPIN, info.City, info.STATE_CODE, info.Phone_Number, info.DCFaxPhone FROM (SELECT * FROM AT_ProviderInfo WHERE NPI = :NPI) AS info JOIN AT_Physician doc ON info.NPI = doc.NPI");
     $providerQuery->execute(array('NPI' => $this->NPI));
     $row = $providerQuery->fetch(\PDO::FETCH_ASSOC);
     $this->name = $row['PhysicianName'];
     $this->providerID = $row['ID'];
     $this->UPIN = $row['UPIN'];
     $this->address = array('City' => $row['City'], 'State' => $row['STATE_CODE']);
     $this->phoneNumber = $row['Phone_Number'];
     $this->faxNumber = $row['DCFaxPhone'];
 }
 public function __construct($planCode, $patientID)
 {
     parent::__construct();
     $this->planCode = $planCode;
     $planQuery = $this->dbh->prepare("SELECT p.PlanCode, p.PlanNo, p.GroupNo, p.PlanType, p.Relation, p.GuarFirstName, p.GuarLastName, p.GuarAddress1, p.GuarAddress2, p.GuarState, p.GuarCity, p.GuarZip, p.GuarPhone, p.GuarSex, p.GuarDOB, p.GuarSSN, i.Plan_Name FROM AT_PatientPlans p JOIN AT_InsurancePlans i ON p.PlanCode = i.Plan_Code WHERE p.PatientID = :patientID AND p.PlanCode = :planCode");
     $planQuery->execute(array(':patientID' => intval($patientID), ':planCode' => $planCode));
     $row = $planQuery->fetch(\PDO::FETCH_ASSOC);
     $this->planName = $row['Plan_Name'];
     $this->planType = $row['PlanType'];
     $this->planNumber = $row['PlanNo'];
     $this->groupNumber = $row['GroupNo'];
     $address = new \OnlineOrders\Address($row['GuarAddress1'], $row['GuarAddress2'], $row['GuarCity'], $row['GuarState'], $row['GuarZip'], NULL);
     $this->guarantorInfo = array('relation' => $row['Relation'], 'firstName' => $row['GuarFirstName'], 'lastName' => $row['GuarLastName'], 'address' => $address, 'phone' => $row['GuarPhone'], 'sex' => $row['GuarSex'], 'DOB' => $row['GuarDOB'], 'SSN' => $row['GuarSSN']);
 }
Пример #8
0
 public function __construct($woundID, $admissionID)
 {
     parent::__construct();
     $this->woundID = $woundID;
     $woundQuery1 = $this->dbh->prepare("SELECT * FROM AT_Wounds WHERE ID = :woundID");
     $woundQuery1->execute(array('woundID' => $this->woundID));
     $row1 = $woundQuery1->fetch(\PDO::FETCH_ASSOC);
     $woundQuery2 = $this->dbh->prepare("SELECT * FROM AT_OrderProductWounds WHERE WoundID = :woundID AND AdmissionID = :admissionID");
     $woundQuery2->execute(array('woundID' => $this->woundID, 'admissionID' => $admissionID));
     $row2 = $woundQuery2->fetch(\PDO::FETCH_ASSOC);
     $dimensions = array('Width' => $row2['WoundW'], 'Length' => $row2['WoundL'], 'Depth' => $row2['WoundD']);
     $this->longDescription = $row1['Description'];
     $this->shortDescription = $row1['WoundDesc'];
     $this->dimensions = $dimensions;
     $this->drainage = $row2['wDrainage'];
     $this->thickness = $row2['wThickness'];
     $this->FOC = $row2['FOC'];
     $this->woundNo = $row1['WoundNo'];
     $this->woundLoc = $row1['Side'] . ' ' . $row1['WoundLoc'];
 }
Пример #9
0
 public function __construct($PatientID)
 {
     parent::__construct();
     $this->patientID = $PatientID;
     $patientQuery = $this->dbh->prepare("SELECT PatientFirstName, PatientLastName, PatientNum, Address1, Address2, City, State, Zip, PatSSN, PatDOB FROM AT_Patient WHERE PatientID = :patientID");
     $patientQuery->execute(array(':patientID' => $this->patientID));
     $info = $patientQuery->fetch();
     $this->firstName = $info['PatientFirstName'];
     $this->lastName = $info['PatientLastName'];
     $this->patientNum = $info['PatientNum'];
     $this->DOB = $info['PatDOB'];
     $this->SSN = $info['PatSSN'];
     $this->address = new \OnlineOrders\Address($info['Address1'], $info['Address2'], $info['City'], $info['State'], $info['Zip'], NULL);
     $admissionNumQuery = $this->dbh->prepare("SELECT MAX(ID) AS ID FROM AT_Admission WHERE PatientID = :patientID");
     $admissionNumQuery->execute(array(':patientID' => $this->patientID));
     $lastAdmissionID = $admissionNumQuery->fetchColumn();
     $this->lastAdmission = new \OnlineOrders\Admission($lastAdmissionID);
     $woundQuery = $this->dbh->prepare("SELECT ID FROM AT_Wounds WHERE PatientID = :patientID AND Healed = 'False' ORDER BY ID");
     $woundQuery->execute(array(':patientID' => $this->patientID));
     while ($row = $woundQuery->fetch(\PDO::FETCH_ASSOC)) {
         $this->openWounds[] = new \OnlineOrders\Wound($row['ID'], $this->lastAdmission->get('admissionID'));
     }
     $insPlanQuery = $this->dbh->prepare("SELECT PlanCode FROM AT_PatientPlans WHERE Expired = 0 AND PatientID = :patientID");
     $insPlanQuery->execute(array(':patientID' => $this->patientID));
     while ($row = $insPlanQuery->fetch(\PDO::FETCH_ASSOC)) {
         $this->insurancePlans[] = new \OnlineOrders\InsurancePlan($row['PlanCode'], $this->patientID);
     }
     foreach ($this->lastAdmission->get('products') as $product) {
         $wounds = array();
         foreach ($this->openWounds as $wound) {
             if ($wound->checkProductMatch($product->get('productID'), $this->lastAdmission->get('admissionID'))) {
                 $quantityQuery = $this->dbh->prepare("SELECT QtyPerChange FROM AT_OrderProductWounds WHERE WoundID = :woundID AND AdmissionID = :admissionID_1 AND OPID IN (SELECT ID FROM AT_CMNProducts WHERE ProductID = :productID AND admissionID = :admissionID_2)");
                 $quantityQuery->execute(array(':woundID' => $wound->get('woundID'), ':admissionID_1' => $this->lastAdmission->get('admissionID'), ':productID' => $product->get('productID'), ':admissionID_2' => $this->lastAdmission->get('admissionID')));
                 $result = $quantityQuery->fetchColumn();
                 $wounds[] = array('woundNo' => $wound->get('woundNo'), 'quantity' => $result);
             }
         }
         $this->currentProductWoundMatches[] = array('productID' => $product->get('productID'), 'wounds' => $wounds);
     }
 }