/** * Fill the order * * @param int $user_id User id * @param string $class Favori class name (CFavoriCCAM or CFavoriCIM10) * @param bool $ref_favori boolean * @param int $tag_id Tag id * * @return array The list ordered */ static function getOrdered($user_id = 0, $class = null, $ref_favori = false, $tag_id = null) { $listOrdered = array(); if ($user_id) { $where["favoris_user"] = "******"; if ($class) { $where["object_class"] = "= '{$class}'"; } $ljoin = array(); if ($tag_id) { $ljoin["tag_item"] = "tag_item.object_id = favoris_id AND tag_item.object_class = 'CFavoriCCAM'"; $where["tag_item.tag_id"] = "= '{$tag_id}'"; } $fav = new CFavoriCCAM(); /** @var CFavoriCCAM[] $favoris */ $favoris = $fav->loadList($where, "favoris_code", null, null, $ljoin); foreach ($favoris as $_favori) { /** @var CDatedCodeCCAM $code */ $code = CDatedCodeCCAM::get($_favori->favoris_code); $code->getChaps(); $code->class = $_favori->object_class; $code->favoris_id = $_favori->favoris_id; $code->occ = 0; if ($ref_favori) { $_favori->loadRefsTagItems(); $code->_ref_favori = $_favori; } $chapitre =& $code->chapitres[0]; $listOrdered[$chapitre["code"]]["nom"] = $chapitre["nom"]; $listOrdered[$chapitre["code"]]["codes"][$_favori->favoris_code] = $code; } } return $listOrdered; }
$code->occ = "0"; $list[$value["favoris_code"]] = $code; } } sort($list); } /** * Statistiques */ if ($mode == "stats") { // Appel de la fonction listant les codes les plus utilisés pour un praticien $actes = new CActeCCAM(); $codes = $actes->getFavoris($_user_id, $object_class); foreach ($codes as $key => $value) { // Attention à bien cloner le code CCAM car on rajoute une champ à la volée $code = CDatedCodeCCAM::get($value["code_acte"]); if (CAppUI::pref('actes_comp_supp_favoris', 0) || !CAppUI::pref('actes_comp_supp_favoris', 0) && !in_array($code->chapitres[0]['db'], array('18.', '19.'))) { $code->occ = $value["nb_acte"]; $list[$value["code_acte"]] = $code; } } if ($order == "alpha") { sort($list); } } } if ($type == "cim10") { /** * Favoris */ if ($mode == "favoris") {
* @package Mediboard * @subpackage SalleOp * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $operation_id = CValue::getOrSession("operation_id", 0); $operation = new COperation(); $operation->load($operation_id); $operation->loadRefs(); $operation->countExchanges(); $operation->isCoded(); $operation->canDo(); $operation->_ref_sejour->loadRefsFwd(); foreach ($operation->_ext_codes_ccam as $key => $value) { $operation->_ext_codes_ccam[$key] = CDatedCodeCCAM::get($value->code); } $operation->getAssociationCodesActes(); $operation->loadPossibleActes(); $operation->_ref_plageop->loadRefsFwd(); $operation->loadRefPraticien(); if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) { // Chargement des règles de codage $operation->loadRefsCodagesCCAM(); foreach ($operation->_ref_codages_ccam as $_codages_by_prat) { foreach ($_codages_by_prat as $_codage) { $_codage->loadPraticien()->loadRefFunction(); $_codage->loadActesCCAM(); $_codage->getTarifTotal(); foreach ($_codage->_ref_actes_ccam as $_acte) { $_acte->getTarif();
* @package Mediboard * @subpackage SalleOp * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkEdit(); $object_id = CValue::get("object_id"); $object_class = CValue::get("object_class"); /** @var CCodable $object */ $object = new $object_class(); $object->load($object_id); $actes = explode("|", $object->codes_ccam); $object->loadRefsActesCCAM(); $activites = CMbArray::pluck($object->_ref_actes_ccam, "code_activite"); $activite_1 = array_search("1", $activites); $activite_4 = array_search("4", $activites); $completed_activite_1 = 1; $completed_activite_4 = 1; foreach ($actes as $_acte) { $acte = CDatedCodeCCAM::get($_acte); if (isset($acte->activites["1"]) && $activite_1 === false) { $completed_activite_1 = 0; } if (isset($acte->activites["4"]) && $activite_4 === false) { $completed_activite_4 = 0; break; } } $response = array("activite_1" => $completed_activite_1, "activite_4" => $completed_activite_4); echo json_encode($response);
/** * Charge le code CCAM complet tel que décrit par la nomenclature * * @return CDatedCodeCCAM */ function loadRefCodeCCAM() { return $this->_ref_code_ccam = CDatedCodeCCAM::get($this->code_acte, $this->execution); }
<?php /** * $Id$ * * @package Mediboard * @subpackage ccam * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkRead(); $codeacte = CValue::getOrSession("_codes_ccam"); $object_class = CValue::get("object_class", "COperation"); $hideSelect = CValue::get("hideSelect", 0); $code = CDatedCodeCCAM::get($codeacte); // Variable permettant de savoir si l'affichage du code complet est necessaire $codeComplet = false; $codeacte = $code->code; if ($code->_activite != "") { $codeComplet = true; $codeacte .= "-{$code->_activite}"; if ($code->_phase != "") { $codeacte .= "-{$code->_phase}"; } } $codeacte = strtoupper($codeacte); $favoris = new CFavoriCCAM(); // Création du template $smarty = new CSmartyDP(); $smarty->assign("code", $code);
/** * Load the CCAM code object * * @return CDatedCodeCCAM */ function loadRefCodeCCAM() { return $this->_ref_code_ccam = CDatedCodeCCAM::get($this->code); }
function loadExtCodesCCAM() { $this->_ext_codes_ccam = array(); foreach ($this->_codes_ccam as $code) { $this->_ext_codes_ccam[] = CDatedCodeCCAM::get($code); } }
foreach ($code->_ref_code_ccam->_ref_infotarif as $_infotarif) { $_infotarif->date_effet = CDatedCodeCCAM::mapDateFrom($_infotarif->date_effet); } $codes[] = $code; } } else { if ($code && $date_demandee) { $query = "SELECT CODEACTE\r\n FROM p_phase_acte\r\n WHERE DATEEFFET >= '" . $date_version . "'\r\n AND CODEACTE = '" . $code . "'"; $query .= " ORDER BY CODEACTE LIMIT 0 , 1"; $ds = CSQLDataSource::get("ccamV2"); $total = $ds->countRows($query); $result = $ds->exec($query); $result = $ds->exec($query); $codes = array(); while ($row = $ds->fetchArray($result)) { $code = CDatedCodeCCAM::get($row["CODEACTE"]); $code->_ref_code_ccam->date_creation = CDatedCodeCCAM::mapDateFrom($code->_ref_code_ccam->date_creation); foreach ($code->_ref_code_ccam->_ref_infotarif as $_infotarif) { $_infotarif->date_effet = CDatedCodeCCAM::mapDateFrom($_infotarif->date_effet); } $codes[] = $code; } } } $smarty->assign("keywords_multiple", $keywords); $smarty->assign("codes", $codes); $smarty->assign("nbResultat", $total); $smarty->assign("page", $page); $smarty->assign("step", $step); $smarty->assign("date_demandee", $date_demandee); $smarty->display("inc_result_search_acte.tpl");
/** * Chargement des actes voisins */ function loadActesVoisins() { $query = "SELECT CODE\n FROM p_acte\n WHERE DATEFIN = '00000000' "; foreach ($this->chapitres as $_key => $_chapitre) { $chapitre_db = $_chapitre["db"]; switch ($_key) { case "0": $query .= " AND ARBORESCENCE1 = '{$chapitre_db}'"; break; case "1": $query .= " AND ARBORESCENCE2 = '{$chapitre_db}'"; break; case "2": $query .= " AND ARBORESCENCE3 = '{$chapitre_db}'"; break; case "3": $query .= " AND ARBORESCENCE4 = '{$chapitre_db}'"; break; default: } } $query .= " ORDER BY CODE LIMIT 0 , 100"; $acte_voisins = array(); $ds = CSQLDataSource::get("ccamV2"); $result = $ds->exec($query); while ($row = $ds->fetchArray($result)) { $acte_voisin = CDatedCodeCCAM::get($row["CODE"]); $acte_voisin->_ref_code_ccam->date_creation = preg_replace('/^(\\d{4})(\\d{2})(\\d{2})$/', '\\3/\\2/\\1', $acte_voisin->_ref_code_ccam->date_creation); $acte_voisins[] = $acte_voisin; } return $acte_voisins; }
// On filtre selon le chapitre 2 if ($chap2) { $query .= " AND ARBORESCENCE2 = '0000" . $listChap2[$chap2]["rang"] . "'"; } // On filtre selon le chapitre 1 if ($chap1) { $query .= " AND ARBORESCENCE1 = '0000" . $listChap1[$chap1]["rang"] . "'"; } } $query .= " ORDER BY CODE LIMIT 0 , 100"; //Codes correspondants à la requete $result = $ds->exec($query); $i = 0; $codes = array(); while ($row = $ds->fetchArray($result)) { $codes[$i] = CDatedCodeCCAM::get($row["CODE"]); $i++; } $numcodes = $i; // Création du template $smarty = new CSmartyDP(); $smarty->assign("object_class", $object_class); $smarty->assign("clefs", $clefs); $smarty->assign("selacces", $selacces); $smarty->assign("seltopo1", $seltopo1); $smarty->assign("seltopo2", $seltopo2); $smarty->assign("chap1", $chap1); $smarty->assign("chap2", $chap2); $smarty->assign("chap3", $chap3); $smarty->assign("chap4", $chap4); $smarty->assign("code", $code);
} else { $codes_keys = array_keys(array_merge($codes_stats, $codes_favoris)); } $where = "CODE " . $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, null, $where); } foreach ($codes as $value) { $val_code = $value["CODE"]; $code = CDatedCodeCCAM::get($val_code, $date); if ($code->code != "-") { $list[$val_code] = $code; $nb_acte = 0; if (isset($codes_stats[$val_code])) { $nb_acte = $codes_stats[$val_code]["nb_acte"]; } else { if (isset($codes_favoris[$val_code])) { $nb_acte = 0.5; } } $list[$val_code]->nb_acte = $nb_acte; } } if ($tag_id) { $sorter = CMbArray::pluck($list, "code");
* @version $Revision$ */ CCanDo::checkRead(); $code_ccam = CValue::get("code_ccam"); $date_version = CValue::get("date_version"); $date_demandee = CValue::get("date_demandee"); $date_version_to = null; if ($date_demandee) { $date_version_to = CDatedCodeCCAM::mapDateToDash($date_demandee); } if ($date_version) { $date_version_to = CDatedCodeCCAM::mapDateToSlash($date_version); } $date_demandee = CDatedCodeCCAM::mapDateFrom($date_version_to); $date_versions = array(); $code_complet = CDatedCodeCCAM::get($code_ccam, $date_version_to); foreach ($code_complet->_ref_code_ccam->_ref_infotarif as $_infotarif) { $date_versions[] = $code_complet->mapDateFrom($_infotarif->date_effet); } foreach ($code_complet->activites as $_activite) { $code_complet->_count_activite += count($_activite->assos); } $acte_voisins = $code_complet->loadActesVoisins(); $smarty = new CSmartyDP(); if (!in_array($date_demandee, $date_versions) && $date_demandee) { $smarty->assign("no_date_found", "CDatedCodeCCAM-msg-No date found for date searched"); } $smarty->assign("code_complet", $code_complet); $smarty->assign("numberAssociations", $code_complet->_count_activite); $smarty->assign("date_versions", $date_versions); $smarty->assign("date_version", $date_version);
<?php /** * Autocomplete d'un code ccam sur les codes associés * * @category Ccam * @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(); $code = CValue::get("code"); $keywords = CValue::post("keywords"); $code_ccam = CDatedCodeCCAM::get($code); $code_ccam->getActesAsso($keywords, 30); $codes = array(); foreach ($code_ccam->assos as $_code) { $_code_value = $_code['code']; $codes[$_code_value] = CDatedCodeCCAM::get($_code_value); } $smarty = new CSmartyDP(); $smarty->assign("codes", $codes); $smarty->assign("keywords", $keywords); $smarty->assign("nodebug", true); $smarty->display("httpreq_do_ccam_autocomplete.tpl");
<?php /** * dPccam * * @category Ccam * @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(); $keywords = CValue::request("_codes_ccam", "%%"); $date = CMbDT::date(null, CValue::request("date", CMbDT::date())); $codes = array(); $code = new CDatedCodeCCAM(); foreach ($code->findCodes($keywords, $keywords) as $_code) { $_code_value = $_code["CODE"]; $code = CDatedCodeCCAM::get($_code_value, $date); if ($code->code != "-") { $codes[$_code_value] = $code; } } // Création du template $smarty = new CSmartyDP(); $smarty->debugging = false; $smarty->assign("keywords", $keywords); $smarty->assign("codes", $codes); $smarty->assign("nodebug", true); $smarty->display("httpreq_do_ccam_autocomplete.tpl");
/** * Charge les codes CCAM en tant qu'objets externes * * @return void */ function loadExtCodesCCAM() { $this->_ext_codes_ccam = array(); $this->_ext_codes_ccam_princ = array(); $dateActe = CMbDT::format($this->_datetime, "%Y-%m-%d"); if ($this->_codes_ccam !== null) { foreach ($this->_codes_ccam as $code) { $code = CDatedCodeCCAM::get($code, $dateActe); /* On supprime l'activité 1 du code si celui fait partie de la liste */ if (in_array($code->code, self::$hidden_activity_1)) { unset($code->activites[1]); } $this->_ext_codes_ccam[] = $code; if ($code->type != 2) { $this->_ext_codes_ccam_princ[] = $code; } } CMbArray::ksortByProp($this->_ext_codes_ccam, "type", "_sorted_tarif"); } }
/** * @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; }