Пример #1
0
 public function getEncounterSummary(stdClass $params)
 {
     $this->setEid($params->eid);
     $record = $this->getEncounter($params);
     $encounter = (array) $record['encounter'];
     $encounter['patient'] = $this->patient->getPatientDemographicDataByPid($encounter['pid']);
     if (!empty($e)) {
         return ['success' => true, 'encounter' => $e];
     } else {
         return ['success' => false, 'error' => "Encounter ID {$params->eid} not found"];
     }
 }
Пример #2
0
 public function getPatientsZonesByFloorPlanId($FloorPlanId)
 {
     $zones = array();
     $this->db->setSQL("SELECT pz.id AS patientZoneId,\n\t\t\t\t\t\t\t\t  pz.pid,\n\t\t\t\t\t\t\t\t  pz.uid,\n\t\t\t\t\t\t\t\t  pz.zone_id AS zoneId,\n\t\t\t\t\t\t\t\t  time_in AS zoneTimerIn,\n\t\t\t\t\t\t\t\t  fpz.floor_plan_id AS floorPlanId\n\t\t\t\t\t\t\t FROM patient_zone AS pz\n\t\t\t\t\t\tLEFT JOIN floor_plans_zones AS fpz ON pz.zone_id = fpz.id\n\t\t\t\t\t\t\tWHERE fpz.floor_plan_id = {$FloorPlanId} AND pz.time_out IS NULL");
     foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $zone) {
         $zone['patient'] = $this->patient->getPatientDemographicDataByPid($zone['pid']);
         $zone['warning'] = $this->patient->getPatientArrivalLogWarningByPid($zone['pid']);
         $pool = $this->pool->getCurrentPatientPoolAreaByPid($zone['pid']);
         $zone['poolArea'] = $pool['poolArea'];
         $zone['priority'] = $pool['priority'];
         $zone['eid'] = $pool['eid'];
         $zones[] = $zone;
     }
     return $zones;
 }
Пример #3
0
 public function getPatientsZonesByFloorPlanId($FloorPlanId)
 {
     $Patient = new Patient();
     $Pool = new PoolArea();
     $zones = $this->pz->sql("SELECT pz.id AS patientZoneId,\n\t\t\t\t\t\t\t\t  pz.pid,\n\t\t\t\t\t\t\t\t  pz.uid,\n\t\t\t\t\t\t\t\t  pz.zone_id AS zoneId,\n\t\t\t\t\t\t\t\t  time_in AS zoneTimerIn,\n\t\t\t\t\t\t\t\t  fpz.floor_plan_id AS floorPlanId\n\t\t\t\t\t\t\t FROM patient_zone AS pz\n\t\t\t\t\t\tLEFT JOIN floor_plans_zones AS fpz ON pz.zone_id = fpz.id\n\t\t\t\t\t\t\tWHERE fpz.floor_plan_id = {$FloorPlanId} AND pz.time_out IS NULL")->all();
     foreach ($zones as $i => $zone) {
         $zone['patient'] = $Patient->getPatientDemographicDataByPid($zone['pid']);
         $zone['name'] = $Patient->getPatientFullName();
         $zone['warning'] = $Patient->getPatientArrivalLogWarningByPid($zone['pid']);
         $pool = $Pool->getCurrentPatientPoolAreaByPid($zone['pid']);
         $zone['poolArea'] = $pool['poolArea'];
         $zone['priority'] = $pool['priority'];
         $zone['eid'] = $pool['eid'];
         $zones[$i] = $zone;
     }
     unset($Patient, $Pool);
     return $zones;
 }
