当前位置: 首页>>代码示例>>PHP>>正文


PHP Patient::populate方法代码示例

本文整理汇总了PHP中Patient::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP Patient::populate方法的具体用法?PHP Patient::populate怎么用?PHP Patient::populate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Patient的用法示例。


在下文中一共展示了Patient::populate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _createAudit

 protected function _createAudit($providerId, $personId, $visitId, $type)
 {
     $providerId = (int) $providerId;
     $personId = (int) $personId;
     $visitId = (int) $visitId;
     $audit = array();
     $audit['objectClass'] = 'GenericAccessAudit';
     $audit['objectId'] = $personId . ';' . $visitId;
     $audit['type'] = (int) $type;
     $audit['userId'] = $providerId;
     $audit['patientId'] = $personId;
     $values = array();
     $provider = new Provider();
     $provider->personId = $audit['userId'];
     $provider->populate();
     $values['provider'] = $provider->toArray();
     $patient = new Patient();
     $patient->personId = $personId;
     $patient->populate();
     $values['patient'] = $patient->toArray();
     $values['personId'] = $patient->personId;
     $visit = new Visit();
     $visit->visitId = $visitId;
     $visit->populate();
     $values['visit'] = $visit->toArray();
     $values['visitId'] = $visit->visitId;
     $audit['auditValues'] = $values;
     Audit::persistManualAuditArray($audit);
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:29,代码来源:CcdController.php

示例2: myAlertsAction

 public function myAlertsAction()
 {
     $personId = Zend_Auth::getInstance()->getIdentity()->personId;
     $team = new TeamMember();
     $teamId = $team->getTeamByPersonId($personId);
     $rows = array();
     if (true) {
         $alertMsg = new GeneralAlert();
         $alertMsgIterator = $alertMsg->getIteratorByTeam($teamId);
         foreach ($alertMsgIterator as $alert) {
             $tmp = array();
             $tmp['id'] = $alert->generalAlertId;
             $tmp['data'][] = '<img src="' . $this->view->baseUrl . '/img/medium.png' . '" alt="' . $alert->urgency . '" /> ' . $alert->urgency;
             // below are temporary data
             $objectClass = $alert->objectClass;
             if (!class_exists($objectClass)) {
                 continue;
             }
             $obj = new $objectClass();
             foreach ($obj->_primaryKeys as $key) {
                 $obj->{$key} = $alert->objectId;
             }
             $obj->populate();
             $patient = new Patient();
             $patient->personId = $obj->personId;
             $patient->populate();
             $tmp['data'][] = $patient->person->getDisplayName();
             // patient
             $tmp['data'][] = '';
             // location
             $tmp['data'][] = date('m/d/Y H:i', strtotime($alert->dateTime));
             $tmp['data'][] = $alert->message;
             $forwardedBy = '';
             if ($alert->forwardedBy > 0) {
                 $person = new Person();
                 $person->personId = (int) $alert->forwardedBy;
                 $person->populate();
                 $forwardedBy = $person->displayName;
             }
             $tmp['data'][] = $forwardedBy;
             // forwarded
             $tmp['data'][] = $alert->comment;
             // comment
             $controllerName = call_user_func($objectClass . "::" . "getControllerName");
             $jumpLink = call_user_func_array($controllerName . "::" . "buildJSJumpLink", array($alert->objectId, $alert->userId, $objectClass));
             $js = "function jumpLink{$objectClass}(objectId,patientId) {\n{$jumpLink}\n}";
             $tmp['data'][] = $js;
             $tmp['data'][] = $objectClass . ':' . $alert->objectId . ':' . $patient->personId;
             $rows[] = $tmp;
         }
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows));
 }
开发者ID:jakedorst,项目名称:ch3-dev-preview,代码行数:55,代码来源:GeneralAlertsController.php

示例3: _setActivePatient

 public function _setActivePatient($personId)
 {
     if (!$personId > 0) {
         return;
     }
     $patient = new Patient();
     $patient->personId = (int) $personId;
     $patient->populate();
     $patient->person->populate();
     $this->_patient = $patient;
     //$this->_visit = null;
     $this->view->patient = $this->_patient;
 }
开发者ID:psoas,项目名称:ch3-dev-preview,代码行数:13,代码来源:MainToolbarController.php

