/**
  * Add header
  *
  * @return void
  */
 function addHeader()
 {
     $dom = $this->dom;
     $root = $dom->addElement($dom, $this->getInteractionID());
     $dom->addNameSpaces();
     // id
     $id = $dom->addElement($root, "id");
     $this->setII($id, $this->_exchange_hl7v3->_id, CMbOID::getOIDFromClass($this->_exchange_hl7v3, $this->_receiver));
     // creationTime
     $creationTime = $dom->addElement($root, "creationTime");
     $dom->addAttribute($creationTime, "value", CHL7v3MessageXML::dateTime());
     // interactionId
     $interactionId = $dom->addElement($root, "interactionId");
     $this->setII($interactionId, $this->getInteractionID(), "2.16.840.1.113883.1.6");
     // processingCode
     $processingCode = $dom->addElement($root, "processingCode");
     $instance_role = CAppUI::conf("instance_role") == "prod" ? "P" : "D";
     $dom->addAttribute($processingCode, "code", $instance_role);
     // processingModeCode
     $processingModeCode = $dom->addElement($root, "processingModeCode");
     $dom->addAttribute($processingModeCode, "code", "T");
     // acceptAckCode
     $acceptAckCode = $dom->addElement($root, "acceptAckCode");
     $dom->addAttribute($acceptAckCode, "code", "AL");
 }
