/** * Build LCH segement * * @param CHL7v2Event $event Event * * @return null */ function build(CHL7v2Event $event) { parent::build($event); $entity = $this->entity; $code = $this->code; $primary_key = array_search(get_class($entity), CHL7v2EventMFN::$entities); $primary_key = $primary_key . $entity->_id; mbTrace($entity); // LCH-1: Primary Key Value -LCH - LCH (PL) (Requis) $data[] = $primary_key; // LCH-2: Segment Action Code - LCH (ID) (Optional) $data[] = null; // LCH-3: Segment Unique Key - LCH (EI) (Optional) $data[] = null; // LCH-4: Location Characteristic ID - LCH (CWE) (Requis) $HL7_value = CHL7v2TableEntry::mapTo("7878", $code); $data[] = array(array($HL7_value, CHL7v2TableEntry::getDescription("7878", $HL7_value), "L")); // if si dans la chaine tu as RSPNSBL // alors : // $user = $entity->loadRefUser(); // $user->$code // else // $entity->$code // LCH-5: Location Characteristic Value - LCH (CWE) (Requis) $data[] = null; $this->fill($data); }
/** * Build ERR segement * * @param CHL7v2Event $event Event * * @return null */ function build(CHL7v2Event $event) { parent::build($event); $version = $event->message->version; $error = $this->error; $acknowledgment = $this->acknowledgment; $data = array(); if ($error) { // ERR-1: Error Code and Location (ELD) (optional repeating) if ($version < "2.5") { $data[] = $error->getCodeLocation(); return $this->fill($data); } $data[] = null; // ERR-2: Error Location (ERL) (optional repeating) $data[] = array($error->getLocation()); // ERR-3: HL7 Error Code (CWE) $data[] = array($error->getHL7Code()); if ($error->level == CHL7v2Error::E_ERROR) { // ERR-4: Severity (ID) // Table - 0516 // W - Warning - Transaction successful, but there may issues // I - Information - Transaction was successful but includes information e.g., inform patient // E - Error - Transaction was unsuccessful $data[] = "E"; // ERR-5: Application Error Code (CWE) (optional) $data[] = array(array("E002", CAppUI::tr("CHL7Event-AR-E002"))); } else { $data[] = "W"; $data[] = array(); } // ERR-6: Application Error Parameter (ST) (optional repeating) $data[] = null; // ERR-7: Diagnostic Information (TX) (optional) $data[] = null; // ERR-8: User Message (TX) (optional) $data[] = CAppUI::tr("CHL7v2Exception-{$error->code}") . ($error->data ? " ({$error->data})" : ""); // ERR-9: Inform Person Indicator (IS) (optional repeating) $data[] = null; // ERR-10: Override Type (CWE) (optional) $data[] = null; // ERR-11: Override Reason Code (CWE) (optional repeating) $data[] = null; // ERR-12: Help Desk Contact Point (XTN) (optional repeating) $data[] = null; } else { // ERR-1: Error Code and Location (ELD) (optional repeating) if ($version < "2.5") { $data[] = array(array(null, null, null, array($acknowledgment->hl7_error_code, CHL7v2TableEntry::getDescription("357", $acknowledgment->hl7_error_code), null, $acknowledgment->_mb_error_code, CAppUI::tr("CHL7Event-{$acknowledgment->ack_code}-{$acknowledgment->_mb_error_code}"), null))); return $this->fill($data); } $data[] = null; // ERR-2 $data[] = array(array(0, 0)); // ERR-3 $data[] = array(array($acknowledgment->hl7_error_code, CHL7v2TableEntry::getDescription("357", $acknowledgment->hl7_error_code))); // ERR-4 $data[] = $acknowledgment->severity; // ERR-5 $data[] = array(array($acknowledgment->_mb_error_code, CAppUI::tr("CHL7Event-{$acknowledgment->ack_code}-{$acknowledgment->_mb_error_code}"))); // ERR-6 $data[] = null; // ERR-7 $data[] = null; // ERR-8 $data[] = $acknowledgment->comments; // ERR-9 $data[] = null; // ERR-10 $data[] = null; // ERR-11 $data[] = null; // ERR-12 $data[] = null; } $this->fill($data); }