Пример #4
0
 /**
  * Form now this is just getting the latest open encounter for all the patients.
  *
  * @param $params
  *
  * @return array
  */
 public function getPatientsByPoolAreaAccess($params)
 {
     Matcha::pauseLog(true);
     if (is_numeric($params)) {
         $uid = $params;
     } elseif (!is_numeric($params) && isset($params->eid)) {
         $uid = $params->eid;
     } elseif (!isset($_SESSION['user']['id'])) {
         return [];
     } else {
         $uid = $_SESSION['user']['id'];
     }
     $this->acl = new ACL($uid);
     $pools = [];
     if ($this->acl->hasPermission('use_pool_areas')) {
         $this->setPatient();
         $activeAreas = $this->getFacilityActivePoolAreas();
         $areas = [];
         $pools = [];
         if (!empty($activeAreas)) {
             foreach ($activeAreas as $activeArea) {
                 if ($activeArea['id'] == 1 && $this->acl->hasPermission('access_poolcheckin') || $activeArea['id'] == 2 && $this->acl->hasPermission('access_pooltriage') || $activeArea['id'] == 3 && $this->acl->hasPermission('access_poolphysician') || $activeArea['id'] == 4 && $this->acl->hasPermission('access_poolcheckout')) {
                     $areas[] = 'pp.area_id = \'' . $activeArea['id'] . '\'';
                 }
             }
             $whereAreas = '(' . implode(' OR ', $areas) . ')';
             $sql = "SELECT pp.*, p.fname, p.lname, p.mname, pa.title\n\t\t\t\t\t  FROM `patient_pools` AS pp\n\t\t\t\t LEFT JOIN `patient` AS p ON pp.pid = p.pid\n\t\t\t\t LEFT JOIN `pool_areas` AS pa ON pp.area_id = pa.id\n\t\t\t\t     WHERE {$whereAreas}\n\t\t\t\t\t   AND pp.time_out IS NULL\n\t\t\t\t\t   AND pp.in_queue = '1'\n\t\t\t      ORDER BY pp.time_in\n\t\t\t         LIMIT 25";
             $patientPools = $this->pa->sql($sql)->all();
             $pools = [];
             foreach ($patientPools as $patientPool) {
                 $patientPool['name'] = ($patientPool['eid'] != null ? '*' : '') . Person::fullname($patientPool['fname'], $patientPool['mname'], $patientPool['lname']);
                 $patientPool['shortName'] = Person::ellipsis($patientPool['name'], 15);
                 $patientPool['poolArea'] = $patientPool['title'];
                 $patientPool['patient'] = $this->patient->getPatientDemographicDataByPid($patientPool['pid']);
                 $patientPool['floorPlanId'] = $this->getFloorPlanIdByPoolAreaId($patientPool['area_id']);
                 $z = $this->getPatientCurrentZoneInfoByPid($patientPool['pid']);
                 $pools[] = empty($z) ? $patientPool : array_merge($patientPool, $z);
             }
             $pools = array_slice($pools, 0, 25);
         }
     }
     Matcha::pauseLog(false);
     return $pools;
 }
Пример #5
0
 /**
  * Method setHeader()
  */
 private function setHeader()
 {
     $this->xmlData['realmCode'] = ['@attributes' => ['code' => 'US']];
     $this->xmlData['typeId'] = ['@attributes' => ['root' => '2.16.840.1.113883.1.3', 'extension' => 'POCD_HD000040']];
     // QRDA templateId
     $this->xmlData['templateId'][] = ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.1.1']];
     // QDM-based QRDA templateId
     $this->xmlData['templateId'][] = ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.1.2']];
     // QRDA templateId
     $this->xmlData['templateId'][] = ['@attributes' => ['root' => '2.16.840.1.113883.10.20.24.1.1']];
     // QDM-based QRDA templateId
     $this->xmlData['templateId'][] = ['@attributes' => ['root' => '2.16.840.1.113883.10.20.24.1.2']];
     $this->xmlData['id'] = ['@attributes' => ['root' => 'MDHT', 'extension' => '1912668293']];
     $this->xmlData['code'] = ['@attributes' => ['code' => '34133-9', 'displayName' => 'Summary of episode note', 'codeSystem' => '2.16.840.1.113883.6.1', 'codeSystemName' => 'LOINC']];
     if (isset($this->encounter)) {
         $this->xmlData['title'] = $this->facility['name'] . ' - Clinical Office Visit Summary';
     } else {
         $this->xmlData['title'] = $this->facility['name'] . ' - Continuity of Care Document';
     }
     $this->xmlData['effectiveTime'] = ['@attributes' => ['value' => $this->timeNow]];
     $this->xmlData['confidentialityCode'] = ['@attributes' => ['code' => 'N', 'codeSystem' => '2.16.840.1.113883.5.25']];
     $this->xmlData['languageCode'] = ['@attributes' => ['code' => 'en-US']];
     $this->patientData = $this->Patient->getPatientDemographicDataByPid($this->pid);
     $this->user = $this->User->getCurrentUserData();
     $this->primaryProvider = $this->User->getUserByUid($this->patientData['primary_provider']);
     $this->xmlData['recordTarget'] = $this->getRecordTarget();
     $this->xmlData['author'] = $this->getAuthor();
     $this->xmlData['dataEnterer'] = $this->getDataEnterer();
     $this->xmlData['informant'] = $this->getInformant();
     $this->xmlData['custodian'] = $this->getCustodian();
     $this->xmlData['informationRecipient'] = $this->getInformationRecipient();
     $this->xmlData['legalAuthenticator'] = $this->getAuthenticator();
     $this->xmlData['authenticator'] = $this->getAuthenticator();
     $this->xmlData['documentationOf'] = $this->getDocumentationOf();
     if (isset($this->encounter)) {
         $this->xmlData['componentOf'] = $this->getComponentOf();
     }
     $this->xmlData['component']['structuredBody']['component'] = [];
 }