示例4: pidLookupAction

 public function pidLookupAction()
 {
     $hl7 = $this->_getParam('DATA');
     $fields = split("\\|", $hl7);
     $personId = 0;
     if (count($fields) > 18) {
         $personId = (int) $fields[19];
         //field containing the MRN
     }
     $patient = new Patient();
     $patient->personId = $personId;
     if ($personId > 0 && $patient->populate()) {
         urlencode($this->render('pid-lookup.phtml'));
     }
     return urlencode($this->render('not-found'));
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:16,代码来源:ElcpController.php

示例5: detailAction

 public function detailAction()
 {
     $personId = (int) $this->_getParam('personId');
     if (!$personId > 0) {
         $this->_helper->autoCompleteDojo($personId);
     }
     $db = Zend_Registry::get('dbAdapter');
     $patient = new Patient();
     $patient->personId = (int) $personId;
     $patient->populate();
     $patient->person->populate();
     $outputArray = $patient->toArray();
     $outputArray['displayGender'] = $patient->displayGender;
     $outputArray['age'] = $patient->age;
     $acj = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $acj->suppressExit = true;
     $acj->direct($outputArray);
 }
开发者ID:psoas,项目名称:ch3-dev-preview,代码行数:18,代码来源:PatientSelectController.php

示例6: indexAction

 public function indexAction()
 {
     $this->view->filterDates = $this->_filterDates;
     $this->view->filterGraphs = $this->_filterGraphs;
     $this->view->labelKeyValues = $this->getVitalSignsTemplateKeyValue();
     $this->render('index');
     return;
     exit;
     $pat = new Patient();
     $pat->personId = 1983;
     $pat->populate();
     echo $pat->bmi;
     //var_dump(VitalSignGroup::getBMIVitalsForPatientId(1983));
     exit;
     $vitals = new VitalSignGroup();
     $vitalsIter = $vitals->getIterator();
     foreach ($vitalsIter as $vitals) {
         print_r($vitals->toString());
     }
     $this->render();
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:21,代码来源:VitalSignsController.php

示例7: flowSheetTemplateAction

 public function flowSheetTemplateAction()
 {
     $personId = (int) $this->_getParam('personId');
     $patient = new Patient();
     $patient->personId = $personId;
     $patient->populate();
     $vitalSignIter = new VitalSignGroupsIterator();
     $vitalSignIter->setFilter(array("personId" => $personId));
     $xmlData = PdfController::toXML($patient, 'Patient', null);
     $xmlData .= "<VitalSignGroups>";
     $loop = 0;
     foreach ($vitalSignIter as $vitalGroup) {
         $xmlData .= PdfController::toXML($vitalGroup, 'VitalSignGroup', null);
         if ($loop > 5) {
             exit;
         }
         $loop++;
     }
     $xmlData .= "</VitalSignGroups>";
     //header('Content-type: text/xml;');
     //echo $xmlData;exit;
     $this->_forward('pdf-merge-attachment', 'pdf', null, array('attachmentReferenceId' => '5', 'xmlData' => $xmlData));
 }
开发者ID:jakedorst,项目名称:ch3-dev-preview,代码行数:23,代码来源:ReportsController.php

示例8: _setActivePatient

 public function _setActivePatient($personId, $visitId)
 {
     if (!$personId > 0) {
         return;
     }
     $memcache = Zend_Registry::get('memcache');
     $patient = new Patient();
     $patient->personId = (int) $personId;
     $patient->populate();
     $patient->person->populate();
     $this->_patient = $patient;
     $this->view->patient = $this->_patient;
     $mostRecentRaw = $memcache->get('mostRecent');
     $currentUserId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
     $personId = $patient->personId;
     $teamId = $patient->teamId;
     if ($mostRecentRaw === false) {
         $mostRecent = array();
     } else {
         $mostRecent = unserialize($mostRecentRaw);
     }
     if (!array_key_exists($currentUserId, $mostRecent)) {
         $mostRecent[$currentUserId] = array();
     }
     if (array_key_exists($personId, $mostRecent[$currentUserId])) {
         unset($mostRecent[$currentUserId][$personId]);
     }
     $name = $patient->person->last_name . ', ' . $patient->person->first_name . ' ' . substr($patient->person->middle_name, 0, 1) . ' #' . $patient->record_number;
     $mostRecent[$currentUserId][$patient->personId] = array('name' => $name, 'teamId' => $teamId);
     $memcache->set('mostRecent', serialize($mostRecent));
     if (strlen($patient->teamId) > 0) {
         $name = TeamMember::ENUM_PARENT_NAME;
         $enumeration = new Enumeration();
         $enumeration->populateByEnumerationName($name);
         $enumerationsClosure = new EnumerationsClosure();
         $rowset = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1);
         $patientEnumerationId = 0;
         foreach ($rowset as $row) {
             if ($patient->teamId == $row->key) {
                 $patientEnumerationId = $row->enumerationId;
                 break;
             }
         }
         if ($patientEnumerationId !== 0) {
             $this->view->team = TeamMember::generateTeamTree($patientEnumerationId);
         }
     }
     // POSTINGS
     $allergies = array();
     $patientAllergy = new PatientAllergy();
     $patientAllergyIterator = $patientAllergy->getIteratorByPatient($personId);
     foreach ($patientAllergyIterator as $allergy) {
         if ($allergy->noKnownAllergies) {
             continue;
         }
         $allergies[] = $allergy->toArray();
     }
     $this->view->allergies = $allergies;
     $notes = array();
     $patientNote = new PatientNote();
     $patientNoteIterator = $patientNote->getIterator();
     $filters = array();
     $filters['patient_id'] = $personId;
     $filters['active'] = 1;
     $filters['posting'] = 1;
     $patientNoteIterator->setFilters($filters);
     foreach ($patientNoteIterator as $note) {
         $notes[] = $note->toArray();
     }
     $this->view->notes = $notes;
     //REMINDERS
     $ctr = 0;
     $hsa = new HealthStatusAlert();
     $hsaIterator = $hsa->getIteratorByStatusWithPatientId('active', $personId);
     foreach ($hsaIterator as $row) {
         $ctr++;
     }
     if ($ctr > 0) {
         $this->view->reminders = $ctr;
     }
     // VISITS
     //$this->_visit = null;
     if (!$visitId > 0) {
         return;
     }
     $visit = new Visit();
     $visit->encounter_id = (int) $visitId;
     $visit->populate();
     $this->_visit = $visit;
     $this->view->visit = $this->_visit;
 }
开发者ID:jakedorst,项目名称:ch3-dev-preview,代码行数:91,代码来源:MainToolbarController.php

示例9: listTeamJsonAction

 public function listTeamJsonAction()
 {
     $this->_helper->autoCompleteDojo(array());
     $patientId = (int) $this->_getParam("patientId");
     $patient = new Patient();
     $patient->personId = $patientId;
     $patient->populate();
     $patient->person->populate();
     $db = Zend_Registry::get("dbAdapter");
     $dbSelect = $db->select()->from("patient")->where("teamId = ?", $patient->teamId);
     $patientIterator = $patient->getIterator($dbSelect);
     foreach ($patientIterator as $pat) {
         $tmp = array();
         $tmp['id'] = $pat->person_id;
         $tmp['data'][] = $pat->person->getDisplayName();
         $tmp['data'][] = $pat->email;
         $tmp['data'][] = $pat->phone_number;
         $rows[] = $tmp;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows));
 }
