/** * Get an HTML representation of the symbol char * * @return string The HTML symbol char */ function getSymbolChar() { $this->completeField("symbol", "show_points", "display"); if (!$this->show_points && $this->display != "points") { return null; } return CMbArray::get(self::$_symbol_chars, $this->symbol); }
/** * Retourne le nom de la classe * * @return mixed|string */ function getNameClass() { $name = get_class($this); $name = substr($name, 4); if (get_class($this) === "CCDA_base_cs") { $name = CMbArray::get(explode("_", $name), 1); } return $name; }
/** * Returns a spec object for an object's field from a class name * * @param string $class The class name * @param string $field The field name * @param string $prop The prop string serializing the spec object options * * @throws Exception * @return CMbFieldSpec */ static function getSpecWithClassName($class, $field, $prop) { $spec_class = "CMbFieldSpec"; // Get Spec type $first_space = strpos($prop, " "); $spec_type = $first_space === false ? $prop : substr($prop, 0, $first_space); // Get spec class if ($spec_type && null == ($spec_class = CMbArray::get(self::$classes, $spec_type))) { throw new Exception("Invalid spec '{$prop}' for field '{$class}::{$field}'"); } return new $spec_class($class, $field, $prop); }
/** * Build event * * @param CMbObject $object Object * * @see parent::build() * * @return void */ function build($object) { // Traitement sur le mbObject $this->object = $object; $this->last_log = $object->loadLastLog(); // Récupération de la version HL7 en fonction du receiver et de la transaction $this->version = CAppUI::conf("hl7 default_version"); if ($version = CMbArray::get($this->_receiver->_configs, $this->transaction . "_HL7_version")) { $this->version = $version; } // Génération de l'échange $this->generateExchange(); $terminator = $this->getSegmentTerminator($this->_receiver->_configs["ER7_segment_terminator"]); // Création du message HL7 $message = new CHL7v2Message($this->version); $message->segmentTerminator = $terminator; $message->name = $this->msg_codes; $this->message = $message; }
/** * @see parent::build */ function build(CHPrimSanteEvent $event) { parent::build($event); $patient = $this->patient; $sejour = $this->sejour; $actor = isset($event->_sender->_id) ? $event->_sender : $event->_receiver; $group = $actor->loadRefGroup(); $patient->loadIPP($group->_id); // P-1: type segment - P(par défaut) (ST) // P-2: rang segment - (NM) $data[] = "1"; // P-3: Patient ID (SPEC) (optional) $data[] = array(array($patient->_IPP, $patient->_patient_elimine ? $patient->_patient_elimine->_IPP : null, $patient->_patient_elimine ? "FU" : null)); // P-4: Patient ID (ST) (optional) $data[] = null; // P-5: sejour ID (ST) (optional) $data[] = null; // P-6: Nom patient (PN) (optional) $data[] = array(array($patient->_p_last_name, $patient->_p_first_name, $patient->prenom_2, $patient->civilite)); // P-7: Nom de naissance (ST) (optional) $data[] = $patient->_p_maiden_name; // P-8: Date de naissance (TS) (optional) $data[] = $patient->_p_birth_date; // P-9: Sexe (ID) (optional) $data[] = CMbString::upper($patient->sexe); // P-10: race (forbidden) $data[] = null; $address = explode("\n", $patient->_p_street_address, 1); // P-11: adresse (AD) (optional) $data[] = array(array(CMbArray::get($address, 0), str_replace("\n", " ", CMbArray::get($address, 1)), $patient->_p_city, null, $patient->_p_postal_code, $patient->pays_insee)); // P-12: INS (version 2.3) (optional) $data[] = null; // P-13: téléphone (TN) (optional) (repeatable) $data[] = array($patient->_p_phone_number, $patient->_p_mobile_phone_number); // P-14: Médecins (CNA) (optional) (repeatable) $data[] = null; // P-15: Traitement local 1 (ST) (optional) $data[] = null; // P-16: Traitement local 2 (ST) (optional) $data[] = null; // P-17: Taille (CQ) (optional) $data[] = null; // P-18: Poids (CQ) (optional) $data[] = null; // P-19: Diagnostic (CE) (optional) (repeatable) $data[] = null; // P-20: Traitement (ST) (optional) (repeatable) $data[] = null; // P-21: Régime (ST) (optional) $data[] = null; // P-22: Commentaire 1 (ST) (optional) $data[] = null; // P-23: Commentaire 2 (ST) (optional) $data[] = null; // P-24: Date de mouvement (TS) (optional) (repeatable) $data[] = null; // P-25: Statut de l'admission (ID) (optional) $data[] = null; // P-26: Localisation (SPEC) (optional) $data[] = null; // P-27: classification diagnostic (CE) (optional) $data[] = null; // P-28: Religion (forbidden) $data[] = null; // P-29: Situation maritale (ID) (optional) $data[] = $this->getMaritalStatus($patient->situation_famille); // P-30: Précauton à prendre (ID) (optional) $data[] = null; // P-31: Langue (ST) (optional) $data[] = null; // P-32: Statut de confidentialité (ID) (optional) $data[] = null; // P-33: Date de dernière modification (TS) (optional) $data[] = null; // P-34: Date de décès (TS) (optional) $data[] = null; $this->fill($data); }
if ($filter->_other_function_id) { // Other (consultations) $query = "CREATE TEMPORARY TABLE consultation_other\n SELECT \n consultation_prime.praticien_id, \n consultation_prime.patient_id,\n consultation_prime.consultation_id AS consult1_id, \n consult_date AS consult1_date, \n consultation.consultation_id AS consult2_id, \n plageconsult.date AS consult2_date\n FROM consultation_prime\n LEFT JOIN consultation ON consultation.patient_id = consultation_prime.patient_id \n LEFT JOIN plageconsult ON plageconsult.plageconsult_id = consultation.plageconsult_id\n LEFT JOIN users_mediboard ON users_mediboard.user_id = plageconsult.chir_id\n WHERE users_mediboard.function_id = '{$filter->_other_function_id}'\n AND plageconsult.date BETWEEN '{$filter->_date_min}' AND '{$filter->_date_max}'\n GROUP BY consult1_id;"; $ds->exec($query); // Other (consultations) counts $query = "SELECT praticien_id, COUNT(*)\n FROM consultation_other\n GROUP BY praticien_id;"; $others_counts = $ds->loadHashList($query); } else { $others_counts = array(); } } // Praticiens $praticiens = $mediuser->loadPraticiens(PERM_READ, $filter->_function_id); // Stats by praticiens $stats = array(); foreach ($praticiens as $prat_id => $_praticien) { if (!isset($consultations_counts[$_praticien->_id]) && !isset($sejours_counts[$_praticien->_id]) && !isset($patients_counts[$_praticien->_id]) && !isset($others_counts[$_praticien->_id])) { unset($praticiens[$prat_id]); continue; } // Counts $counts = array("consultations" => CMbArray::get($consultations_counts, $_praticien->_id), "sejours" => CMbArray::get($sejours_counts, $_praticien->_id), "patients" => CMbArray::get($patients_counts, $_praticien->_id), "others" => CMbArray::get($others_counts, $_praticien->_id)); // Percents $percents = array("consultations" => $counts["consultations"] ? 1 : null, "sejours" => $counts["consultations"] ? $counts["sejours"] / $counts["consultations"] : null, "patients" => $counts["consultations"] ? $counts["patients"] / $counts["consultations"] : null, "others" => $counts["consultations"] ? $counts["others"] / $counts["consultations"] : null); $stats[$_praticien->_id] = array("counts" => $counts, "percents" => $percents); } $smarty = new CSmartyDP(); $smarty->assign("filter", $filter); $smarty->assign("praticiens", $praticiens); $smarty->assign("stats", $stats); $smarty->display("inc_stats_nb_consults.tpl");
/** * Récupération du segment GT1 * * @param DOMNode $node Node * @param CSejour $newVenue Admit * * @return void */ function getGT1(DOMNode $node, CSejour $newVenue) { if (!$newVenue->_id) { return; } $patient = $newVenue->_ref_patient; if (!$patient->_id) { return; } $GT1_2 = $this->queryTextNode("GT1.2/CX.1", $node); $GT1_3 = $this->queryNode("GT1.3", $node); $nom = $this->queryTextNode("XPN.1/FN.1", $GT1_3); $prenom = $this->queryTextNode("XPN.2", $GT1_3); if ($prenom == "") { $prenom = null; } $GT1_5 = $this->queryNode("GT1.5", $node); $adresse = $this->queryTextNode("XAD.1/SAD.1", $GT1_5); $ville = $this->queryTextNode("XAD.3", $GT1_5); $cp = $this->queryTextNode("XAD.5", $GT1_5); $GT1_6 = $this->queryNodes("GT1.6", $node); $tel = null; $ean = null; $ean_base = null; foreach ($GT1_6 as $_GT1_6) { if (!$tel) { $tel = $this->queryTextNode("XTN.12", $_GT1_6); } if (!$tel) { $tel = $this->queryTextNode("XTN.1", $_GT1_6); } $XTN_4 = $this->queryTextNode("XTN.4", $_GT1_6); // EAN base => Ean Dest if (preg_match('/^Ean Dest=(\\d+)$/', $XTN_4, $matches) === 1) { $ean_base = CMbArray::get($matches, 1); } // EAN => Code Ean if (preg_match('/^Code Ean=(\\d+)$/', $XTN_4, $matches) === 1) { $ean = CMbArray::get($matches, 1); } } $GT1_13 = $this->queryTextNode("GT1.13", $node); $GT1_14 = $this->queryTextNode("GT1.14", $node); $corres_patient = new CCorrespondantPatient(); $where = array(); $where["patient_id"] = " = '{$patient->_id}'"; if ($nom) { $where["nom"] = " = '{$nom}'"; } if ($prenom) { $where["prenom"] = " = '{$prenom}'"; } $where["relation"] = " = 'assurance'"; $now = CMbDT::date(); $next = CMbDT::date("+ 1 DAY"); $where["date_debut"] = " <= '{$now}' AND IFNULL(date_fin, '{$next}') >= '{$now}'"; $corres_patient->loadObject($where); if (!$corres_patient->_id) { $corres_patient->patient_id = $patient->_id; $corres_patient->nom = $nom; $corres_patient->relation = "assurance"; } $corres_patient->prenom = $prenom; $corres_patient->adresse = $adresse; $corres_patient->cp = $cp; $corres_patient->ville = $ville; $corres_patient->tel = $tel; $corres_patient->ean = $ean; $corres_patient->ean_base = $ean_base; if ($ean) { $where = array("patient_id" => "IS NULL", "relation" => "= 'assurance'", "ean" => "= '{$ean}'"); $assurance = new CCorrespondantPatient(); $assurance->loadObject($where); $corres_patient->type_pec = $assurance->type_pec; } if ($GT1_13) { $corres_patient->date_debut = CMbDT::date($GT1_13); } if ($GT1_14) { $corres_patient->date_fin = CMbDT::date($GT1_14); } $sender = $this->_ref_sender; // Notifier les autres destinataires autre que le sender $corres_patient->_eai_sender_guid = $sender->_guid; if ($msg = $corres_patient->store()) { $corres_patient->repair(); $corres_patient->_eai_sender_guid = $sender->_guid; $corres_patient->store(); } }
/** * Récupération de l'assuré * * @param DOMNode $node Node * @param CPatient $mbPatient Patient * * @return CPatient */ static function getAssure(DOMNode $node, CPatient $mbPatient) { $xpath = new CHPrimXPath($node->ownerDocument); $immatriculation = $xpath->queryTextNode("hprim:immatriculation", $node); $mbPatient->matricule = $immatriculation; $mbPatient->assure_matricule = $immatriculation; $personne = $xpath->queryUniqueNode("hprim:personne", $node); if (!$personne) { return $mbPatient; } $sexe = $xpath->queryAttributNode("hprim:personne", $node, "sexe"); $sexeConversion = array("M" => "m", "F" => "f"); $mbPatient->assure_sexe = $sexeConversion[$sexe]; $mbPatient->assure_nom = $xpath->queryTextNode("hprim:nomUsuel", $personne); $prenoms = $xpath->getMultipleTextNodes("hprim:prenoms/*", $personne); $mbPatient->assure_prenom = CMbArray::get($prenoms, 0); $mbPatient->assure_prenom_2 = CMbArray::get($prenoms, 1); $mbPatient->assure_prenom_3 = CMbArray::get($prenoms, 2); $mbPatient->assure_naissance = $xpath->queryTextNode("hprim:naissance", $personne); $elementDateNaissance = $xpath->queryUniqueNode("hprim:dateNaissance", $personne); $mbPatient->assure_naissance = $xpath->queryTextNode("hprim:date", $elementDateNaissance); $mbPatient->rang_beneficiaire = $xpath->queryTextNode("hprim:lienAssure", $node); $mbPatient->qual_beneficiaire = CValue::read(CPatient::$rangToQualBenef, $mbPatient->rang_beneficiaire); return $mbPatient; }
/** * Recording NPA * * @param String $NPA NPA * @param CSejour $sejour Sejour * @param CInteropSender $sender Sender * * @return null|string */ static function storeNPA($NPA, CSejour $sejour, CInteropSender $sender) { if (!$NPA) { return null; } // L'expéditeur gère les NPA $manage_npa = CMbArray::get($sender->_configs, "manage_npa"); if (!$manage_npa) { return null; } //Récupération du tag pour les NPA $tag = CSejour::getTagNPA($sender->group_id); if (!$tag) { return null; } $idex_NPA = CIdSante400::getMatch("CSejour", $tag, null, $sejour->_id); $idex_NPA->object_id = $sejour->_id; $idex_NPA->last_update = CMbDT::dateTime(); $idex_NPA->_eai_sender_guid = $sender->_guid; $idex_NPA->id400 = $NPA; return $idex_NPA->store(); }
/** * Get the patient state * * @param DOMNode $node Node * @param CPatient $newPatient Patient * * @return void */ function getPatientState(DOMNode $node, CPatient $newPatient) { if ($states = $this->queryNodes("PID.32", $node)) { $list_state = array(); foreach ($states as $_state) { $list_state[] = $this->queryTextNode(".", $_state); } $state = CMbArray::extract($list_state, 0); if (!$state) { return; } if ($state == "CACH") { $newPatient->vip = true; $status = CMbArray::get($list_state, 1); if ($status) { $state = $status; } } else { if (in_array("CACH", $list_state)) { $newPatient->vip = true; } } $newPatient->_status_no_guess = true; $newPatient->status = $state; } }
/** * @see parent::getFormHtmlElement() */ function getFormHtmlElement($object, $params, $value, $className) { $field = CMbString::htmlSpecialChars($this->fieldName); $locales = $this->_locales; $typeEnum = CMbArray::extract($params, "typeEnum", $this->typeEnum ? $this->typeEnum : "checkbox"); $separator = CMbArray::extract($params, "separator", $this->vertical ? "<br />" : null); $cycle = CMbArray::extract($params, "cycle", 1); $alphabet = CMbArray::extract($params, "alphabet", false); $size = CMbArray::extract($params, "size", 0); $onchange = CMbArray::get($params, "onchange"); $form = CMbArray::extract($params, "form"); // needs to be extracted $readonly = CMbArray::extract($params, "readonly") == 1; $extra = CMbArray::makeXmlAttributes($params); $className = CMbString::htmlSpecialChars(trim("{$className} {$this->prop}")); if ($alphabet) { asort($locales); } $uid = uniqid(); $value_array = $this->getListValues($value); switch ($typeEnum) { case "select": if ($readonly) { $readonly = "readonly"; } $sHtml = "<script type=\"text/javascript\">\n Main.add(function(){\n var select = \$\$('select[data-select_set={$uid}]')[0],\n element = select.previous(),\n tokenField = new TokenField(element, {" . ($onchange ? "onChange: function(){ {$onchange} }.bind(element)" : "") . "});\n\n select.observe('change', function(event){\n tokenField.setValues(\$A(select.options).filter(function(o){return o.selected}).pluck('value'));\n\n element.fire('ui:change');\n });\n });\n </script>"; $sHtml .= "<input type=\"hidden\" name=\"{$field}\" value=\"{$value}\" class=\"{$className}\" {$extra} />\n"; $sHtml .= "<select class=\"{$className}\" multiple=\"multiple\" size=\"{$size}\" data-select_set=\"{$uid}\" {$extra} {$readonly}>"; foreach ($locales as $key => $item) { if (!empty($value_array) && in_array($key, $value_array)) { $selected = " selected=\"selected\""; } else { $selected = ""; } $sHtml .= "\n<option value=\"{$key}\" {$selected}>{$item}</option>"; } $sHtml .= "\n</select>"; break; default: case "checkbox": $sHtml = "<span id=\"set-container-{$uid}\">\n"; $sHtml .= "<input type=\"hidden\" name=\"{$field}\" value=\"{$value}\" class=\"{$className}\" {$extra} />\n"; $sHtml .= "<script type=\"text/javascript\">\n Main.add(function(){\n var cont = \$('set-container-{$uid}'),\n element = cont.down('input[type=hidden]'),\n tokenField = new TokenField(element, {" . ($onchange ? "onChange: function(){ {$onchange} }.bind(element)" : "") . "});\n\n cont.select('input[type=checkbox]').invoke('observe', 'click', function(event){\n var elt = Event.element(event);\n tokenField.toggle(elt.value, elt.checked);\n\n element.fire('ui:change');\n });\n });\n </script>"; $compteur = 0; if ($readonly) { $readonly = "disabled"; } foreach ($locales as $key => $item) { $selected = ""; if (!empty($value_array) && in_array($key, $value_array)) { $selected = " checked=\"checked\""; } $sHtml .= "\n<label>\n <input type=\"checkbox\" name=\"_{$field}_{$key}\" value=\"{$key}\" class=\"set-checkbox token{$uid}\" {$selected} {$readonly} />\n {$item}\n </label> "; $compteur++; $modulo = $compteur % $cycle; if ($separator != null && $modulo == 0 && $compteur < count($locales)) { $sHtml .= $separator; } } $sHtml .= "</span>\n"; } return $sHtml; }
/** * Return person * * @param DOMNode $node Node * @param CMbObject $mbPersonne Person * * @return CMbObject|CMediusers|CPatient */ static function getPersonne(DOMNode $node, CMbObject $mbPersonne) { $xpath = new CHPrimXPath($node->ownerDocument); $civilite = $xpath->queryAttributNode("hprim:civiliteHprim", $node, "valeur"); $civiliteHprimConversion = array("mme" => "mme", "mlle" => "mlle", "mr" => "m", "dr" => "dr", "pr" => "pr", "bb" => "enf", "enf" => "enf"); $nom = $xpath->queryTextNode("hprim:nomUsuel", $node); $prenoms = $xpath->getMultipleTextNodes("hprim:prenoms/*", $node); $adresses = $xpath->queryUniqueNode("hprim:adresses", $node); $adresse = $xpath->queryUniqueNode("hprim:adresse", $adresses); $ligne = $xpath->getMultipleTextNodes("hprim:ligne", $adresse, true); $ville = $xpath->queryTextNode("hprim:ville", $adresse); $cp = $xpath->queryTextNode("hprim:codePostal", $adresse); if ($cp) { $cp = preg_replace("/[^0-9]/", "", $cp); } $telephones = $xpath->getMultipleTextNodes("hprim:telephones/*", $node); $email = $xpath->getFirstTextNode("hprim:emails/*", $node); if ($mbPersonne instanceof CPatient) { if ($civilite) { $mbPersonne->civilite = $civiliteHprimConversion[$civilite]; } else { if ($mbPersonne->civilite == null) { $mbPersonne->civilite = "guess"; } } $mbPersonne->nom = $nom; $mbPersonne->nom_jeune_fille = $xpath->queryTextNode("hprim:nomNaissance", $node); $mbPersonne->prenom = CMbArray::get($prenoms, 0); $mbPersonne->prenom_2 = CMbArray::get($prenoms, 1); $mbPersonne->prenom_3 = CMbArray::get($prenoms, 2); $mbPersonne->adresse = $ligne; $mbPersonne->ville = $ville; $mbPersonne->pays_insee = $xpath->queryTextNode("hprim:pays", $adresse); $pays = new CPaysInsee(); $pays->numerique = $mbPersonne->pays_insee; $pays->loadMatchingObject(); $mbPersonne->pays = $pays->nom_fr; $mbPersonne->cp = $cp; $tel1 = $tel2 = null; if (isset($telephones[0])) { $tel1 = $telephones[0]; } if (isset($telephones[1])) { $tel2 = $telephones[1]; } $mbPersonne->tel = $tel1 != $mbPersonne->tel2 && strlen($tel1) <= 10 ? $tel1 : null; $mbPersonne->tel2 = $tel2 != $mbPersonne->tel && strlen($tel2) <= 10 ? $tel2 : null; if (strlen($tel1) > 10) { $mbPersonne->tel_autre = $tel1; } if (strlen($tel2) > 10) { $mbPersonne->tel_autre = $tel2; } $mbPersonne->email = $email; } elseif ($mbPersonne instanceof CMediusers) { $mbPersonne->_user_last_name = $nom; $mbPersonne->_user_first_name = CMbArray::get($prenoms, 0); $mbPersonne->_user_email = $email; $mbPersonne->_user_phone = CMbArray::get($telephones, 0); $mbPersonne->_user_adresse = $ligne; $mbPersonne->_user_cp = $cp; $mbPersonne->_user_ville = $ville; } return $mbPersonne; }
/** * Handle event A44 - move account information - patient account number * * @param CHL7Acknowledgment $ack Acknowledgment * @param CPatient $newPatient Person * @param array $data Datas * * @return string */ function handleA44(CHL7Acknowledgment $ack, CPatient $newPatient, $data) { // Traitement du message des erreurs $comment = ""; $exchange_hl7v2 = $this->_ref_exchange_hl7v2; $sender = $exchange_hl7v2->_ref_sender; // Impossibilité dans Mediboard de modifier le patient d'un séjour if (CAppUI::conf("dPplanningOp CSejour patient_id") == 0) { return $exchange_hl7v2->setAckAR($ack, "E700", null, $newPatient); } // On considère que l'on a qu'un changement à faire if (count($data["merge"]) > 1) { return $exchange_hl7v2->setAckAR($ack, "E701", null, $newPatient); } $data = CMbArray::get($data["merge"], 0); $venue = new CSejour(); $mbPatient = new CPatient(); $mbPatientChange = new CPatient(); $patientPI = CValue::read($data['personIdentifiers'], "PI"); $patientRI = CValue::read($data['personIdentifiers'], "RI"); $patientChangePI = CValue::read($data['personChangeIdentifiers'], "PI"); $patientChangeRI = CValue::read($data['personChangeIdentifiers'], "RI"); // Acquittement d'erreur : identifiants RI et PI non fournis if (!$patientRI && !$patientPI || !$patientChangeRI && !$patientChangePI) { return $exchange_hl7v2->setAckAR($ack, "E100", null, $newPatient); } $idexPatient = CIdSante400::getMatch("CPatient", $sender->_tag_patient, $patientPI); if ($mbPatient->load($patientRI)) { if ($mbPatient->_id != $idexPatient->object_id) { $comment = "L'identifiant source fait référence au patient : {$idexPatient->object_id}"; $comment .= " et l'identifiant cible au patient : {$mbPatient->_id}."; return $exchange_hl7v2->setAckAR($ack, "E601", $comment, $newPatient); } } if (!$mbPatient->_id) { $mbPatient->load($idexPatient->object_id); } $idexPatientChange = CIdSante400::getMatch("CPatient", $sender->_tag_patient, $patientChangePI); if ($mbPatientChange->load($patientChangeRI)) { if ($mbPatientChange->_id != $idexPatientChange->object_id) { $comment = "L'identifiant source fait référence au patient : {$idexPatientChange->object_id}"; $comment .= "et l'identifiant cible au patient : {$mbPatientChange->_id}."; return $exchange_hl7v2->setAckAR($ack, "E602", $comment, $newPatient); } } if (!$mbPatientChange->_id) { $mbPatientChange->load($idexPatientChange->object_id); } if (!$mbPatient->_id || !$mbPatientChange->_id) { $comment = !$mbPatient->_id ? "Le patient {$mbPatient->_id} est inconnu dans Mediboard." : "Le patient {$mbPatientChange->_id} est inconnu dans Mediboard."; return $exchange_hl7v2->setAckAR($ack, "E603", $comment, $newPatient); } $venueAN = $this->getVenueAN($sender, $data); $NDA = CIdSante400::getMatch("CSejour", $sender->_tag_sejour, $venueAN); if (!$venueAN && !$NDA->_id) { return $exchange_hl7v2->setAckAR($ack, "E604", $comment, $mbPatient); } $venue->load($NDA->object_id); // Impossibilité dans Mediboard de modifier le patient d'un séjour ayant une entrée réelle if (CAppUI::conf("dPplanningOp CSejour patient_id") == 2 && $venue->entree_reelle) { return $exchange_hl7v2->setAckAR($ack, "E605", null, $venue); } if ($venue->patient_id != $mbPatientChange->_id) { return $exchange_hl7v2->setAckAR($ack, "E606", null, $venue); } $venue->patient_id = $mbPatient->_id; if ($msg = $venue->store()) { return $exchange_hl7v2->setAckAR($ack, "E607", $msg, $venue); } $comment = CEAISejour::getComment($venue); return $exchange_hl7v2->setAckAA($ack, "I600", $comment, $venue); }
/** * store the patient * * @param String[] $identifier identifier * @param CPatient $patient patient * @param DOMNode $node node * * @return null|CHPrimSanteError */ function storePatient($identifier, $patient, $node) { $sender = $this->_ref_sender; if ($identifier["merge"] === "FU") { return $this->mergePatient($identifier, $sender->_tag_patient, $patient); } //@todo voir pour nouveau né /** * H2.3C: Si le patient est un nouveau né, les champs 8.3 et 8.5 peuvent contenir les numéros permanent et * dossier administratif de la mère. Dans ce cas, afin de distinguer (en plus des nom et prénom) le nouveau né de sa mère, * et pour permettre une meilleure gestion des admissions, il faut renseigner le sous-champ 8.5.2, dans les contextes ADM et ORM. */ $person = $this->getNamePerson($node); $patient->nom_jeune_fille = $person["family_name"]; $patient->nom = $person["name"]; $patient->prenom = $person["firstname"]; $patient->prenom_2 = $person["secondname"]; $patient->civilite = CMbString::lower($person["civilite"]); $patient->naissance = $this->getBirthdate($node); $patient->sexe = CMbString::lower($this->getSexPerson($node)); $address = $this->getAddress($node); $address["street"] .= $address["comp"] ? "\n{$address["comp"]}" : null; $patient->adresse = $address["street"]; $patient->ville = $address["city"]; $patient->pays = $address["country"]; $patient->cp = $address["postal"]; $phone = $this->getPhone($node); $patient->tel = CMbArray::get($phone, 0); $patient->tel2 = CMbArray::get($phone, 1); $patient->situation_famille = $this->getMaritalStatus($node); $patient->deces = $this->getDeathDate($node); $patient->repair(); if ($msg = $patient->store()) { return new CHPrimSanteError($this->_ref_exchange_hpr, "P", "08", array("P", $this->loop, $this->identifier_patient), "8.3", $msg); } /*$ins = $this->getINS($node); foreach ($ins as $_ins) { $ins_patient = new CINSPatient(); $ins_patient->ins = $_ins["ins"]; $ins_patient->type = substr($_ins["type"], -1); $ins_patient->date = $_ins["date"]; $ins_patient->provider = $sender->nom; if ($msg = $ins_patient->store()) { return new CHPrimSanteError($this->_ref_exchange_hpr, "P", "11", array("P", $this->loop, $this->identifier_patient), "8.12", $msg); } }*/ return null; }
/** * Transforme la classe en document XML * * @param null $nameParent String * @param null $namespace String * * @return CCDADomDocument */ function toXML($nameParent = null, $namespace = null) { $dom = new CCDADomDocument(); //on affecte le nom de la classe comme noeud racine $name = $this->getNameClass(); /** * Si le nom parent est spécifié, on utilisera ce nom pour le noeud racine */ if (!empty($nameParent)) { $name = $nameParent; } //on créé le nom racine $baseXML = $dom->addElement($dom, $name, null, $namespace); //on récupère les specifications définie dans les props $spec = $this->getSpecs(); //On parcours les specs foreach ($spec as $key => $value) { //on récupère une instance d'une classe stocké dans la variable /** @var CCDA_Datatype $classInstance */ $classInstance = $this->{$key}; //on effectue différente action selon ce qui est définir dans la prop XML switch ($value["xml"]) { case "attribute": //On vérifie la présence d'une instance if (empty($classInstance)) { continue; } if ($key === "identifier") { $key = "ID"; } //On créé l'attribut $dom->addAttribute($baseXML, $key, $classInstance->getData()); break; case "data": //on insert la donnée avant tous les éléments $dom->insertTextFirst($baseXML, $this->getData()); break; case "element": //on vérifie l'existence d'une instance if (empty($classInstance)) { continue; } //on vérifie si l'instance est un tableau if (is_array($classInstance)) { //on parcours les différentes instance /** @var CCDA_Datatype[] $classInstance */ foreach ($classInstance as $_class) { //on récupère le code xml de l'instance en spécifiant le nom du noeud racine $xmlClass = $_class->toXML($key, $namespace); //on ajoute à notre document notre instance $dom->importDOMDocument($baseXML, $xmlClass); } } else { //on récupère le code xml de l'instance en spécifiant le nom du noeud racine $xmlClass = $classInstance->toXML($key, $namespace); //on ajoute à notre document notre instance $dom->importDOMDocument($baseXML, $xmlClass); } break; } //si la propriété abstract est spécifié if (CMbArray::get($value, "abstract")) { //on vérifie l'existence d'une instance if (empty($classInstance)) { continue; } //on cherche le noeud XML dans notre document $xpath = new CMbXPath($dom); if (!empty($namespace)) { $xpath->registerNamespace("cda", $namespace); $nodeKey = $xpath->queryUniqueNode("//cda:" . $key); } else { $nodeKey = $xpath->queryUniqueNode("//" . $key); } if (is_array($classInstance)) { foreach ($classInstance as $_class) { /** * on spécifie le type de l'élément (on cast) */ $dom->castElement($nodeKey, $_class->getNameClass()); } } else { /** * on spécifie le type de l'élément (on cast) */ $dom->castElement($nodeKey, $classInstance->getNameClass()); } } } return $dom; }
/** * @see parent::updatePlainFields() */ function updatePlainFields() { parent::updatePlainFields(); // Tris $dBs_gauche = array(); foreach ($this->_gauche_vocale as $key => $value) { $dBs_gauche[] = CMbArray::get($value, 0, "end sort"); $this->_gauche_vocale[$key] = CMbArray::get($value, 0) . "-" . CMbArray::get($value, 1); } array_multisort($dBs_gauche, SORT_ASC, $this->_gauche_vocale); $dBs_droite = array(); foreach ($this->_droite_vocale as $key => $value) { $dBs_droite[] = CMbArray::get($value, 0, "end sort"); $this->_droite_vocale[$key] = CMbArray::get($value, 0) . "-" . CMbArray::get($value, 1); } array_multisort($dBs_droite, SORT_ASC, $this->_droite_vocale); // Implodes $this->gauche_aerien = implode("|", $this->_gauche_aerien); $this->gauche_osseux = implode("|", $this->_gauche_osseux); $this->gauche_conlat = implode("|", $this->_gauche_conlat); $this->gauche_ipslat = implode("|", $this->_gauche_ipslat); $this->gauche_pasrep = implode("|", $this->_gauche_pasrep); $this->gauche_vocale = implode("|", $this->_gauche_vocale); $this->gauche_tympan = implode("|", $this->_gauche_tympan); $this->droite_aerien = implode("|", $this->_droite_aerien); $this->droite_osseux = implode("|", $this->_droite_osseux); $this->droite_conlat = implode("|", $this->_droite_conlat); $this->droite_ipslat = implode("|", $this->_droite_ipslat); $this->droite_pasrep = implode("|", $this->_droite_pasrep); $this->droite_vocale = implode("|", $this->_droite_vocale); $this->droite_tympan = implode("|", $this->_droite_tympan); }
* @category HL7 * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $actor_guid = CValue::get("actor_guid"); $profil = CValue::get("profil", "PAM"); $message_class = CValue::get("message_class", "CHL7EventADTA01"); $temp = explode("_", $message_class); $event_name = CMbArray::get($temp, 0); $version = CAppUI::conf("hl7 default_version"); $extension = null; if (CMbArray::get($temp, 1)) { $extension = CAppUI::conf("hl7 default_fr_version"); } $message = str_replace("CHL7Event", "", $event_name); /** @var CInteropActor $actor */ $actor = CMbObject::loadFromGuid($actor_guid); $where = array("message" => " = '{$message}'", "profil" => " = '{$profil}'"); if ($extension) { $where["extension"] = " = '{$extension}'"; } $trans = new CHL7v2Transformation($version, $extension, $message); $tree = $trans->getSegments($actor); $smarty = new CSmartyDP(); $smarty->assign("profil", $profil); $smarty->assign("version", $version); $smarty->assign("extension", $extension);
/** * OBX Segment with reference pointer to external report * * @param DOMNode $OBX DOM node * @param CMbObject $object object * @param String $name name * * @return bool */ function getReferencePointerToExternalReport(DOMNode $OBX, CMbObject $object, $name) { $exchange_hl7v2 = $this->_ref_exchange_hl7v2; $sender = $exchange_hl7v2->_ref_sender; //Récupération de l'emplacement et du type du fichier (full path) $observation = $this->getObservationValue($OBX); $rp = explode("^", $observation); $pointer = CMbArray::get($rp, 0); $type = CMbArray::get($rp, 2); // Création d'un lien Hypertext sur l'objet if ($type == "HTML") { $hyperlink = new CHyperTextLink(); $hyperlink->setObject($object); $hyperlink->name = $name; $hyperlink->link = $pointer; $hyperlink->loadMatchingObject(); if ($msg = $hyperlink->store()) { $this->codes[] = "E343"; return false; } return true; } // Chargement des objets associés à l'expéditeur /** @var CInteropSender $sender_link */ $object_links = $sender->loadRefsObjectLinks(); if (!$object_links) { $this->codes[] = "E340"; return false; } $sender_link = new CInteropSender(); $files_category = new CFilesCategory(); // On récupère toujours une seule catégorie, et une seule source associée à l'expéditeur foreach ($object_links as $_object_link) { if ($_object_link->_ref_object instanceof CFilesCategory) { $files_category = $_object_link->_ref_object; } if ($_object_link->_ref_object instanceof CInteropSender) { $sender_link = $_object_link->_ref_object; continue 1; } } // Aucun expéditeur permettant de récupérer les fichiers if (!$sender_link->_id) { $this->codes[] = "E340"; return false; } $authorized_sources = array("CSenderFileSystem", "CSenderFTP"); // L'expéditeur n'est pas prise en charge pour la réception de fichiers if (!CMbArray::in($sender_link->_class, $authorized_sources)) { $this->codes[] = "E341"; return false; } $sender_link->loadRefsExchangesSources(); // Aucune source permettant de récupérer les fichiers if (!$sender_link->_id) { $this->codes[] = "E342"; return false; } $source = $sender_link->getFirstExchangesSources(); $path = str_replace("\\", "/", $pointer); $path = basename($path); if ($source instanceof CSourceFileSystem) { $path = $source->getFullPath() . "/{$path}"; } // Exception déclenchée sur la lecture du fichier try { $content = $source->getData("{$path}"); } catch (Exception $e) { $this->codes[] = "E345"; return false; } if (!$type) { $type = CMbPath::getExtension($path); } $file_type = $this->getFileType($type); $file_name = $this->getObservationFilename($OBX); // Gestion du CFile $file = new CFile(); $file->setObject($object); $file->file_name = $file_name ? $file_name : $name; $file->file_type = $file_type; $file->loadMatchingObject(); if ($files_category->_id && $sender->_configs["associate_category_to_a_file"]) { $file->file_category_id = $files_category->_id; } $file->file_date = "now"; $file->doc_size = strlen($content); $file->fillFields(); $file->updateFormFields(); $file->putContent($content); if ($msg = $file->store()) { $this->codes[] = "E343"; } $this->codes[] = "I340"; return true; }
/** * Show a value if different from previous cached one * * @param array $params Smarty parameters * * name : Name of the cached value * * value: Value to show, empty string to clear out cache * * reset: Reset value * * @param self &$smarty The Smarty object * * @return string */ function mb_ditto($params, &$smarty) { static $cache = array(); $name = CMbArray::extract($params, "name", null, true); $value = CMbArray::extract($params, "value", null, true); $reset = CMbArray::extract($params, "reset", false, false); $center = CMbArray::extract($params, "center", false, false); $old = ''; if (!$reset) { $old = CMbArray::get($cache, $name, ""); } $cache[$name] = $value; $new_value = $old != $value ? $value : "|"; if ($center && $new_value == "|") { $new_value = "<div style='text-align:center;'>{$new_value}</div>"; } return $new_value; }
public function testGet() { $this->assertNull($this->stub->get(null, null)); $this->assertEquals("val", $this->stub->get(array("key" => "val"), "key")); }
/** * Store object * * @return void */ function doStore() { if ($msg = $this->_obj->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); if ($this->redirectError) { $this->redirect =& $this->redirectError; } } else { $id = $this->objectKey; CValue::setSession($id, $this->_obj->_id); CAppUI::setMsg($this->_old->_id ? $this->modifyMsg : $this->createMsg, UI_MSG_OK); // Store additional object reference to the CExObject $ex_object_guid = CMbArray::get($this->request, "_ex_object_guid"); if ($ex_object_guid) { $obj = $this->_obj; /** @var CExObject $ex_object */ $ex_object = CStoredObject::loadFromGuid($ex_object_guid); if ($ex_object->_id) { $ex_object->additional_class = $obj->_class; $ex_object->additional_id = $obj->_id; $ex_object->store(); } } if ($this->redirectStore) { $this->redirect =& $this->redirectStore; } } }
/** * Add value set * * @param DOMNode $elParent Parent element * @param string $attName Attribute name * @param string $attValue Attribute value * @param array $data Data * * @return void */ function addValueSet($elParent, $attName, $attValue, $data = array()) { if (!($value = CMbArray::get($data, $attValue))) { return; } $this->addAttribute($elParent, $attName, $value); }
/** * Ajout des éléments Reponses * * @param string $statut Statut de l'acquittement * @param array $codes Codes d'erreurs * @param string $commentaires Commentaire * @param CMbObject $mbObject Object * @param array $data Datas * * @return void */ function addReponses($statut, $codes, $commentaires = null, $mbObject = null, $data = array()) { $acquittementsServeurActivitePmsi = $this->documentElement; $mbPatient = $mbSejour = null; if ($mbObject instanceof CSejour) { $mbPatient = $mbObject->loadRefPatient(); $mbSejour = $mbObject; } if ($mbObject instanceof COperation) { $mbPatient = $mbObject->loadRefSejour()->loadRefPatient(); $mbSejour = $mbObject->_ref_sejour; } // Ajout des réponses $reponses = $this->addElement($acquittementsServeurActivitePmsi, "reponses"); // Ajout du patient et de la venue $patient = $this->addElement($reponses, "patient"); if (isset($mbPatient->_id)) { $this->addPatient($patient, $mbPatient, false, true); } $venue = $this->addElement($reponses, "venue"); if (isset($mbSejour->_id)) { $this->addVenue($venue, $mbSejour, false, true); } if (!is_array($codes)) { if (!isset($mbPatient->_id)) { $this->addPatientError($reponses, $data); } $this->addReponseGeneral($reponses, $statut, $codes, null, $mbObject, $commentaires, $data); return; } // Génération des réponses en fonction du type de l'acquittement switch (get_class($this)) { case "CHPrimXMLAcquittementsServeurActes": if (!$data && !CMbArray::get($data, "CCAM") && !CMbArray::get($data, "NGAP")) { break; } $actesCCAM = $data["CCAM"]; $actesNGAP = $data["NGAP"]; foreach ($actesCCAM as $_acteCCAM) { $code_ccam = $codes[$_acteCCAM["idSourceActeCCAM"]]; $this->addReponseCCAM($reponses, $_acteCCAM["statut"], $code_ccam["code"], $_acteCCAM, $mbObject, $code_ccam["commentaires"]); } foreach ($actesNGAP as $_acteNGAP) { $code_ngap = $codes[$_acteNGAP["idSourceActeNGAP"]]; $this->addReponseNGAP($reponses, $_acteNGAP["statut"], $code_ngap["code"], $_acteNGAP, $mbObject, $code_ngap["commentaires"]); } break; case "CHPrimXMLAcquittementsServeurIntervention": $this->addReponseIntervention($reponses, $statut, $codes, null, $mbObject, $commentaires); break; } }
/** * Retourne les classes manqantes * * @return array */ static function missclass() { /** * On récupère les types des différents XSD */ $listAllType = self::returnType("modules/cda/resources/datatypes-base.xsd"); $voc = self::returnType("modules/cda/resources/voc.xsd"); $datatype = self::returnType("modules/cda/resources/datatypes.xsd"); $listAllType = array_merge($listAllType, $voc, $datatype); $file = glob("modules/cda/classes/{classesCDA,datatypes}/{voc,base,datatype}/*.class.php", GLOB_BRACE); $result = array(); /** * On parcours les classes existantes */ foreach ($file as $_file) { $_file = CMbArray::get(explode(".", $_file), 0); $_file = substr($_file, strrpos($_file, "/") + 1); /** @var CCDAClasseBase $class */ $class = new $_file(); array_push($result, $class->getNameClass()); } //on retourne la différence entre le tableau des types XSd et le tableau des classes existantes return array_diff($listAllType, $result); }
if ($web_service) { $where["web_service_name"] = " = '" . $web_service . "'"; } $total_echange_soap = 0; $echangesSoap = array(); if ($service && $web_service || $service && $_date_min && $_date_max) { $total_echange_soap = $itemEchangeSoap->countList($where); $order = "date_echange DESC"; $forceindex[] = "date_echange"; $echangesSoap = $itemEchangeSoap->loadList($where, $order, "{$page}, 20", null, null, $forceindex); } foreach ($echangesSoap as $_echange_soap) { /** @var $_echange_soap CEchangeSOAP */ $destinataire = $_echange_soap->destinataire; $url = parse_url($destinataire); if (!CMbArray::get($url, "host")) { $name = basename($destinataire); $url['host'] = $name; } $_echange_soap->destinataire = $url['host']; } $services = array(); if (!$echange_soap->_id) { $ds = CSQLDataSource::get("std"); $services = $ds->loadColumn("SELECT type FROM echange_soap GROUP BY type"); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("echange_soap", $echange_soap); $smarty->assign("echangesSoap", $echangesSoap); $smarty->assign("total_echange_soap", $total_echange_soap);
$date_max = CValue::get("_date_max"); $page = (int) CValue::get("page", 0); $where = array(); if ($status) { $where["status"] = "= '{$status}'"; } if ($error) { $where["error"] = "LIKE '%{$error}%'"; } if ($cronjob_id) { $where["cronjob_id"] = "= '{$cronjob_id}'"; } if ($date_min) { $where["start_datetime"] = ">= '{$date_min}'"; } if ($date_max) { $where["start_datetime"] = $date_min ? $where["start_datetime"] . "AND start_datetime <= '{$date_max}'" : "<= '{$date_max}'"; } $log = new CCronJobLog(); /** @var CCronJobLog[] $logs */ $nb_log = $log->countList($where); $logs = $log->loadList($where, "start_datetime DESC", "{$page}, 30"); $cronjobs = CCronJobLog::massLoadFwdRef($logs, "cronjob_id"); foreach ($logs as $_log) { $_log->_ref_cronjob = CMbArray::get($cronjobs, $_log->cronjob_id); } $smarty = new CSmartyDP(); $smarty->assign("logs", $logs); $smarty->assign("page", $page); $smarty->assign("nb_log", $nb_log); $smarty->display("inc_cronjobs_logs.tpl");
/** * 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>"); } } } }
$results[$i]["username"] = CMbArray::get($line, 2); $results[$i]["password"] = CMbArray::get($line, 3); $results[$i]["type"] = CMbArray::get($line, 4); $results[$i]["function_name"] = CMbArray::get($line, 5); $results[$i]["profil_name"] = CMbArray::get($line, 6); if (CAppUI::conf("ref_pays") == 1) { $results[$i]["adeli"] = CMbArray::get($line, 7); $results[$i]["rpps"] = CMbArray::get($line, 8); } else { $results[$i]["ean"] = CMbArray::get($line, 7); $results[$i]["rcc"] = CMbArray::get($line, 8); } $results[$i]["spec_cpam_code"] = CMbArray::get($line, 9); $results[$i]["discipline_name"] = CMbArray::get($line, 10); $results[$i]["idex"] = CMbArray::get($line, 11); $results[$i]["remote"] = CMbArray::get($line, 12); $results[$i]["error"] = 0; if ($results[$i]["remote"] == "") { $results[$i]["remote"] = "1"; } // User $mediuser = new CMediusers(); $mediuser->_user_last_name = $results[$i]["lastname"]; $mediuser->_user_first_name = $results[$i]["firstname"]; $mediuser->_user_type = $results[$i]["type"]; if (!is_numeric($mediuser->_user_type) || !array_key_exists($mediuser->_user_type, CUser::$types)) { $unfound["user_type"][$mediuser->_user_type] = true; } if (CAppUI::conf("ref_pays") == 1) { $mediuser->adeli = $results[$i]["adeli"]; $mediuser->rpps = $results[$i]["rpps"];
/** * @see parent::getFormHtmlElement() */ function getFormHtmlElement($object, $params, $value, $className) { $form = CMbArray::extract($params, "form"); $increment = CMbArray::extract($params, "increment"); $showPlus = CMbArray::extract($params, "showPlus"); $fraction = CMbArray::extract($params, "fraction"); $showFraction = CMbArray::extract($params, "showFraction"); $deferEvent = CMbArray::extract($params, "deferEvent"); $bigButtons = CMbArray::extract($params, "bigButtons"); $readonly = CMbArray::get($params, "readonly"); $field = CMbString::htmlSpecialChars($this->fieldName); $min = CMbArray::extract($params, "min"); if ($min === null) { $min = CMbFieldSpec::checkNumeric($this->min, false); } $max = CMbArray::extract($params, "max"); if ($max === null) { $max = CMbFieldSpec::checkNumeric($this->max, false); } $new_value = CMbArray::extract($params, "value"); if ($new_value !== null) { $value = $new_value; } $decimals = CMbArray::extract($params, "decimals", $this->decimals); if ($decimals == null) { $decimals = isset($this->precise) ? 4 : 2; } $step = CMbArray::extract($params, "step"); $step = CMbFieldSpec::checkNumeric($step, false); CMbArray::defaultValue($params, "size", 4); if ($form && $increment && !$readonly) { $sHtml = $this->getFormElementText($object, $params, ($value >= 0 && $showPlus ? '+' : '') . ($value == 0 && $showPlus ? '0' : $value), $className, "number"); $sHtml .= ' <script type="text/javascript"> Main.add(function(){ var element = $(document.forms["' . $form . '"]["' . $field . '"]); if ($(element.form).isReadonly()) return; element.addSpinner({'; if ($step) { $sHtml .= "step: {$step},"; } if ($decimals) { $sHtml .= "decimals: {$decimals},"; } if ($this->pos) { $sHtml .= "min: 0,"; } elseif (isset($min)) { $sHtml .= "min: {$min},"; } if (isset($max)) { $sHtml .= "max: {$max},"; } if ($deferEvent) { $sHtml .= "deferEvent: true,"; } if ($bigButtons) { $sHtml .= "bigButtons: true,"; } if ($showPlus) { $sHtml .= "showPlus: true,"; } if ($fraction) { $sHtml .= "fraction: true,"; } if ($showFraction) { $sHtml .= "showFraction: true,"; } $sHtml .= '_:0 // IE rules }); }); </script>'; } else { $sHtml = $this->getFormElementText($object, $params, $value, $className, "number"); } return $sHtml; }
/** * Get all number patient by a state and the filter * * @param String $date_min Date minimum * @param String $date_max Date maximum * * @return array */ static function getAllNumberPatient($date_min = null, $date_max = null) { $patients_count = array(); $leftjoin = null; $where = array(); if ($date_min) { $where["entree"] = ">= '{$date_min}'"; $leftjoin["sejour"] = "patients.patient_id = sejour.patient_id"; } if ($date_max) { $where["entree"] = "<= '{$date_max}'"; $leftjoin["sejour"] = "patients.patient_id = sejour.patient_id"; } $ds = CSQLDataSource::get("std"); $request = new CRequest(); $request->addSelect("`status`, COUNT(DISTINCT(`patients`.`patient_id`)) as `total`"); $request->addTable("patients"); $request->addLJoin($leftjoin); $request->addWhere($where); $request->addGroup("`status`"); $result = $ds->loadList($request->makeSelect()); $state_count = array(); foreach ($result as $_result) { $state_count[$_result["status"]] = $_result["total"]; } foreach (self::$list_state as $_state) { $patients_count[CMbString::lower($_state)] = CMbArray::get($state_count, $_state, 0); if ($_state == "CACH") { $where = array("vip" => "= '1'", "status" => "!= 'VALI'"); $patient = new CPatient(); $patients_count[CMbString::lower($_state)] = $patient->countList($where, null, $leftjoin); } if ($_state == "DPOT") { $patient_link = new CPatientLink(); $patients_count[CMbString::lower($_state)] = $patient_link->countList($where, null, array("sejour" => "patient_link.patient_id1 = sejour.patient_id")); } } return $patients_count; }