/**
  * Method to load the target object of thesaurus target
  *
  * @return CActeNGAP|CCodeCCAM|CCodeCIM10
  */
 function loadRefTarget()
 {
     if ($this->object_class && $this->object_id) {
         switch ($this->object_class) {
             case "CCodeCIM10":
                 $object = new CCodeCIM10();
                 $object->code = $this->object_id;
                 $object->loadLite();
                 $this->_ref_target = $object;
                 break;
             case "CCodeCCAM":
                 $object = new CCodeCCAM($this->object_id);
                 $object->load();
                 $this->_ref_target = $object;
                 break;
             case "CActeNGAP":
                 $object = new CActeNGAP();
                 $object->code = $this->object_id;
                 $object->loadMatchingObject();
                 $this->_ref_target = $object;
                 break;
             case "CMedicamentClasseATC":
                 $object = new CMedicamentClasseATC();
                 $niveau = $object->getNiveau($this->object_id);
                 $object->loadClasseATC($niveau, $this->object_id);
                 $this->_ref_target = $object;
                 break;
             default:
                 // nothing to do
                 break;
         }
     }
     return $this->_ref_target;
 }
            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);
Esempio n. 3
0
 */
CCanDo::checkRead();
$lang = CValue::getOrSession("lang", CCodeCIM10::LANG_FR);
$code = CValue::getOrSession("code", "");
$keys = CValue::getOrSession("keys", "");
$level1 = CValue::getOrSession("level1", "");
$level2 = CValue::getOrSession("level2", "");
if (CValue::session("code") || CValue::session("keys")) {
    $level1 = "";
    CValue::setSession("level1");
}
if (!$level1) {
    $level2 = "";
    CValue::setSession("level2");
}
$cim10 = new CCodeCIM10();
$listLevel1 = $cim10->getSommaire($lang);
$listLevel2 = array();
$master = array();
$keys = trim($keys);
$code = trim($code);
if ($code || $keys) {
    $master = $cim10->findCodes($code, $keys, $lang);
} elseif ($level2) {
    $listLevel2 = $cim10->getSubCodes($level1, $lang);
    $master = $cim10->getSubCodes($level2, $lang);
} elseif ($level1) {
    $listLevel2 = $cim10->getSubCodes($level1, $lang);
    $master = $listLevel2;
}
$numresults = count($master);
<?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);
$cim10 = new CCodeCIM10();
$chapter = $cim10->getSommaire($lang);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("lang", $lang);
$smarty->assign("cim10", $cim10);
$smarty->assign("chapter", $chapter);
$smarty->display("vw_idx_chapter.tpl");
 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;
 }
 /**
  * @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();
 }
Esempio n. 7
0
<?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);
    // 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')";
    $ds->exec($query);
    // On récupère la clé primaire du code ajouté
    $query = "SELECT * FROM master WHERE 1 ORDER BY SID DESC LIMIT 1";
    $result = $ds->exec($query);
    $row = $ds->fetchArray($result);
    $SID = $row['SID'];
    // On ajoute les niveaux supérieurs
    $prev_SID = 0;
    $offset = 0;
    for ($i = 1; $i <= 7; $i++) {
        if ($i <= 2) {
            $query = "SELECT * FROM master WHERE abbrev LIKE('%" . substr($abbrev, 0, $i) . "%') ORDER BY code ASC LIMIT 1";
        } else {
 $code = new CFavoriCIM10();
 $where = array();
 $where["favoris_user"] = "******";
 $ljoin = array();
 if ($tag_id) {
     $where["tag_item.tag_id"] = "= '{$tag_id}'";
     $ljoin["tag_item"] = "tag_item.object_id = cim10favoris.favoris_id AND tag_item.object_class = 'CFavoriCIM10'";
 }
 /** @var CFavoriCIM10[] $codes_favoris */
 $codes_favoris = $code->loadList($where, null, 100, 'favoris_code', $ljoin);
 foreach ($codes_favoris as $key => $_code) {
     $codes_favoris[$_code->favoris_code] = $_code;
     unset($codes_favoris[$key]);
 }
 // Seek sur les codes, avec ou non l'inclusion de tous les codes
 $code = new CCodeCIM10();
 $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"];
Esempio n. 10
0
    $_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
Esempio n. 11
0
<?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();
                 }
             }
         }
     }
 }
Esempio n. 13
0
 /**
  * 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);
 }
<?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
 */
$keywords = CValue::post("keywords_code");
if ($keywords == '') {
    $keywords = '%%';
}
$code = new CCodeCIM10();
$codes = $code->findCodes($keywords, $keywords, CCodeCIM10::LANG_FR, 6);
$smarty = new CSmartyDP();
$smarty->assign("codes", $codes);
$smarty->assign("nodebug", true);
$smarty->assign("keywords", $keywords);
$smarty->assign("sejour_id", CValue::get("sejour_id"));
$smarty->display("inc_code_cim10_autocomplete.tpl");
Esempio n. 16
0
 /**
  * @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;
 }