示例#2
0
 /**
  * Création du patientRole
  *
  * @return CCDAPOCD_MT000040_PatientRole
  */
 function setPatientRole()
 {
     $patientRole = new CCDAPOCD_MT000040_PatientRole();
     $patient = self::$cda_factory->patient;
     if ($patient->_ref_last_ins) {
         $ii = new CCDAII();
         $ii->setRoot("1.2.250.1.213.1.4.2");
         $ii->setExtension($patient->_ref_last_ins->ins);
         $patientRole->appendId($ii);
     }
     $ii = new CCDAII();
     $ii->setRoot(CMbOID::getOIDOfInstance($patient, self::$cda_factory->receiver));
     $ii->setExtension($patient->_id);
     $patientRole->appendId($ii);
     if ($patient->_IPP) {
         $ii = new CCDAII();
         /* @todo Gérer le master domaine*/
         //$group_domain = new CGroupDomain();
         //$group_domain->loadM
         $ii->setRoot(self::$cda_factory->root);
         $ii->setExtension($patient->_IPP);
         //libelle du domaine
         $ii->setAssigningAuthorityName("");
         $patientRole->appendId($ii);
     }
     $ad = $this->setAddress($patient);
     $patientRole->appendAddr($ad);
     $this->setTelecom($patientRole, $patient);
     $patientRole->setPatient(parent::$entite->setPatient());
     return $patientRole;
 }
 /**
  * set the EntryId query of the mediboard document
  *
  * @param CDocumentItem    $object   Mediboard document
  * @param CInteropReceiver $receiver Receiver
  *
  * @return void
  */
 function setEntryIDbyDocument($object, $receiver)
 {
     $oid = CMbOID::getOIDFromClass($object, $receiver);
     $oid = "{$oid}.{$object->_id}.{$object->version}";
     $this->document_item = $object;
     //Pour l'authentification indirecte, les valeurs ne doivent pas être changées
     $this->returnComposedObjects = "false";
     $this->returnType = "ObjectRef";
     //GetDocuments
     $this->query = "urn:uuid:5c4f972b-d56b-40ac-a5fc-c8ca9b40b9d4";
     $this->values = array("\$XDSDocumentEntryUniqueId" => array("{$oid}"));
 }
 /**
  * @see parent::addControlActProcess()
  */
 function addControlActProcess(CPatient $patient)
 {
     $dom = $this->dom;
     $controlActProcess = parent::addControlActProcess($patient);
     // reasonCode
     $reasonCode = $dom->addElement($controlActProcess, "reasonCode");
     $this->setCode($reasonCode, "TEST_EXST", "1.2.250.1.213.1.1.4.11", "Test d'existence de dossier");
     // queryByParameter
     $queryByParameter = $dom->addElement($controlActProcess, "queryByParameter");
     // queryId
     $queryId = $dom->addElement($queryByParameter, "queryId");
     $this->setII($queryId, $this->_exchange_hl7v3->_id, CMbOID::getOIDFromClass($this->_exchange_hl7v3, $this->_receiver));
     // statusCode
     $statusCode = $dom->addElement($queryByParameter, "statusCode");
     $dom->addAttribute($statusCode, "code", "new");
     // parameterList
     $parameterList = $dom->addElement($queryByParameter, "parameterList");
     // patientIdentifer
     $patientIdentifer = $dom->addElement($parameterList, "patientIdentifier");
     $value = $dom->addElement($patientIdentifer, "value");
     $this->setII($value, $patient->_ref_last_ins->ins, "1.2.250.1.213.1.4.2");
     $dom->addElement($patientIdentifer, "semanticsText", "Patient.id");
 }
 /**
  * @see parent::extractData
  */
 function extractData()
 {
     /** @var CDocumentItem $docItem */
     $docItem = $this->mbObject;
     $this->realm_code = "FR";
     $this->langage = $docItem->language;
     //Récupération du dernier log qui correspond à la date de création de cette version
     $last_log = $docItem->loadLastLog();
     $this->date_creation = $last_log->date;
     $this->date_author = $last_log->date;
     $this->targetObject = $object = $docItem->loadTargetObject();
     if ($object instanceof CConsultAnesth) {
         $this->targetObject = $object = $object->loadRefConsultation();
     }
     $this->practicien = $object->loadRefPraticien();
     $this->patient = $object->loadRefPatient();
     $this->patient->loadLastINS();
     $this->patient->loadIPP();
     $this->mbObject = $docItem;
     $this->root = CMbOID::getOIDFromClass($docItem, $this->receiver);
     $this->practicien->loadRefFunction();
     $this->practicien->loadRefOtherSpec();
     $group = new CGroups();
     $group->load($this->practicien->_group_id);
     $this->healt_care = CCdaTools::loadEntryJV("CI-SIS_jdv_healthcareFacilityTypeCode.xml", CIdSante400::getValueFor($group, "cda_association_code"));
     if ($docItem instanceof CFile) {
         $this->version = "1";
         $this->nom = basename($docItem->file_name);
     } else {
         $this->version = $docItem->version;
         $this->nom = $docItem->nom;
     }
     $this->id_cda_lot = "{$this->root}.{$docItem->_id}";
     $this->id_cda = "{$this->id_cda_lot}.{$this->version}";
     $confidentialite = "N";
     if ($docItem->private) {
         $confidentialite = "R";
     }
     $this->confidentialite = CCdaTools::loadEntryJV("CI-SIS_jdv_confidentialityCode.xml", $confidentialite);
     if ($docItem->type_doc) {
         $type = explode("^", $docItem->type_doc);
         $this->code = CCdaTools::loadEntryJV("CI-SIS_jdv_typeCode.xml", $type[1]);
     }
     //conformité HL7
     $this->templateId[] = $this->createTemplateID("2.16.840.1.113883.2.8.2.1", "HL7 France");
     //Conformité CI-SIS
     $this->templateId[] = $this->createTemplateID("1.2.250.1.213.1.1.1.1", "CI-SIS");
     //Confirmité IHE XSD-SD => contenu non structuré
     $this->templateId[] = $this->createTemplateID("1.3.6.1.4.1.19376.1.2.20", "IHE XDS-SD");
     $this->industry_code = CCdaTools::loadEntryJV("CI-SIS_jdv_practiceSettingCode.xml", "ETABLISSEMENT");
     $mediaType = "application/pdf";
     //Génération du PDF
     if ($docItem instanceof CFile) {
         $path = $docItem->_file_path;
         switch ($docItem->file_type) {
             case "image/tiff":
                 $mediaType = "image/tiff";
                 break;
             case "application/pdf":
                 $mediaType = $docItem->file_type;
                 $path = CCdaTools::generatePDFA($docItem->_file_path);
                 break;
             case "image/jpeg":
             case "image/jpg":
                 $mediaType = "image/jpeg";
                 break;
             case "application/rtf":
                 $mediaType = "text/rtf";
                 break;
             default:
                 $docItem->convertToPDF();
                 $file = $docItem->loadPDFconverted();
                 $path = CCdaTools::generatePDFA($file->_file_path);
         }
     } else {
         if ($msg = $docItem->makePDFpreview(1, 0)) {
             throw new CMbException($msg);
         }
         $file = $docItem->_ref_file;
         $path = CCdaTools::generatePDFA($file->_file_path);
     }
     $this->file = $path;
     $this->mediaType = $mediaType;
     $service["nullflavor"] = null;
     switch (get_class($object)) {
         case "CSejour":
             /** @var CSejour $object CSejour */
             $dp = $object->DP;
             $service["time_start"] = $object->entree;
             $service["time_stop"] = $object->sortie;
             $service["executant"] = $object->loadRefPraticien();
             if ($dp) {
                 $service["oid"] = "2.16.840.1.113883.6.3";
                 $service["code"] = $dp;
                 $service["type_code"] = "cim10";
             } else {
                 $service["nullflavor"] = "UNK";
             }
             break;
         case "COperation":
             /** @var COperation $object COperation */
             $no_acte = 0;
             foreach ($object->loadRefsActesCCAM() as $_acte_ccam) {
                 if ($_acte_ccam->code_activite === "4" || !$_acte_ccam->_check_coded || $no_acte >= 1) {
                     continue;
                 }
                 $service["time_start"] = $_acte_ccam->execution;
                 $service["time_stop"] = "";
                 $service["code"] = $_acte_ccam->code_acte;
                 $service["oid"] = "1.2.250.1.213.2.5";
                 $_acte_ccam->loadRefExecutant();
                 $service["executant"] = $_acte_ccam->_ref_executant;
                 $service["type_code"] = "ccam";
                 $no_acte++;
             }
             if ($no_acte === 0) {
                 $service["time_start"] = $object->debut_op;
                 $service["time_stop"] = $object->fin_op;
                 $service["executant"] = $object->loadRefPraticien();
                 $service["nullflavor"] = "UNK";
             }
             break;
         case "CConsultation":
             /** @var CConsultation $object CConsultation */
             $object->loadRefPlageConsult();
             $no_acte = 0;
             foreach ($object->loadRefsActesCCAM() as $_acte_ccam) {
                 if (!$_acte_ccam->_check_coded || $_acte_ccam->code_activite === "4" || $no_acte >= 1) {
                     continue;
                 }
                 $service["time_start"] = $_acte_ccam->execution;
                 $service["time_stop"] = "";
                 $service["code"] = $_acte_ccam->code_acte;
                 $service["oid"] = "1.2.250.1.213.2.5";
                 $_acte_ccam->loadRefExecutant();
                 $service["executant"] = $_acte_ccam->_ref_executant;
                 $service["type_code"] = "ccam";
                 $no_acte++;
             }
             if ($no_acte === 0) {
                 $service["time_start"] = $object->_datetime;
                 $service["time_stop"] = $object->_date_fin;
                 $service["executant"] = $object->loadRefPraticien();
                 $service["nullflavor"] = "UNK";
             }
             break;
         default:
     }
     $this->service_event = $service;
     if ($this->old_version) {
         $oid = CMbOID::getOIDFromClass($docItem, $this->receiver);
         $this->old_version = "{$oid}.{$this->old_id}.{$this->old_version}";
     }
 }