Пример #6
0
$healthProviderGUID = UUID::v4();
$Patient = new Patient();
$Encounter = new Encounter();
$Medical = new Medical();
$Facilities = new Facilities();
/**
 * Actors - (SHALL)
 * ------
 * Used as a container to define all of the individuals, organizations, locations, and systems associated with
 * data in the summary document. Within the CCR data set, an Actor is a <Person>, <Organization> or
 * <Device>. These correspond to the HL7 RIM Entity classes: LivingSubject, Person, Organization or
 * Device, and are mapped accordingly to these classes as exposed in a CDA document. Whereas ASTM CCR
 * enumerates all Actors in the CCR Footer and references those Actors from within the CCR Body with the
 * <ActorLink> element, CCD defines many participants within the document header and body.
 */
$patientData = $Patient->getPatientDemographicDataByPid($pid);
$actors = array('Actor' => array(array('ActorObjectID' => $patientGUID, 'Person' => array('Name' => array('CurrentName' => array('Given' => $patientData['fname'], 'Family' => $patientData['lname'], 'Suffix' => $patientData['title'])), 'DateOfBirth' => array('ExactDateTime' => date("Y-m-d", strtotime($patientData['DOB']))), 'Gender' => array('Text' => $patientData['sex'], 'Code' => array('Value' => $patientData['sex'] == 'Male' ? 'M' : 'F', 'CodingSystem' => '2.16.840.1.113883.5.1'))), 'IDs' => array(array('Type' => array('Text' => $patientData['pid']), 'ID' => '2-16-840-1-113883-19-5-996756495', 'IssuedBy' => array('ActorID' => '2.16.840.1.113883.19.5'), 'Source' => array('Actor' => array('ActorID' => $softwareGUID))), array('Type' => array('Text' => 'Covered party ID'), 'ID' => '14d4a520-7aae-11db-9fe1-0800200c9a66', 'IssuedBy' => array('ActorID' => '329fcdf0-7ab3-11db-9fe1-0800200c9a66'), 'Source' => array('Actor' => array('ActorID' => $softwareGUID)))), 'Source' => array('Actor' => array('ActorID' => $softwareGUID)))));
/**
 * References - (OPTIONAL)
 * ----------
 * Used to list the details concerning references to external data sources. Corresponds to the CDA R2
 * <reference> element. Whereas ASTM CCR enumerates all references in the CCR Footer, CCD defines the
 * reference within the section where it occurs.
 */
$references = array('Reference' => array(array('ReferenceObjectID' => UUID::v4(), 'Description' => array('Text' => 'Advance directive', 'Code' => array('Value' => '371538006', 'CodingSystem' => 'SNOMED CT')), 'Source' => array('Actor' => array('ActorID' => $softwareGUID)), 'Locations' => array('Location' => array(array('Actor' => array('ActorID' => 'b50b7910-7ffb-4f4c-bbe4-177ed68cbbf3')))))));
/**
 * Healthcare providers - (SHALL)
 * --------------------
 * Represents the healthcare providers involved in the current or pertinent historical care of the patient. At a
 * minimum, the patient’s key healthcare providers should be listed, particularly their primary physician and
 * any active consulting physicians, therapists, and counselors.