/**
  * Get acknowledgment status
  *
  * @return string
  */
 function getStatutAcknowledgment()
 {
     $dom = $this->dom;
     $this->xpath = $xpath = new CMbXPath($dom);
     $xpath->registerNamespace("rs", "urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0");
     $xpath->registerNamespace("xds", "urn:ihe:iti:xds-b:2007");
     $xpath->registerNamespace("xop", "http://www.w3.org/2004/08/xop/include");
     $status = $xpath->queryAttributNode("/rs:RegistryResponse", null, "status");
     $this->status = substr($status, strrpos($status, ":") + 1);
     return $this->status;
 }
 /**
  * @see parent::getAcknowledgment
  */
 function getAcknowledgment()
 {
     $dom = new CMbXMLDocument("UTF-8");
     $dom->loadXMLSafe($this->ack_data);
     $xpath = new CMbXPath($dom);
     $xpath->registerNamespace("rs", "urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0");
     $xpath->registerNamespace("rim", "urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0");
     $status = $xpath->queryAttributNode(".", null, "status");
     if ($status === "urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure") {
         $nodes = $xpath->query("//rs:RegistryErrorList/rs:RegistryError");
         $ack = array();
         foreach ($nodes as $_node) {
             $ack[] = array("status" => $xpath->queryAttributNode(".", $_node, "codeContext"), "context" => $xpath->queryAttributNode(".", $_node, "errorCode"));
         }
     } else {
         $nodes = $xpath->query("//rim:RegistryObjectList/rim:ObjectRef");
         $ack = array();
         foreach ($nodes as $_node) {
             $ack[] = array("status" => $xpath->queryAttributNode(".", $_node, "id"), "context" => "");
         }
     }
     return $ack;
 }
 /**
  * Return the result count
  *
  * @return string
  */
 function getResultCount()
 {
     return $this->xpath->queryAttributNode(".", null, "totalResultCount");
 }
 /**
  * Check service availability
  *
  * @throws CMbException
  *
  * @return void
  */
 public function checkServiceAvailability()
 {
     $url = $this->wsdl_url;
     if ($this->wsdl_original) {
         $url = $this->wsdl_original;
     }
     $xml = file_get_contents($url);
     $dom = new CMbXMLDocument();
     $dom->loadXML($xml);
     $xpath = new CMbXPath($dom);
     $xpath->registerNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
     $xpath->registerNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
     $xpath->registerNamespace("soap12", "http://schemas.xmlsoap.org/wsdl/soap12");
     $login = CMbArray::get($this->options, "login");
     $password = CMbArray::get($this->options, "password");
     $service_nodes = $xpath->query("//wsdl:service");
     foreach ($service_nodes as $_service_node) {
         $service_name = $_service_node->getAttribute("name");
         $port_nodes = $xpath->query("wsdl:port", $_service_node);
         foreach ($port_nodes as $_port_node) {
             $address = $xpath->queryAttributNode("soap:address|soap12:address", $_port_node, "location");
             if (!$address) {
                 continue;
             }
             if ($login && $password) {
                 $address = str_replace("://", "://{$login}:{$password}@", $address);
             }
             // Url exist
             $url_exist = CHTTPClient::checkUrl($address, $this->check_option);
             if (!$url_exist) {
                 throw new CMbException("Service '{$service_name}' injoignable à l'adresse : <em>{$address}</em>");
             }
         }
     }
 }
Exemple #5
0
 /**
  * Retourne une entrée dans un jeux de valeur
  *
  * @param String $name Nom du jeux de valeur
  * @param String $code Identifiant de la valeur voulut
  *
  * @return array
  */
 static function loadEntryJV($name, $code)
 {
     $path = "modules/xds/resources/jeux_de_valeurs/{$name}";
     $dom = new CMbXMLDocument();
     $dom->load($path);
     $xpath = new CMbXPath($dom);
     $node = $xpath->queryUniqueNode("//line[@id='{$code}']");
     $valeur = array("id" => $xpath->queryAttributNode(".", $node, "id"), "oid" => $xpath->queryAttributNode(".", $node, "oid"), "name" => $xpath->queryAttributNode(".", $node, "name"));
     return $valeur;
 }
