foreach ($codes as $key => $value) { $list[$value["favoris_code"]] = CCodeCIM10::get($value["favoris_code"]); $list[$value["favoris_code"]]->occ = "0"; } } /** * Statistiques */ if ($mode == "stats") { // Chargement des codes cim les plus utilsé par le praticien $chir $code = new CCodeCIM10(); $sql = "SELECT DP, count(DP) as nb_code\r\n FROM `sejour`\r\n WHERE sejour.praticien_id = '{$_user_id}'\r\n AND DP IS NOT NULL\r\n AND DP != ''\r\n GROUP BY DP\r\n ORDER BY count(DP) DESC\r\n LIMIT 50;"; $listCodes = $ds->loadList($sql); $list = array(); foreach ($listCodes as $key => $value) { $list[$value["DP"]] = CCodeCIM10::get($value["DP"]); $list[$value["DP"]]->occ = $value["nb_code"]; } } } $listByProfile[$profile] = $list; } // Création du template $smarty = new CSmartyDP(); $smarty->assign("type", $type); $smarty->assign("mode", $mode); $smarty->assign("order", $order); $smarty->assign("object_class", $object_class); $smarty->assign("chir", $chir); $smarty->assign("anesth", $anesth); $smarty->assign("users", $users);
/** * @see parent::store() */ function store() { $this->completeField("codes_cim"); $this->_codes_cim = $this->codes_cim ? explode("|", $this->codes_cim) : array(); if ($this->_added_code_cim) { $da = CCodeCIM10::get($this->_added_code_cim); if (!$da->exist) { CAppUI::setMsg("Le code CIM saisi n'est pas valide", UI_MSG_WARNING); return null; } $this->_codes_cim[] = $this->_added_code_cim; } if ($this->_deleted_code_cim) { CMbArray::removeValue($this->_deleted_code_cim, $this->_codes_cim); } $this->codes_cim = implode("|", array_unique($this->_codes_cim)); $this->completeField("object_id", "object_class"); if ($this->object_class == "CPatient" && $this->fieldModified("codes_cim")) { DSHM::remKeys("alertes-*-CPatient-" . $this->object_id); } return parent::store(); }
function getSubCodes($code) { $codeCim = CCodeCIM10::get($code, self::FULL); $master = array(); $i = 0; foreach ($codeCim->_levelsInf as $curr_code) { $master[$i]["text"] = $curr_code->libelle; $master[$i]["code"] = $curr_code->code; $i++; } return $master; }
} // Extraction des codes supplémentaires de l'ATIH $targetDir = "tmp/cim10"; $sourcePath = "modules/dPcim10/base/cim_atih.tar.gz"; $targetPath = "tmp/cim10/cim_atih.csv"; if (null == ($nbFiles = CMbPath::extract($sourcePath, $targetDir))) { CAppUI::stepAjax("Erreur, impossible d'extraire l'archive CIM_ATIH.csv", UI_MSG_ERROR); } CAppUI::stepAjax("Extraction de {$nbFiles} fichier(s) [CIM10 ATIH]", UI_MSG_OK); // Vérification des différences entre la norme internationale et les ajouts de l'ATIH $list_diff = array(); $fp = fopen($targetPath, 'r'); while ($line = fgetcsv($fp, null, '|')) { // Remove dots, replace + by X $line[0] = str_replace(array('.', '+'), array('', 'X'), trim($line[0])); $cim = CCodeCIM10::get($line[0]); if (!$cim->exist) { $list_diff[] = $line; } } fclose($fp); if (count($list_diff)) { CAppUI::stepAjax("Il existe " . count($list_diff) . " codes supplémentaires dans la CIM v.11", UI_MSG_WARNING); } else { CAppUI::stepAjax("Il n'y a pas de code supplémentaires dans la CIM v.11", UI_MSG_OK); } foreach ($list_diff as $diff) { $abbrev = $diff[0]; $full_code = CCodeCIM10::addPoint($abbrev); // Insertion des nouveaux codes $query = "INSERT into master (`code`, `abbrev`, `level`, `type`, `valid`, `author`) VALUES (\r\n '" . $full_code . "','" . $abbrev . "','" . strlen($full_code) . "','S','1','atih')";
<?php /** * dPcim10 * * @category Cim10 * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id$ * @link http://www.mediboard.org */ CCanDo::checkEdit(); $code = CValue::get("code"); $cim10 = CCodeCIM10::get($code, CCodeCIM10::FULL); foreach ($cim10->_exclude as $key => $value) { $cim10->_exclude[$key]->loadRefs(); } foreach ($cim10->_levelsInf as $key => $value) { $cim10->_levelsInf[$key]->loadRefs(); } $up = null; $i = count($cim10->_levelsSup); $i--; if ($i >= 0) { $up =& $cim10->_levelsSup[$i]; } // Création du template $smarty = new CSmartyDP(); $smarty->assign('up', $up); $smarty->assign('cim10', $cim10);
$_favori->loadRefsTagItems(); $code = CCodeCIM10::get($favoris_code); $code->_favoris_id = $_favori->favoris_id; $code->_ref_favori = $_favori; $code->occ = "0"; $codes[$favoris_code] = $code; } // Chargement des favoris calculés, si pas de choix de tag $listCimStat = array(); if (!$tag_id) { $ds = CSQLDataSource::get("std"); $sql = "SELECT DP, count(DP) as nb_code\r\n FROM `sejour`\r\n WHERE sejour.praticien_id = '{$user->_id}'\r\n AND DP IS NOT NULL\r\n AND DP != ''\r\n GROUP BY DP\r\n ORDER BY count(DP) DESC\r\n LIMIT 10;"; $cimStat = $ds->loadlist($sql); foreach ($cimStat as $value) { $DP = $value["DP"]; $code = CCodeCIM10::get($DP); $code->_favoris_id = "0"; $code->occ = $value["nb_code"]; $listCimStat[$DP] = $code; } } // Fusion des deux tableaux de favoris $fusionCim = $listCimStat; foreach ($codes as $keycode => $code) { if (!array_key_exists($keycode, $fusionCim)) { $fusionCim[$keycode] = $code; continue; } } $tag_tree = CFavoriCIM10::getTree($user->_id); // Création du template
$where = null; if (!$_all_codes && (count($codes_stats) || count($codes_favoris))) { $codes_keys = array_keys(array_merge($codes_stats, $codes_favoris)); $where = "master.abbrev " . $ds->prepareIn($codes_keys); } if (!$_all_codes && count($codes_stats) == 0 && count($codes_favoris) == 0) { // Si pas de stat et pas de favoris, et que la recherche se fait sur ceux-ci, // alors le tableau de résultat est vide $codes = array(); } else { // Sinon recherche de codes $codes = $code->findCodes($_keywords_code, $_keywords_code, CCodeCIM10::LANG_FR, null, $where); } foreach ($codes as $value) { $val_code = $value["code"]; $code_cim10 = CCodeCIM10::get($val_code); $list[$val_code] = $code_cim10; $nb_code = 0; if (isset($codes_stats[$val_code])) { $nb_code = $codes_stats[$val_code]->occ; } elseif (isset($codes_favoris[$val_code])) { $nb_code = 0.5; } $list[$val_code]->nb_acte = $nb_code; } $sorter = CMbArray::pluck($list, "nb_acte"); array_multisort($sorter, SORT_DESC, $list); $listByProfile[$profile]["favoris"] = $codes_favoris; $listByProfile[$profile]["stats"] = $codes_stats; $listByProfile[$profile]["list"] = $list; }
<?php /** * dPcim10 * * @category Cim10 * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id$ * @link http://www.mediboard.org */ CCanDo::checkRead(); $lang = CValue::getOrSession("lang", CCodeCIM10::LANG_FR); $code = CValue::getOrSession("code", "(A00-B99)"); $cim10 = CCodeCIM10::get($code, CCodeCIM10::FULL, $lang); // Création du template $smarty = new CSmartyDP(); $smarty->assign("lang", $lang); $smarty->assign("cim10", $cim10); $smarty->display("vw_full_code.tpl");
/** * Vérifie et extrait les codes CIM des remarques pour les sauvegarder dans le dossier médical * * @return void */ function checkCodeCim10() { preg_match_all('/\\b[A-Z]\\d{2}\\.?\\d{0,2}\\b/i', $this->rques, $matches); foreach ($matches as $match_) { foreach ($match_ as &$match) { // Transformation du code CIM pour le tester $match = str_replace(".", "", $match); $match = strtoupper($match); // Chargement du code CIM 10 $code_cim10 = CCodeCIM10::get($match); if ($code_cim10->libelle != "Code CIM inexistant") { // Cas du code valide, sauvegarde du code CIM $dossier_medical = new CDossierMedical(); $dossier_medical->load($this->dossier_medical_id); // si le code n'est pas deja present, on le rajoute if (!array_key_exists($match, $dossier_medical->_ext_codes_cim)) { if ($dossier_medical->codes_cim != "") { $dossier_medical->codes_cim .= "|"; } $dossier_medical->codes_cim .= $match; $dossier_medical->store(); } } } } }
/** * Charge les diagnostics CIM associés * * @param bool $split Notation française avec le point séparateur après trois caractères * @param bool $load Chargement du code cim associé si split est false * * @return string[] Codes CIM */ function loadDiagnosticsAssocies($split = true, $load = false) { $this->_diagnostics_associes = array(); $this->loadRefDossierMedical(); if ($this->_ref_dossier_medical->_id) { foreach ($this->_ref_dossier_medical->_codes_cim as $code) { if ($split && strlen($code) >= 4) { $this->_diagnostics_associes[] = substr($code, 0, 3) . "." . substr($code, 3); } else { if ($load) { $this->_diagnostics_associes[] = CCodeCIM10::get($code); } else { $this->_diagnostics_associes[] = $code; } } } } return $this->_diagnostics_associes; }
function loadExtCodeCIM() { $this->_ext_code_cim = CCodeCIM10::get($this->DP); }
/** * @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; }