示例#6
0
 /**
  * Retourne l'OID du patient
  *
  * @param CPatient         $patient  Patient
  * @param CInteropReceiver $receiver Receiver
  *
  * @return string
  */
 function getID($patient, $receiver)
 {
     $oid = CMbOID::getOIDOfInstance($patient, $receiver);
     $comp4 = $oid;
     $comp4 = "&{$comp4}&ISO";
     $comp1 = $patient->_IPP ? $patient->_IPP : $patient->_id;
     $comp5 = "PI";
     $result = "{$comp1}^^^{$comp4}^{$comp5}";
     return $result;
 }
示例#7
0
 /**
  * @see parent::createRegistryPackage
  */
 function createRegistryPackage($id)
 {
     /** @var CCDAFactory $factory */
     $factory = $this->mbObject;
     $cla_id =& $this->id_classification;
     $ei_id =& $this->id_external;
     $ins = $this->ins_patient;
     $this->name_submission = $id;
     $specialty = $this->specialty;
     $object = $this->targetObject;
     $registry = new CXDSRegistryPackage($id);
     //date de soumission
     $registry->setSubmissionTime(array(CXDSTools::getTimeUtc()));
     //PS qui envoie le document
     $document = new CXDSDocumentEntryAuthor("cla{$cla_id}", $id, true);
     $this->setClaId();
     $document->setAuthorPerson(array($this->xcn_mediuser));
     $document->setAuthorSpecialty(array($specialty));
     //Institution qui envoie le document
     $document->setAuthorInstitution(array($this->xon_etablissement));
     $registry->appendDocumentEntryAuthor($document);
     //type d'activité pour lequel on envoie les documents
     $code = "";
     switch (get_class($object)) {
         case "COperation":
             $object = $object->loadRefSejour();
         case "CSejour":
             switch ($object->type) {
                 case "comp":
                     $code = "03";
                     break;
                 case "ambu":
                     $code = "23";
                     break;
                 case "urg":
                     $code = "10";
                     break;
                 default:
                     $code = "07";
             }
             break;
         case "CConsultation":
             $code = "07";
             break;
         default:
     }
     $entry = CXDSTools::loadEntryJV("ASIP-SANTE_contentTypeCode.xml", $code);
     $content = new CXDSContentType("cla{$cla_id}", $id, $entry["id"]);
     $this->setClaId();
     $content->setCodingScheme(array($entry["oid"]));
     $content->setContentTypeCodeDisplayName($entry["name"]);
     $registry->setContentType($content);
     //spécification d'un SubmissionSet ou d'un folder, ici submissionSet
     $registry->setSubmissionSet("cla{$cla_id}", $id, false);
     $this->setClaId();
     //patient du document
     $registry->setPatientId("ei{$ei_id}", $id, $ins);
     $this->setEiId();
     $receiver = $factory->receiver;
     //OID de l'instance serveur
     $oid_instance = CMbOID::getOIDOfInstance($registry, $receiver);
     $registry->setSourceId("ei{$ei_id}", $id, $oid_instance);
     $this->setEiId();
     //OID unique
     $oid = CMbOID::getOIDFromClass($registry, $receiver);
     $cxds_submissionlot = new CXDSSubmissionLot();
     $cxds_submissionlot->date = "now";
     $cxds_submissionlot->type = $this->type;
     if ($msg = $cxds_submissionlot->store()) {
         throw new CMbException($msg);
     }
     $this->id_submission = $cxds_submissionlot->_id;
     $this->oid["lot"] = "{$oid}.{$cxds_submissionlot->_id}";
     $registry->setUniqueId("ei{$ei_id}", $id, $this->oid["lot"]);
     $this->setEiId();
     return $registry;
 }