Exemple #6
0
 /**
  * fonction permettant de créér la structure principal des classes d'un XSD
  *
  * @return bool
  */
 static function createClassFromXSD()
 {
     $pathXSD = "modules/cda/resources/POCD_MT000040.xsd";
     $pathDir = "modules/cda/classes/classesCDA/classesGenerate/";
     $dom = new CMbXMLDocument("UTF-8");
     $dom->load($pathXSD);
     $xpath = new CMbXPath($dom);
     $xpath->registerNamespace("xs", "http://www.w3.org/2001/XMLSchema");
     $nodeList = $xpath->query("//xs:complexType[@name] | //xs:simpleType[@name]");
     foreach ($nodeList as $_node) {
         $tabVariable = array();
         $tabProps = array();
         /** @var DOMElement $_node */
         $elements = $_node->getElementsByTagName("element");
         $nodeAttributes = $_node->getElementsByTagName("attribute");
         $nameNode = $xpath->queryAttributNode(".", $_node, "name");
         $nameNode = str_replace(".", "_", $nameNode);
         list($tabVariable, $tabProps) = self::createPropsForElement($elements, $tabVariable, $tabProps);
         list($tabVariable, $tabProps) = self::createPropsForElement($nodeAttributes, $tabVariable, $tabProps);
         $smarty = new CSmartyDP();
         $smarty->assign("name", $nameNode);
         $smarty->assign("variables", $tabVariable);
         $smarty->assign("props", $tabProps);
         $data = $smarty->fetch("defaultClassCDA.tpl");
         file_put_contents($pathDir . "CCDA" . $nameNode . ".class.php", $data);
     }
     return true;
 }
 /**
  * @see parent::createExtrinsicObject
  */
 function createExtrinsicObject($id, $lid = null)
 {
     /** @var CCDAFactory $factory */
     $factory = $this->mbObject;
     $cla_id =& $this->id_classification;
     $ei_id =& $this->id_external;
     $patient_id = $this->patient_id;
     $ins = $this->ins_patient;
     $hide_patient = $this->hide_patient;
     $hide_ps = $this->hide_ps;
     $service = $factory->service_event;
     $industry = $factory->industry_code;
     $praticien = $factory->practicien;
     $this->appendNameDocument($id);
     $extrinsic = new CXDSExtrinsicObject($id, "text/xml", $lid);
     //effectiveTime en UTC
     if ($factory->date_creation) {
         $extrinsic->setSlot("creationTime", array(CXDSTools::getTimeUtc($factory->date_creation)));
     }
     //languageCode
     $extrinsic->setSlot("languageCode", array($factory->langage));
     //legalAuthenticator XCN
     $legalAuthenticator = $this->getPerson($praticien);
     $extrinsic->setSlot("legalAuthenticator", array($legalAuthenticator));
     //documentationOf/serviceEvent/effectiveTime/low en UTC
     if ($service["time_start"]) {
         $extrinsic->setSlot("serviceStartTime", array(CXDSTools::getTimeUtc($service["time_start"])));
     }
     //documentationOf/serviceEvent/effectiveTime/high en UTC
     if ($service["time_stop"]) {
         $extrinsic->setSlot("serviceStopTime", array(CXDSTools::getTimeUtc($service["time_stop"])));
     }
     //recordTarget/patientRole/id
     $extrinsic->setSlot("sourcePatientId", array($patient_id));
     //recordtarget/patientRole
     $extrinsic->setSlot("sourcePatientInfo", $this->getSourcepatientInfo($factory->patient));
     //title
     $extrinsic->setTitle($factory->nom);
     //Auteur du document
     $document = new CXDSDocumentEntryAuthor("cla{$cla_id}", $id);
     $this->setClaId();
     //author/assignedAuthor
     $author = $this->getPerson($praticien);
     $document->setAuthorPerson(array($author));
     //author/assignedAuthor/code
     $spec = $praticien->loadRefOtherSpec();
     if ($spec->libelle) {
         $document->setAuthorSpecialty(array("{$spec->code}^{$spec->libelle}^{$spec->oid}"));
     }
     //author/assignedAuthor/representedOrganization - si absent, ne pas renseigner
     //si nom pas présent - champ vide
     //si id nullflavor alors 6-7-10 vide
     $author_organization = $praticien->loadRefFunction()->loadRefGroup();
     if ($author_organization->_id) {
         $institution = CXDSTools::getXONetablissement($author_organization->text, CXDSTools::getIdEtablissement(false, $author_organization));
         $document->setAuthorInstitution(array($institution));
     }
     $extrinsic->appendDocumentEntryAuthor($document);
     //confidentialityCode
     $confidentialite = $factory->confidentialite;
     $confid = new CXDSConfidentiality("cla{$cla_id}", $id, $confidentialite["code"]);
     $confid->setCodingScheme(array($confidentialite["codeSystem"]));
     $confid->setName($confidentialite["displayName"]);
     $extrinsic->appendConfidentiality($confid);
     if ($hide_ps) {
         $confid2 = CXDSConfidentiality::getMasquagePS("cla{$cla_id}", $id);
         $this->setClaId();
         $extrinsic->appendConfidentiality($confid2);
     }
     if ($hide_patient) {
         $confid3 = CXDSConfidentiality::getMasquagePatient("cla{$cla_id}", $id);
         $this->setClaId();
         $extrinsic->appendConfidentiality($confid3);
     }
     //documentationOf/serviceEvent/code - table de correspondance
     if (!$service["nullflavor"]) {
         $eventSystem = $service["oid"];
         $eventCode = $service["code"];
         switch ($service["type_code"]) {
             case "cim10":
                 $cim10 = CCodeCIM10::get($eventCode);
                 $libelle = $cim10->libelle;
                 break;
             case "ccam":
                 $ccam = CDatedCodeCCAM::get($eventCode);
                 $libelle = $ccam->libelleCourt;
                 break;
             default:
         }
         $event = new CXDSEventCodeList("cla{$cla_id}", $id, $eventCode);
         $this->setClaId();
         $event->setCodingScheme(array($eventSystem));
         $event->setName($libelle);
         $extrinsic->appendEventCodeList($event);
     }
     //En fonction d'un corps structuré
     $type = $factory->mediaType;
     $codingScheme = "";
     $name = "";
     $formatCode = "";
     if ($type) {
         $entry = CXDSTools::loadEntryDocument("Document_non_structure.xml", $type);
         $codingScheme = $entry["codingScheme"];
         $name = $entry["contenu"];
         $formatCode = $entry["formatCode"];
     } else {
         $correspondance = new DOMDocument();
         $correspondance->load("modules/xds/resources/Document_structure.xml");
         $correspondanceXpath = new CMbXPath($correspondance);
         $type = $factory->templateId;
         foreach ($type as $_type) {
             $type_id = $correspondanceXpath->queryAttributNode(".", $_type, "root");
             $node = $correspondanceXpath->queryUniqueNode("/mappage/line[@id='{$type_id}']");
             if (!$node) {
                 continue;
             }
             $codingScheme = $correspondanceXpath->queryAttributNode("./xds", $node, "codingScheme");
             $name = $correspondanceXpath->queryAttributNode("./mediaType", $node, "contenu");
             $formatCode = $correspondanceXpath->queryAttributNode("./xds", $node, "formatCode");
         }
         if (!$codingScheme) {
             $node = $correspondanceXpath->queryUniqueNode("/mappage/line[@id='*']");
             $codingScheme = $correspondanceXpath->queryAttributNode("./xds", $node, "codingScheme");
             $name = $correspondanceXpath->queryAttributNode("./mediaType", $node, "contenu");
             $formatCode = $correspondanceXpath->queryAttributNode("./xds", $node, "formatCode");
         }
     }
     $format = new CXDSFormat("cla{$cla_id}", $id, $formatCode);
     $this->setClaId();
     $format->setCodingScheme(array($codingScheme));
     $format->setName($name);
     $extrinsic->setFormat($format);
     //componentOf/encompassingEncounter/location/healthCareFacility/code
     $healtcare = $factory->healt_care;
     $healt = new CXDSHealthcareFacilityType("cla{$cla_id}", $id, $healtcare["code"]);
     $this->setClaId();
     $healt->setCodingScheme(array($healtcare["codeSystem"]));
     $healt->setName($healtcare["displayName"]);
     $extrinsic->setHealthcareFacilityType($healt);
     $this->health_care_facility = $this->health_care_facility ? $this->health_care_facility : $healtcare;
     //documentationOf/serviceEvent/performer/assignedEntity/representedOrganization/standardIndustryClassCode
     $pratice = new CXDSPracticeSetting("cla{$cla_id}", $id, $industry["code"]);
     $this->setClaId();
     $pratice->setCodingScheme(array($industry["codeSystem"]));
     $pratice->setName($industry["displayName"]);
     $this->practice_setting = $this->practice_setting ? $this->practice_setting : $industry;
     $extrinsic->setPracticeSetting($pratice);
     //code
     $code = $factory->code;
     $type = new CXDSType("cla{$cla_id}", $id, $code["code"]);
     $this->setClaId();
     $type->setCodingScheme(array($code["codeSystem"]));
     $type->setName($code["displayName"]);
     $extrinsic->setType($type);
     //code - table de correspondance X04
     list($classCode, $oid, $name) = $this->getClassCodeFromCode($code["code"]);
     $classification = new CXDSClass("cla{$cla_id}", $id, $classCode);
     $this->setClaId();
     $classification->setCodingScheme(array($oid));
     $classification->setName($name);
     $extrinsic->setClass($classification);
     //recordTarget/patientRole/id
     $extrinsic->setPatientId("ei{$ei_id}", $id, $ins);
     $this->setEiId();
     //id - root
     $root = $factory->id_cda;
     $this->oid["extrinsic"] = $root;
     $extrinsic->setUniqueId("ei{$ei_id}", $id, $root);
     $this->setEiId();
     return $extrinsic;
 }