开发者ID:jakedorst,项目名称:ch3-dev-preview,代码行数:23,代码来源:TeamManagerController.php

示例10: processDetailsAction

 public function processDetailsAction()
 {
     $retval = false;
     $params = $this->_getParam('patient');
     $patientId = (int) $params['personId'];
     if ($patientId > 0) {
         if (!(int) $params['person']['personId'] > 0) {
             $params['person']['personId'] = $patientId;
         }
         if (isset($params['person']['active']) && $params['person']['active']) {
             $params['person']['active'] = 1;
         } else {
             $params['person']['active'] = 0;
         }
         $patient = new Patient();
         $patient->person_id = $patientId;
         $patient->populate();
         $patient->populateWithArray($params);
         $patient->person->person_id = $patientId;
         $patient->person->populate();
         $patient->person->populateWithArray($params['person']);
         $patient->persist();
         $retval = true;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $data = __('Record updated successfully.');
     if ($retval == false) {
         $data = __('There was an error attempting to update patient details.');
     }
     $json->direct($data);
 }
开发者ID:jakedorst,项目名称:ch3-dev-preview,代码行数:32,代码来源:PatientController.php

示例11: _populateAppointmentRow

 protected function _populateAppointmentRow(Appointment $app, array &$columnData, $colIndex, $index, $rowsLen)
 {
     $startToTime = strtotime($app->start);
     $endToTime = strtotime($app->end);
     $tmpStart = date('H:i', $startToTime);
     $tmpEnd = date('H:i', $endToTime);
     $timeLen = ceil(($endToTime - $startToTime) / 60 / self::FILTER_MINUTES_INTERVAL);
     $appointmentId = (int) $app->appointmentId;
     $patientId = (int) $app->patientId;
     $providerId = (int) $app->providerId;
     $roomId = (int) $app->roomId;
     $patient = new Patient();
     $patient->personId = $patientId;
     $patient->populate();
     $id = isset($columnData[$colIndex]['id']) ? $columnData[$colIndex]['id'] : '';
     $columnData[$colIndex]['id'] = $appointmentId;
     if (strlen($id) > 0) {
         $columnData[$colIndex]['id'] .= 'i' . $id;
     }
     $visit = new Visit();
     $visit->appointmentId = $appointmentId;
     $visit->populateByAppointmentId();
     $visitIcon = $visit->visitId > 0 ? '<img src="' . $this->view->baseUrl . '/img/appointment_visit.png" alt="' . __('Visit') . '" title="' . __('Visit') . '" style="border:0px;height:18px;width:18px;margin-left:5px;" />' : '';
     $routingStatuses = array();
     if (strlen($app->appointmentCode) > 0) {
         $routingStatuses[] = __('Mark') . ': ' . $app->appointmentCode;
     }
     $routing = new Routing();
     $routing->personId = $patientId;
     $routing->appointmentId = $appointmentId;
     $routing->providerId = $providerId;
     $routing->roomId = $roomId;
     $routing->populateByAppointments();
     if (strlen($routing->stationId) > 0) {
         $routingStatuses[] = __('Station') . ': ' . $routing->stationId;
     }
     $routingStatus = implode(' ', $routingStatuses);
     $nameLink = $patientId > 0 ? "<a href=\"javascript:showPatientDetails({$patientId});\">{$patient->person->displayName} (#{$patient->recordNumber})</a>" : '';
     $cellRow = 20;
     $height = $cellRow * $timeLen * 1.1;
     $marginTop = 2;
     // compute and adjust margin top and height
     $heightPerMinute = $cellRow / self::FILTER_MINUTES_INTERVAL;
     $map = $columnData[$colIndex]['map'];
     $diff = ($startToTime - $map['start']) / 60;
     if ($diff > 0) {
         $marginTop += $diff * $heightPerMinute;
         $height -= $marginTop;
     }
     $marginLeft = $rowsLen > 1 && $index > 0 ? $index * 250 : 8;
     $zIndex = $colIndex . $index;
     $columnData[$colIndex]['data'][0] .= "<div onmousedown=\"calendarSetAppointmentId('{$appointmentId}')\" ondblclick=\"timeSearchDoubleClicked(this,event)\" appointmentId=\"{$appointmentId}\" visitId=\"{$visit->visitId}\" style=\"float:left;position:absolute;margin-top:{$marginTop}px;height:{$height}px;width:230px;overflow:hidden;border:thin solid black;margin-left:{$marginLeft}px;padding-left:2px;background-color:lightgrey;z-index:{$zIndex};\" class=\"dataForeground\" id=\"event{$appointmentId}\" onmouseover=\"calendarExpandAppointment({$appointmentId},this,{$height});\" onmouseout=\"calendarShrinkAppointment({$appointmentId},this,{$height},{$zIndex});\">{$tmpStart}-{$tmpEnd} {$nameLink} {$visitIcon} <br />{$routingStatus}<div class=\"bottomInner\" id=\"bottomInnerId{$appointmentId}\" style=\"white-space:normal;\">{$app->title}</div></div>";
     $columnData[$colIndex]['userdata']['visitId'] = $visit->visitId;
     $columnData[$colIndex]['userdata']['appointmentId'] = $appointmentId;
     $columnData[$colIndex]['userdata']['length'] = $timeLen;
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:56,代码来源:CalendarController.php

示例12: refillRequestDatasourceHandler

 public static function refillRequestDatasourceHandler(Audit $auditOrm, $eachTeam = true)
 {
     $ret = array();
     if ($auditOrm->objectClass != 'MedicationRefillRequest') {
         WebVista::debug('Audit:objectClass is not MedicationRefillRequest');
         return $ret;
     }
     $orm = new self();
     $orm->messageId = $auditOrm->objectId;
     if (!$orm->populate()) {
         WebVista::debug('Failed to populate');
         return $ret;
     }
     $objectClass = get_class($orm);
     $messaging = new Messaging();
     $messaging->messagingId = $orm->messageId;
     $messaging->populate();
     $medicationId = (int) $orm->medicationId;
     $providerId = (int) $messaging->providerId;
     $personId = (int) $messaging->personId;
     //if (!$personId > 0 || !$medicationId > 0) {
     if (!$personId > 0) {
         WebVista::debug('Refill request needs manual matching');
         return $ret;
     }
     $patient = new Patient();
     $patient->personId = $personId;
     $patient->populate();
     $teamId = (string) $patient->teamId;
     $alert = new GeneralAlert();
     $alertTable = $alert->_table;
     $msgTable = $messaging->_table;
     $db = Zend_Registry::get('dbAdapter');
     $sqlSelect = $db->select()->from($msgTable, null)->join($alertTable, $alertTable . '.objectId = ' . $msgTable . '.messagingId')->where($msgTable . '.objectType = ?', Messaging::TYPE_EPRESCRIBE)->where($msgTable . '.messageType = ?', 'RefillRequest')->where("{$alertTable}.status = 'new'")->where($alertTable . '.objectClass = ?', $objectClass)->where($alertTable . '.userId = ?', $providerId)->where($msgTable . '.personId = ?', $personId)->limit(1);
     if ($eachTeam) {
         $sqlSelect->where($alertTable . '.teamId = ?', $teamId);
     }
     $alert->populateWithSql($sqlSelect->__toString());
     $messages = array();
     if ($alert->generalAlertId > 0) {
         // existing general alert
         $messages[] = $alert->message;
     } else {
         // new general alert
         $alert->urgency = 'High';
         $alert->status = 'new';
         $alert->dateTime = date('Y-m-d H:i:s');
         $alert->objectClass = $objectClass;
         $alert->objectId = $auditOrm->objectId;
         $alert->userId = (int) $providerId;
         if ($eachTeam) {
             $alert->teamId = $teamId;
         }
     }
     $messages[] = 'Refill request pending. ' . $orm->details;
     $alert->message = implode("\n", $messages);
     return $alert->toArray();
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:58,代码来源:MedicationRefillRequest.php

示例13: generatePID

 public static function generatePID($patient)
 {
     if (!$patient instanceof Patient) {
         $patientId = (int) $patient;
         $patient = new Patient();
         $patient->personId = (int) $patientId;
         $patient->populate();
     }
     $patientId = (int) $patient->personId;
     $person = $patient->person;
     $statistics = PatientStatisticsDefinition::getPatientStatistics($patientId);
     $raceCode = '';
     $race = 'Unknown';
     if (isset($statistics['Race'])) {
         $race = $statistics['Race'];
     }
     if (isset($statistics['race'])) {
         $race = $statistics['race'];
     }
     if (strlen($statistics['Race']) > 0) {
         $race = $statistics['Race'];
         foreach (PatientStatisticsDefinition::listRaceCodes() as $key => $value) {
             if (strtolower($value) == strtolower($race)) {
                 $raceCode = $key;
                 break;
             }
         }
     }
     $addr = new Address();
     foreach ($addr->getIteratorByPersonId($patient->personId) as $address) {
         break;
     }
     $phoneHome = '';
     $phoneBusiness = '';
     $phoneNumber = new PhoneNumber();
     $phoneNumber->personId = $patient->personId;
     foreach ($phoneNumber->phoneNumbers as $phone) {
         if ($phoneHome == '' && $phone['type'] == 'HP') {
             $phoneHome = $phone['number'];
         }
         if ($phoneBusiness == '' && $phone['type'] == 'TE') {
             $phoneBusiness = $phone['number'];
         }
     }
     if ($phoneHome) {
         $phone = $phoneHome;
     }
     if ($phoneBusiness) {
         $phone = $phoneBusiness;
     }
     if (is_array($phone)) {
         $phone = $phone['number'];
     }
     if (substr($phone, 0, 1) == 1) {
         $phone = substr($phone, 1);
     }
     $areaCode = substr($phone, 0, 3);
     $localNumber = substr($phone, 3);
     $ethnic = 'Unknown';
     if (isset($statistics['Ethnicity'])) {
         $ethnic = $statistics['Ethnicity'];
     }
     if (isset($statistics['ethnicity'])) {
         $ethnic = $statistics['ethnicity'];
     }
     $ethnicId = strtoupper(substr($ethnic, 0, 1));
     if ($ethnicId != 'H' && $ethnicId != 'N' && $ethnicId != 'U') {
         $ethnicId = 'U';
     }
     return 'PID|||' . $patient->recordNumber . '^^^MPI&2.16.840.1.113883.19.3.2.1&ISO^MR||' . $person->lastName . '^' . $person->firstName . '||' . date('Ymd', strtotime($person->dateOfBirth)) . '|' . $person->gender . '||' . $raceCode . '^' . $race . '^HL70005|' . $address->line1 . '^^' . $address->city . '^' . $address->state . '^' . $address->zipCode . '^USA^M||^PRN^^^^' . $areaCode . '^' . $localNumber . '|||||||||' . $ethnicId . '^' . $ethnic . '^HL70189';
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:71,代码来源:LabResultsMessage.php

示例14: pull

 public static function pull()
 {
     $ch = curl_init();
     $ePrescribeURL = Zend_Registry::get('config')->healthcloud->URL;
     $ePrescribeURL .= 'ss-manager.raw/pull-inbounds?apiKey=' . Zend_Registry::get('config')->healthcloud->apiKey;
     curl_setopt($ch, CURLOPT_URL, $ePrescribeURL);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     $output = curl_exec($ch);
     $error = '';
     $ret = 0;
     if (!curl_errno($ch)) {
         try {
             $xml = new SimpleXMLElement($output);
             foreach ($xml->data as $messages) {
                 foreach ($messages as $key => $message) {
                     $rawMessage = base64_decode((string) $message->rawMessage);
                     if ($key == 'refillRequest') {
                         $messageId = (string) $message->messageId;
                         $rxReferenceNumber = (string) $message->rxReferenceNumber;
                         $prescriberOrderNumber = (string) $message->prescriberOrderNumber;
                         $auditId = 0;
                         $medicationId = 0;
                         $xmlMessage = new SimpleXMLElement($rawMessage);
                         $lastName = (string) $xmlMessage->Body->RefillRequest->Patient->Name->LastName;
                         $firstName = (string) $xmlMessage->Body->RefillRequest->Patient->Name->FirstName;
                         $messageInfo = ' for ' . $lastName . ', ' . $firstName;
                         $description = (string) $xmlMessage->Body->RefillRequest->MedicationPrescribed->DrugDescription;
                         $datePrescribed = date('m/d/Y', strtotime((string) $xmlMessage->Body->RefillRequest->MedicationPrescribed->WrittenDate));
                         $messageInfo .= ' - ' . $description . ' #' . $datePrescribed;
                         if (strlen($prescriberOrderNumber) > 0) {
                             // currently check for medicationId using the prescriberOrderNumber medication_audit
                             $medAudit = explode('_', $prescriberOrderNumber);
                             $medicationId = (int) $medAudit[0];
                             $auditId = isset($medAudit[1]) ? (int) $medAudit[1] : 0;
                         }
                         $medication = new Medication();
                         $medication->medicationId = $medicationId;
                         $medication->populate();
                         $patientId = (int) $medication->personId;
                         $unresolved = 0;
                         // retrieve providerId using SPI
                         $SPI = (string) $xmlMessage->Body->RefillRequest->Prescriber->Identification->SPI;
                         $eprescriber = new EPrescriber();
                         $eprescriber->populateBySPI($SPI);
                         $providerId = (int) $eprescriber->providerId;
                         if (!$patientId > 0) {
                             // PON not set or invalid PON, try to automatch based on name, dob, medication and dates in the refreq, if only one match automatically link with correct PON
                             // retrieve pharmacyId using NCPDPID
                             $NCPDPID = (string) $xmlMessage->Body->RefillRequest->Pharmacy->Identification->NCPDPID;
                             $pharmacy = new Pharmacy();
                             $pharmacy->NCPDPID = $NCPDPID;
                             $pharmacy->populatePharmacyIdWithNCPDPID();
                             $pharmacyId = (string) $pharmacy->pharmacyId;
                             $gender = (string) $xmlMessage->Body->RefillRequest->Patient->Gender;
                             $dob = (string) $xmlMessage->Body->RefillRequest->Patient->DateOfBirth;
                             // retrieve patientId using LastName, FirstName, Gender and DOB
                             $db = Zend_Registry::get('dbAdapter');
                             $sqlSelect = $db->select()->from('person', 'person_id')->where('last_name = ?', $lastName)->where('first_name = ?', $firstName)->where('date_of_birth = ?', date('Y-m-d', strtotime($dob)))->limit(1);
                             if ($row = $db->fetchRow($sqlSelect)) {
                                 $patientId = $row['person_id'];
                             }
                             //trigger_error($sqlSelect->__toString());
                             // $qualifiers = Medication::listQuantityQualifiersMapping(); TODO: since qualifier are ambiguous, temporarily not to use this qualifier
                             $quantity = (string) $xmlMessage->Body->RefillRequest->MedicationPrescribed->Quantity->Value;
                             $sqlSelect = $db->select()->from('medications')->where('description = ?', $description)->where('quantity = ?', $quantity)->where('personId = ?', (int) $patientId)->where('prescriberPersonId = ?', (int) $providerId)->where('pharmacyId = ?', (int) $pharmacyId);
                             $writtenDate = (string) $xmlMessage->Body->RefillRequest->MedicationPrescribed->WrittenDate;
                             if (strlen($writtenDate) > 0) {
                                 $sqlSelect->where('datePrescribed LIKE ?', date('Y-m-d', strtotime($writtenDate)) . '%');
                             }
                             $medicationMatched = false;
                             //trigger_error($sqlSelect->__toString());
                             $rows = $db->fetchAll($sqlSelect);
                             if (count($rows) == 1) {
                                 $medication = new Medication();
                                 $medication->populateWithArray($rows[0]);
                                 $medicationId = $medication->medicationId;
                                 $auditId = Medication::getAuditId($medicationId);
                                 if ($auditId > 0) {
                                     $xmlMessage->Body->RefillRequest->PrescriberOrderNumber = $medicationId . '_' . $auditId;
                                     $rawMessage = $xmlMessage->asXML();
                                 }
                                 //trigger_error($sqlSelect->__toString());
                                 $medicationMatched = true;
                             }
                             $messageInfo = ' (Invalid/Missing PON';
                             if ($patientId > 0 && $medicationMatched) {
                                 $patient = new Patient();
                                 $patient->personId = $patientId;
                                 $patient->populate();
                                 $messageInfo .= ' - automatched to \'' . $patient->displayName . '\' MRN#' . $patient->recordNumber;
                             } else {
                                 $unresolved = 1;
                             }
                             $messageInfo .= ')';
                         }
                         $refillRequest = new MedicationRefillRequest();
                         $refillRequest->messageId = $messageId;
//.........这里部分代码省略.........
开发者ID:dragonlet,项目名称:clearhealth,代码行数:101,代码来源:ePrescribe.php

示例15: newRxAction

 public function newRxAction()
 {
     $medicationId = 1077476;
     $data = array();
     $medication = new Medication();
     $medication->medicationId = $medicationId;
     $medication->populate();
     $data['PrescriberOrderNumber'] = $medication->medicationId;
     $medData = array();
     $medData['DrugDescription'] = $medication->description;
     $medData['Strength'] = $medication->strength;
     $medData['StrengthUnits'] = $medication->unit;
     $medData['Quantity'] = $medication->quantity;
     $medData['Directions'] = $medication->directions;
     $medData['Refills'] = $medication->refills;
     $medData['Substitutions'] = $medication->substitution;
     $medData['WrittenDate'] = date('Ymd', strtotime($medication->datePrescribed));
     $data['medication'] = $medData;
     $pharmacy = new Pharmacy();
     $pharmacy->pharmacyId = $medication->pharmacyId;
     $pharmacy->populate();
     $pharmacyData = array();
     $pharmacyData['NCPDPID'] = $pharmacy->NCPDPID;
     $pharmacyData['StoreName'] = $pharmacy->StoreName;
     $pharmacyData['AddressLine1'] = $pharmacy->AddressLine1 . ' ' . $pharmacy->AddressLine2;
     $pharmacyData['City'] = $pharmacy->City;
     $pharmacyData['State'] = $pharmacy->State;
     $pharmacyData['ZipCode'] = $pharmacy->Zip;
     $pharmacyData['PhoneNumber'] = $pharmacy->PhonePrimary;
     $data['pharmacy'] = $pharmacyData;
     $provider = new Provider();
     $provider->personId = $medication->prescriberPersonId;
     $provider->populate();
     $prescriberData = array();
     $prescriberData['DEANumber'] = $provider->deaNumber;
     $prescriberData['SPI'] = $provider->sureScriptsSPI;
     $prescriberData['ClinicName'] = '';
     $prescriberData['LastName'] = $provider->person->lastName;
     $prescriberData['FirstName'] = $provider->person->firstName;
     $prescriberData['Suffix'] = '';
     $address = new Address();
     $address->personId = $provider->personId;
     $address->populateWithPersonId();
     $prescriberData['AddressLine1'] = $address->line1 . ' ' . $address->line2;
     $prescriberData['City'] = $address->city;
     $prescriberData['State'] = 'AZ';
     //$address->state;
     $prescriberData['ZipCode'] = $address->zipCode;
     $phoneNumber = new PhoneNumber();
     $phoneNumber->personId = $provider->personId;
     $phoneNumber->populateWithPersonId();
     $prescriberData['PhoneNumber'] = $phoneNumber->number;
     $data['prescriber'] = $prescriberData;
     $patient = new Patient();
     $patient->personId = $medication->personId;
     $patient->populate();
     $patientData = array();
     $patientData['LastName'] = $patient->person->lastName;
     $patientData['FirstName'] = $patient->person->firstName;
     $patientData['Gender'] = $patient->person->gender;
     $patientData['DateOfBirth'] = date('Ymd', strtotime($patient->person->dateOfBirth));
     $address = new Address();
     $address->personId = $patient->personId;
     $address->populateWithPersonId();
     $patientData['AddressLine1'] = $address->line1 . ' ' . $address->line2;
     $patientData['City'] = $address->city;
     $patientData['State'] = 'AZ';
     //$address->state;
     $patientData['ZipCode'] = $address->zipCode;
     $phoneNumber = new PhoneNumber();
     $phoneNumber->personId = $patient->personId;
     $phoneNumber->populateWithPersonId();
     $patientData['PhoneNumber'] = $phoneNumber->number;
     $data['patient'] = $patientData;
     $postFields = array();
     foreach ($data as $type => $row) {
         if (is_array($row)) {
             foreach ($row as $field => $value) {
                 $key = $type . '[' . $field . ']';
                 $postFields[$key] = $value;
             }
         } else {
             $postFields[$type] = $row;
         }
     }
     $ch = curl_init();
     $ePrescribeURL = Zend_Registry::get('config')->healthcloud->URL;
     $ePrescribeURL .= 'ss-manager.raw/new-rx?apiKey=' . Zend_Registry::get('config')->healthcloud->apiKey;
     curl_setopt($ch, CURLOPT_URL, $ePrescribeURL);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_USERPWD, 'admin:ch3!');
     $output = curl_exec($ch);
     trigger_error('OUTPUT: ' . $output, E_USER_NOTICE);
     $error = "";
     if (!curl_errno($ch)) {
//.........这里部分代码省略.........
开发者ID:dragonlet,项目名称:clearhealth,代码行数:101,代码来源:AdminEprescribeController.php


注:本文中的Patient::populate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。