/** * Build A37 event * * @param CPatient $patient Person * * @see parent::build() * * @return void */ function build($patient) { parent::build($patient); // Patient Identification $this->addPID($patient); /* @toto old ? */ $patient_link = new CPatient(); $patient_link->load($patient->_old->patient_link_id); // Patient link Identification $this->addPID($patient_link); }
/** * Test A28 - Create patient with full demographic data * * @param CCnStep $step Step * * @throws CMbException * * @return void */ static function testA28(CCnStep $step) { // PDS-PAM_Identification_Mgt_Merge $patient = new CPatient(); // Random sur les champs du patient $patient->random(); $test = $step->_ref_test; $partner = $test->_ref_partner; // On sélectionne le nom du patient en fonction du partenaire, du test et de l'étape $patient->nom = "{$partner->name}_{$test->_id}_{$step->number}"; self::storeObject($patient); }
/** * Fill other identifiers * * @param array &$identifiers Identifiers * @param CPatient $patient Person * @param CInteropActor $actor Interop actor * * @return null */ function fillOtherIdentifiers(&$identifiers, CPatient $patient, CInteropActor $actor = null) { $ins = $patient->loadLastINS(); if ($ins) { $identifiers[] = array($ins->ins, null, null, $this->getAssigningAuthority("INS-{$ins->type}"), "INS-{$ins->type}", null, CMbDT::date($ins->date)); } if ($patient->matricule) { $identifiers[] = array($patient->matricule, null, null, $this->getAssigningAuthority("INSEE"), "SS"); } if ($actor->_configs["send_own_identifier"]) { $identifiers[] = array($patient->_id, null, null, $this->getAssigningAuthority("mediboard"), $actor->_configs["build_identifier_authority"] == "PI_AN" ? "PI" : "RI"); } }
/** * Build A44 event * * @param CSejour $sejour Admit * * @see parent::build() * * @return void */ function build($sejour) { parent::build($sejour); $patient = $sejour->_ref_patient; // Patient Identification $this->addPID($patient, $sejour); // Patient Additional Demographic $this->addPD1($patient); $old_patient = new CPatient(); $old_patient->load($sejour->_old->patient_id); // Merge Patient Information $this->addMRG($old_patient); }
/** * Update soundex data * * @return bool */ protected function createSoundex() { $where = array("nom_soundex2" => "IS NULL", "nom" => "!= ''"); $limit = "0,1000"; $pat = new CPatient(); $listPat = $pat->loadList($where, null, $limit); while (count($listPat)) { foreach ($listPat as &$pat) { if ($msg = $pat->store()) { trigger_error("Erreur store [{$pat->_id}] : {$msg}"); return false; } } $listPat = $pat->loadList($where, null, $limit); } return true; }
/** * Create domains * * @return bool */ protected function createDomain() { $ds = $this->ds; $groups = $ds->loadList("SELECT * FROM groups_mediboard"); $tab = array("CPatient", "CSejour"); foreach ($groups as $_group) { $group_id = $_group["group_id"]; $group_configs = $ds->loadHash("SELECT * FROM groups_config WHERE object_id = '{$group_id}'"); foreach ($tab as $object_class) { if ($object_class == "CPatient") { $tag_group = CPatient::getTagIPP($group_id); if (!$group_configs || !array_key_exists("ipp_range_min", $group_configs)) { continue; } $range_min = $group_configs["ipp_range_min"]; $range_max = $group_configs["ipp_range_max"]; } else { $tag_group = CSejour::getTagNDA($group_id); if (!$group_configs || !array_key_exists("nda_range_min", $group_configs)) { continue; } $range_min = $group_configs["nda_range_min"]; $range_max = $group_configs["nda_range_max"]; } if (!$tag_group) { continue; } // Insert domain $query = "INSERT INTO `domain` (`domain_id`, `incrementer_id`, `actor_id`, `actor_class`, `tag`)\n VALUES (NULL, NULL, NULL, NULL, '{$tag_group}');"; $ds->query($query); $domain_id = $ds->insertId(); // Insert group domain $query = "INSERT INTO `group_domain` (`group_domain_id`, `group_id`, `domain_id`, `object_class`, `master`)\n VALUES (NULL, '{$group_id}', '{$domain_id}', '{$object_class}', '1');"; $ds->query($query); // Select incrementer for this group $select = "SELECT *\n FROM `incrementer`\n LEFT JOIN `domain` ON `incrementer`.`incrementer_id` = `domain`.`incrementer_id`\n LEFT JOIN `group_domain` ON `domain`.`domain_id` = `group_domain`.`domain_id`\n WHERE `incrementer`.`object_class` = '{$object_class}'\n AND `group_domain`.`group_id` = '{$group_id}';"; $incrementer = $ds->loadHash($select); $incrementer_id = $incrementer["incrementer_id"]; if ($incrementer_id) { // Update domain with incrementer_id $query = "UPDATE `domain`\n SET `incrementer_id` = '{$incrementer_id}'\n WHERE `domain_id` = '{$domain_id}';"; $ds->query($query); // Update incrementer if (!array_key_exists("nda_range_min", $group_configs) || !$range_max || $range_min === null) { continue; } $query = "UPDATE `incrementer`\n SET `range_min` = '{$range_min}', `range_max` = '{$range_max}'\n WHERE `incrementer_id` = '{$incrementer_id}';"; $ds->query($query); } } } // Update constraints to stick to the event return true; }
function syncPatient($update = true) { $medecin_id = $this->consume("medecin_id"); // Gestion des id400 $tag = "medecin-patient"; $idex = new CIdSante400(); $idex->object_class = "CPatient"; $idex->id400 = $medecin_id; $idex->tag = $tag; // Identité $patient = new CPatient(); $patient->nom = $this->consume("nom"); $patient->prenom = CValue::first($this->consume("prenom"), $patient->nom); // Simulation de l'âge $year = 1980 - strlen($patient->nom); $month = '01'; $day = str_pad(strlen($patient->prenom) % 30, 2, '0', STR_PAD_LEFT); $patient->naissance = "{$year}-{$month}-{$day}"; // Binding $this->trace($patient->getProperties(true), "Patient à enregistrer"); $idex->bindObject($patient); $this->markStatus(self::STATUS_PATIENT); }
/** * Handle event A47 * * @param CHL7Acknowledgment $ack Acknowledgment * @param CPatient $patient Person * @param array $data Data * * @return string */ function handleA47(CHL7Acknowledgment $ack, CPatient $patient, $data) { $exchange_hl7v2 = $this->_ref_exchange_hl7v2; $sender = $exchange_hl7v2->_ref_sender; $sender->loadConfigValues(); $this->_ref_sender = $sender; $incorrect_identifier = null; // Traitement du mode simple, cad if (CHL7v2Message::$handle_mode == "simple") { $MRG_4 = $this->queryNodes("MRG.4", $data["MRG"])->item(0); $incorrect_identifier = $this->queryTextNode("CX.1", $MRG_4); $patient->load($incorrect_identifier); // ID non connu (non fourni ou non retrouvé) if (!$incorrect_identifier || !$patient->_id) { return $exchange_hl7v2->setAckAR($ack, "E141", null, $patient); } } else { $MRG_1 = $this->queryNodes("MRG.1", $data["MRG"])->item(0); if ($this->queryTextNode("CX.5", $MRG_1) == "PI") { $incorrect_identifier = $this->queryTextNode("CX.1", $MRG_1); } // Chargement de l'IPP $IPP_incorrect = new CIdSante400(); if ($incorrect_identifier) { $IPP_incorrect = CIdSante400::getMatch("CPatient", $sender->_tag_patient, $incorrect_identifier); } // PI non connu (non fourni ou non retrouvé) if (!$incorrect_identifier || !$IPP_incorrect->_id) { return $exchange_hl7v2->setAckAR($ack, "E141", null, $patient); } $patient->load($IPP_incorrect->object_id); // Passage en trash de l'IPP du patient a éliminer if ($msg = $patient->trashIPP($IPP_incorrect)) { return $exchange_hl7v2->setAckAR($ack, "E140", $msg, $patient); } } // Sauvegarde du nouvel IPP $IPP = new CIdSante400(); $IPP->object_id = $patient->_id; $IPP->object_class = "CPatient"; $IPP->id400 = $data['personIdentifiers']["PI"]; $IPP->tag = $sender->_tag_patient; $IPP->last_update = CMbDT::dateTime(); if ($msg = $IPP->store()) { return $exchange_hl7v2->setAckAR($ack, "E140", $msg, $patient); } return $exchange_hl7v2->setAckAA($ack, "I140", null, $patient); }
/** * @see parent::onAfterStore() */ function onAfterStore(CMbObject $mbObject) { if (!$this->isHandled($mbObject)) { return false; } if (!$mbObject->_id || !$this->create) { return false; } $group_id = $mbObject->_id; $object_class = array("CSejour", "CPatient"); global $dPconfig; $original_value = $dPconfig["eai"]["use_domain"]; $dPconfig["eai"]["use_domain"] = "0"; foreach ($object_class as $_class) { switch ($_class) { case "CSejour": $tag_group = CSejour::getTagNDA($group_id); break; case "CPatient": $tag_group = CPatient::getTagIPP($group_id); break; default: $tag_group = null; } if (!$tag_group) { continue; } $domain = new CDomain(); $domain->tag = $tag_group; if ($domain->store()) { continue; } $group_domain = new CGroupDomain(); $group_domain->group_id = $group_id; $group_domain->domain_id = $domain->_id; $group_domain->object_class = $_class; $group_domain->master = "1"; $group_domain->store(); } $dPconfig["eai"]["use_domain"] = "{$original_value}"; return true; }
/** * Create INSC * * @param CPatient $patient patient * * @return null|string */ static function createINSC(CPatient $patient) { if (!$patient->_vitale_nir_certifie) { return "Ce patient ne possède pas de numéro de sécurité sociale qui lui est propre"; } list($nir_carte, $nir_carte_key) = explode(" ", $patient->_vitale_nir_certifie); $name_carte = mb_strtoupper(CMbString::removeAccents($patient->_vitale_lastname)); $prenom_carte = mb_strtoupper(CMbString::removeAccents($patient->_vitale_firstname)); $name_patient = mb_strtoupper(CMbString::removeAccents($patient->nom)); $prenom_patient = mb_strtoupper(CMbString::removeAccents($patient->prenom)); if ($name_carte !== $name_patient || $prenom_carte !== $prenom_patient) { return "Le bénéficiaire de la carte vitale ne correspond pas au patient en cours"; } $firstName = self::formatString($patient->_vitale_firstname); $insc = self::calculInsc($nir_carte, $nir_carte_key, $firstName, $patient->_vitale_birthdate); if (strlen($insc) !== 22) { return "Problème lors du calcul de l'INSC"; } if (!$insc) { return "Impossible de calculer l'INSC"; } $last_ins = $patient->loadLastINS(); if ($last_ins && $last_ins->ins === $insc) { return null; } $ins = new CINSPatient(); $ins->patient_id = $patient->_id; $ins->ins = $insc; $ins->type = "C"; $ins->date = "now"; $ins->provider = "Mediboard"; if ($msg = $ins->store()) { return $msg; } return null; }
/** * Represents an HL7 NK1 message segment (Next of Kin / Associated Parties) * * @param CPatient $patient Patient * * @return void */ function addNK1s(CPatient $patient) { $i = 1; foreach ($patient->loadRefsCorrespondantsPatient() as $_correspondant) { /** @var CHL7v2SegmentNK1 $NK1 */ $NK1 = CHL7v2Segment::create("NK1", $this->message); $NK1->set_id = $i; $NK1->correspondant = $_correspondant; $NK1->build($this); $i++; } }
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ if (!CAppUI::pref("allowed_modify_identity_status")) { CAppUI::redirect("m=system&a=access_denied"); } $state = CValue::get("state"); $page = (int) CValue::get("page", 0); $date_min = CValue::session("patient_state_date_min"); $date_max = CValue::session("patient_state_date_max"); $patients = array(); $patients_state = array(); $where = array(); $leftjoin = null; $patient = new CPatient(); if ($date_min) { $where["entree"] = ">= '{$date_min}'"; $leftjoin["sejour"] = "patients.patient_id = sejour.patient_id"; } if ($date_max) { $where["sortie"] = "<= '{$date_max}'"; $leftjoin["sejour"] = "patients.patient_id = sejour.patient_id"; } $patients_count = CPatientState::getAllNumberPatient($date_min, $date_max); if ($patients_count[$state] > 0) { /** @var CPatient[] $patients */ $where["status"] = " = '{$state}'"; if ($state != "vali") { $where["vip"] = "= '0'"; }
/** * Handle event * * @param CHL7Acknowledgment $ack Acknowledgement * @param CPatient $newPatient Person * @param array $data Nodes data * * @return null|string */ function handle(CHL7Acknowledgment $ack, CPatient $newPatient, $data) { // Traitement du message des erreurs $comment = $warning = ""; $exchange_hl7v2 = $this->_ref_exchange_hl7v2; $exchange_hl7v2->_ref_sender->loadConfigValues(); $sender = $exchange_hl7v2->_ref_sender; foreach ($data["merge"] as $_data_merge) { $data = $_data_merge; $mbPatient = new CPatient(); $mbPatientElimine = new CPatient(); $patientPI = CValue::read($data['personIdentifiers'], "PI"); $patientRI = CValue::read($data['personIdentifiers'], "RI"); $patientEliminePI = CValue::read($data['personElimineIdentifiers'], "PI"); $patientElimineRI = CValue::read($data['personElimineIdentifiers'], "RI"); // Acquittement d'erreur : identifiants RI et PI non fournis if (!$patientRI && !$patientPI || !$patientElimineRI && !$patientEliminePI) { return $exchange_hl7v2->setAckAR($ack, "E100", null, $newPatient); } $idexPatient = CIdSante400::getMatch("CPatient", $sender->_tag_patient, $patientPI); if ($mbPatient->load($patientRI)) { if ($idexPatient->object_id && $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, "E130", $comment, $newPatient); } } if (!$mbPatient->_id) { $mbPatient->load($idexPatient->object_id); } $idexPatientElimine = CIdSante400::getMatch("CPatient", $sender->_tag_patient, $patientEliminePI); if ($mbPatientElimine->load($patientElimineRI)) { if ($idexPatientElimine->object_id && $mbPatientElimine->_id != $idexPatientElimine->object_id) { $comment = "L'identifiant source fait référence au patient : {$idexPatientElimine->object_id}"; $comment .= "et l'identifiant cible au patient : {$mbPatientElimine->_id}."; return $exchange_hl7v2->setAckAR($ack, "E131", $comment, $newPatient); } } if (!$mbPatientElimine->_id) { $mbPatientElimine->load($idexPatientElimine->object_id); } if (!$mbPatient->_id || !$mbPatientElimine->_id) { $comment = !$mbPatient->_id ? "Le patient {$mbPatient->_id} est inconnu dans Mediboard." : "Le patient {$mbPatientElimine->_id} est inconnu dans Mediboard."; return $exchange_hl7v2->setAckAR($ack, "E120", $comment, $newPatient); } // Passage en trash de l'IPP du patient a éliminer $newPatient->trashIPP($idexPatientElimine); if ($mbPatient->_id == $mbPatientElimine->_id) { return $exchange_hl7v2->setAckAA($ack, "I104", null, $newPatient); } $patientsElimine_array = array($mbPatientElimine); $first_patient_id = $mbPatient->_id; $checkMerge = $mbPatient->checkMerge($patientsElimine_array); // Erreur sur le check du merge if ($checkMerge) { $comment = "La fusion de ces deux patients n'est pas possible à cause des problèmes suivants : {$checkMerge}"; return $exchange_hl7v2->setAckAR($ack, "E121", $comment, $newPatient); } $mbPatientElimine_id = $mbPatientElimine->_id; /** @todo mergePlainFields resets the _id */ $mbPatient->_id = $first_patient_id; // Notifier les autres destinataires $mbPatient->_eai_sender_guid = $sender->_guid; $mbPatient->_merging = CMbArray::pluck($patientsElimine_array, "_id"); if ($msg = $mbPatient->merge($patientsElimine_array)) { return $exchange_hl7v2->setAckAR($ack, "E103", $msg, $mbPatient); } $mbPatient->_mbPatientElimine_id = $mbPatientElimine_id; $comment = CEAIPatient::getComment($mbPatient, $mbPatientElimine); } return $exchange_hl7v2->setAckAA($ack, "I103", $comment, $mbPatient); }
* @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 28472 $ */ CCanDo::checkEdit(); $patient_id = CValue::getOrSession("patient_id"); $name = CValue::get("name"); $firstName = CValue::get("firstName"); $naissance_day = CValue::get("naissance_day"); $naissance_month = CValue::get("naissance_month"); $naissance_year = CValue::get("naissance_year"); $useVitale = CValue::get("useVitale"); $covercard = CValue::get("covercard"); $callback = CValue::get("callback"); $modal = CValue::get("modal", 0); $patient = new CPatient(); $patient->load($patient_id); $patient->loadRefPhotoIdentite(); $patient->countDocItems(); $patient->loadRefsCorrespondantsPatient(); $patient->countINS(); // Chargement de l'ipp $patient->loadIPP(); if (CModule::getActive("fse")) { $cv = CFseFactory::createCV(); if ($cv) { $cv->loadIdVitale($patient); } } if (!$modal) { // Save history
<?php /** * $Id: vw_idx_patients.php 26857 2015-01-21 14:44:41Z rhum1 $ * * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 26857 $ */ CCanDo::checkRead(); $mediuser = CMediusers::get(); // Chargement du patient sélectionné $patient_id = CValue::getOrSession("patient_id"); $patient = new CPatient(); if ($new = CValue::get("new")) { $patient->load(null); CValue::setSession("patient_id", null); CValue::setSession("selClass", null); CValue::setSession("selKey", null); } else { $patient->load($patient_id); } $patient_nom = trim(CValue::getOrSession("nom")); $patient_prenom = trim(CValue::getOrSession("prenom")); $patient_ville = CValue::get("ville"); $patient_cp = CValue::get("cp"); $patient_day = CValue::getOrSession("Date_Day"); $patient_month = CValue::getOrSession("Date_Month"); $patient_year = CValue::getOrSession("Date_Year");
/** * Enregistrement des actes CCAM * * @param CHPrimXMLAcquittementsServeurActivitePmsi $dom_acq DOM Acquittement * @param CMbObject $mbObject Object * @param array $data Data that contain the nodes * * @return string Acquittement **/ function handle(CHPrimXMLAcquittementsServeurActivitePmsi $dom_acq, CMbObject $mbObject, $data) { /** @var COperation $mbObject */ $exchange_hprim = $this->_ref_echange_hprim; $sender = $exchange_hprim->_ref_sender; $sender->loadConfigValues(); $this->_ref_sender = $sender; // Acquittement d'erreur : identifiants source du patient / séjour non fournis if (!$data['idSourcePatient'] || !$data['idSourceVenue']) { return $exchange_hprim->setAckError($dom_acq, "E206", null, $mbObject, $data); } // IPP non connu => message d'erreur $IPP = CIdSante400::getMatch("CPatient", $sender->_tag_patient, $data['idSourcePatient']); if (!$IPP->_id) { return $exchange_hprim->setAckError($dom_acq, "E013", null, $mbObject, $data); } // Chargement du patient $patient = new CPatient(); $patient->load($IPP->object_id); // Num dossier non connu => message d'erreur $NDA = CIdSante400::getMatch("CSejour", $sender->_tag_sejour, $data['idSourceVenue']); if (!$NDA->_id) { return $exchange_hprim->setAckError($dom_acq, "E014", null, $mbObject, $data); } // Chargement du séjour $sejour = new CSejour(); $sejour->load($NDA->object_id); // Si patient H'XML est différent du séjour if ($sejour->patient_id != $patient->_id) { return $exchange_hprim->setAckError($dom_acq, "E015", null, $mbObject, $data); } // Chargement du patient du séjour $sejour->loadRefPatient(); //Mapping actes CCAM $actes = array("CCAM" => $this->mappingActesCCAM($data), "NGAP" => $this->mappingActesNGAP($data)); $codes = array(); $warning = array(); foreach ($actes as $type => $_actes) { foreach ($_actes as $_key => $_acte) { $return = $this->storeActe($_acte, $type, $sejour, $patient, $sender->_tag_hprimxml); $number = $type == "CCAM" ? "0" : "1"; //Cas d'une erreur lors de l'ajoutement if (!is_object($return)) { $warning["A401"][] = $return; $codes[$_acte["idSourceActe{$type}"]] = array("code" => "A4{$number}1", "commentaires" => $return); $actes[$type][$_key]["statut"] = "avt"; continue; } $actes[$type][$_key]["statut"] = "ok"; //Cas d'une modification ou d'un ajout if ($return->_id) { $codes[$_acte["idSourceActe{$type}"]] = array("code" => "I4{$number}1", "commentaires" => null); continue; } //Cas de la suppression $codes[$_acte["idSourceActe{$type}"]] = array("code" => "I4{$number}2", "commentaires" => null); } } return $exchange_hprim->setAck($dom_acq, $codes, $warning, null, $sejour, $actes); }
$etat_relance = CValue::getOrSession("etat_relance", 0); $facture_id = CValue::getOrSession("facture_id"); $patient_id = CValue::getOrSession("patient_id"); $no_finish_reglement = CValue::getOrSession("no_finish_reglement", 0); $type_date_search = CValue::getOrSession("type_date_search", "ouverture"); $chirSel = CValue::getOrSession("chirSel", "-1"); $num_facture = CValue::getOrSession("num_facture"); $numero = CValue::getOrSession("numero", 0); $search_easy = CValue::getOrSession("search_easy", 0); $xml_etat = CValue::getOrSession("xml_etat", ""); $page = CValue::get("page", "0"); // Liste des chirurgiens $user = new CMediusers(); $listChir = $user->loadPraticiens(PERM_EDIT); //Patient sélectionné $patient = new CPatient(); $patient->load($patient_id); $ljoin = array(); $where = array(); $where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'"; if ($etat_relance || $search_easy == 7) { $ljoin["facture_relance"] = "facture_relance.object_id = facture_etablissement.facture_id"; $where["facture_relance.object_class"] = " = 'CFactureEtablissement'"; } $where["{$type_date_search}"] = "BETWEEN '{$date_min}' AND '{$date_max}'"; if (($etat_cloture == "1" || $search_easy == 3) && $type_date_search != "cloture") { $where["cloture"] = "IS NULL"; } elseif (($etat_cloture == "2" || $search_easy == 2) && $type_date_search != "cloture") { $where["cloture"] = "IS NOT NULL"; } if ($no_finish_reglement || $search_easy == 6) {
$where = array(); $where[] = "`nom` LIKE '{$nom}%' OR `nom_jeune_fille` LIKE '{$nom}%'"; $where["prenom"] = "LIKE '{$prenom}%'"; $where["nom"] = "LIKE '{$nom}%'"; if ($sexe != "") { $where["sexe"] = "= '{$sexe}'"; } /*if ($IPP) { /*$patient = new CPatient; $patient->_IPP = $patient_ipp; $patient->loadFromIPP(); }*/ $order = "nom, prenom, naissance"; $step = 30; $limit = "{$page}, {$step}"; $patient = new CPatient(); $patient->nom = $nom; $patient->prenom = $prenom; $patient->nom_jeune_fille = $nom_jeune_fille; $patient->sexe = $sexe; //$patient->_IPP = $IPP; $nb_pat = $patient->countList($where); /** @var CPatient[] $patients CPatient[] */ $patients = $patient->loadList($where, $order, $limit); CPatient::massLoadIPP($patients); foreach ($patients as $_patient) { $_patient->loadFirstLog()->loadRefUser(); } $smarty = new CSmartyDP(); $smarty->assign("patient", $patient); $smarty->assign("patients", $patients);
/** * $Id$ * * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkEdit(); $patient_id = CValue::get("patient_id"); $type = CValue::get("type"); $antecedent_id = CValue::get("antecedent_id"); $callback = CValue::get('callback', 0); $patient = new CPatient(); $patient->load($patient_id); $antecedents = array(); if ($type) { $dossier_medical = $patient->loadRefDossierMedical(); /** @var CAntecedent[] $antecedents */ $antecedents = $dossier_medical->loadRefsAntecedentsOfType($type); foreach ($antecedents as $_antecedent) { $_antecedent->updateOwnerAndDates(); } } $antecedent = new CAntecedent(); $antecedent->load($antecedent_id); $smarty = new CSmartyDP(); $smarty->assign("patient", $patient); $smarty->assign("antecedents", $antecedents);
<?php /** * $Id$ * * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $patient_id = CValue::post('patient_id'); $patient = new CPatient(); if (!$patient->load($patient_id)) { CAppUI::stepAjax("Chargement impossible du patient", UI_MSG_ERROR); } $patient->patient_link_id = ""; if ($msg = $patient->store()) { CAppUI::stepAjax("Association du patient impossible : {$msg}", UI_MSG_ERROR); } CAppUI::stepAjax("{$patient->_view} désassocié"); CApp::rip();
} else { $host = CConstantesMedicales::guessHost($context); } $show_cat_tabs = CConstantesMedicales::getHostConfig("show_cat_tabs", $host); $show_enable_all_button = CConstantesMedicales::getHostConfig("show_enable_all_button", $host); $dates = array(); if (!$selection) { $selection = CConstantesMedicales::getConstantsByRank('form', true, $host); } else { $selection = CConstantesMedicales::selectConstants($selection, 'form'); } foreach (CConstantesMedicales::$list_constantes as $key => $cst) { $dates["{$key}"] = CMbDT::format(null, '%d/%m/%y'); } $patient_id = $constantes->patient_id ? $constantes->patient_id : $patient_id; $patient = CPatient::loadFromGuid("CPatient-{$patient_id}"); $patient->loadRefLatestConstantes(null, array("poids", "taille"), null, false); $constantes = new CConstantesMedicales(); $constantes->load($const_id); $constantes->loadRefContext(); $constantes->loadRefPatient(); $constantes->updateFormFields(); // Pour forcer le chargement des unités lors de la saisie d'une nouvelle constante if ($context) { $constantes->patient_id = $patient_id; $constantes->context_class = $context->_class; $constantes->context_id = $context->_id; } $modif_timeout = intval(CAppUI::conf("dPpatients CConstantesMedicales constants_modif_timeout", $host->_guid)); $can_create = $perms->edit; if ($perms->edit && $constantes->_id && $modif_timeout > 0 && time() - strtotime($constantes->datetime) > $modif_timeout * 3600) {
$sejour = new CSejour(); $where = array(); $where["entree"] = "< '{$next}'"; $where["sortie"] = "> '{$date}'"; $where["group_id"] = "= '{$group->_id}'"; $where["annule"] = "= '0'"; $order = array(); $order[] = "sortie"; $order[] = "entree"; $step = 30; $limit = "{$page},{$step}"; /** @var CSejour[] $listSejours */ $count = $sejour->countList($where); $listSejours = $sejour->loadList($where, $order, $limit); $patients = CSejour::massLoadFwdRef($listSejours, "patient_id"); $ipps = CPatient::massLoadIPP($patients); $ndas = CSejour::massLoadNDA($listSejours); $praticiens = CSejour::massLoadFwdRef($listSejours, "praticien_id"); CMediusers::massLoadFwdRef($praticiens, "function_id"); CSejour::massLoadFwdRef($listSejours, "group_id"); CSejour::massLoadFwdRef($listSejours, "etablissement_sortie_id"); CSejour::massLoadFwdRef($listSejours, "service_sortie_id"); CSejour::massLoadFwdRef($listSejours, "service_sortie_id"); foreach ($listSejours as $_sejour) { $_sejour->_ref_patient = $patients[$_sejour->patient_id]; $_sejour->loadRefPraticien(); $_sejour->loadExtCodesCCAM(); $_sejour->loadRefsFactureEtablissement(); $_sejour->countActes(); $_sejour->loadRefTraitementDossier(); }
/** * import the patient file * * @param string $file path to the file * @param int $start start int * @param int $count number of iterations * @param resource $file_import file for report * * @return null */ function importFile($file, $start, $count, $file_import) { $fp = fopen($file, 'r'); $csv_file = new CCSVFile($fp); $csv_file->column_names = $csv_file->readLine(); if ($start == 0) { $start++; } elseif ($start > 1) { $csv_file->jumpLine($start); } $group_id = CGroups::loadCurrent()->_id; $treated_line = 0; while ($treated_line < $count) { $treated_line++; $patient = new CPatient(); $_patient = $csv_file->readLine(true); if (!$_patient) { CAppUI::stepAjax('Importation terminée', UI_MSG_OK); CApp::rip(); } $patient->bind($_patient); $patient->loadFromIPP($group_id); if ($patient->_id) { $start++; continue; } $nom = $_patient['nom'] ? $_patient['nom'] : $_patient['nom_jeune_fille']; if (!$patient->nom) { if ($patient->nom_jeune_fille) { $patient->nom = $patient->nom_jeune_fille; } else { CMbDebug::log("Ligne #{$start} : Pas de nom"); $start++; continue; } } $naissance = null; if ($patient->naissance) { $naissance = preg_replace('/(\\d{2})\\/(\\d{2})\\/(\\d{4})/', '\\3-\\2-\\1', $patient->naissance); $patient->naissance = $naissance; } $patient->repair(); if (!$patient->naissance) { CMbDebug::log($_patient); CMbDebug::log("Ligne #{$start} : Date de naissance invalide ({$_patient['naissance']})"); $start++; continue; } $patient->loadMatchingPatient(); if (!$patient->_id) { $patient->bind($_patient); $patient->nom = $nom; $patient->naissance = $naissance; $patient->tel = preg_replace("/[^0-9]/", "", $patient->tel); $patient->tel_autre = preg_replace("/[^0-9]/", "", $patient->tel_autre); $patient->sexe = strtolower($patient->sexe); $patient->repair(); if ($msg = $patient->store()) { CMbDebug::log($patient, null, true); CMbDebug::log("Ligne #{$start} :{$msg}"); $start++; continue; } } $ipp = CIdSante400::getMatch($patient->_class, CPatient::getTagIPP($group_id), $patient->_IPP, $patient->_id); if ($ipp->_id && $ipp->id400 != $patient->_IPP) { CMbDebug::log("Ligne #{$start} : Ce patient possède déjà un IPP ({$ipp->id400})"); $start++; continue; } if (!$ipp->_id) { if ($msg = $ipp->store()) { CMbDebug::log("Ligne #{$start} :{$msg}"); $start++; continue; } } CAppUI::setMsg('CPatient-msg-create', UI_MSG_OK); } echo CAppUI::getMsg(); }
/** * Vérifier si les patients sont similaires * * @param CPatient $mbPatient Patient * @param DOMNode $xmlPatient Patient provenant des données XML * * @return string */ function checkSimilarPatient(CPatient $mbPatient, $xmlPatient) { $sender = $this->_ref_sender; if (!$sender->_configs || isset($sender->_configs) && array_key_exists("check_similar", $sender->_configs) && !$sender->_configs["check_similar"]) { return null; } $xpath = new CHPrimXPath($xmlPatient->ownerDocument); // Création de l'element personnePhysique $personnePhysique = $xpath->queryUniqueNode("hprim:personnePhysique", $xmlPatient); $nom = $xpath->queryTextNode("hprim:nomUsuel", $personnePhysique); $prenoms = $xpath->getMultipleTextNodes("hprim:prenoms/*", $personnePhysique); $prenom = CMbArray::get($prenoms, 0); $commentaire = null; if (!$mbPatient->checkSimilar($nom, $prenom)) { $commentaire = "Le nom ({$nom}/{$mbPatient->nom}) et/ou le prénom ({$prenom}/{$mbPatient->prenom}) sont très différents."; } return $commentaire; }
<?php /** * $Id$ * * @package Mediboard * @subpackage Labo * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkRead(); $examen = new CExamenLabo(); $examen->load(CValue::get("examen_id")); $patient = new CPatient(); $patient->load(CValue::get("patient_id")); $item = new CPrescriptionLaboExamen(); $resultats = $item->loadResults($patient->_id, $examen->_id, 20); // Création du graph $graph = new CResultatsLaboGraph($patient, $examen, $resultats); $graph->Stroke();
/** * Get patient * * @return CPatient */ function loadRefPatient() { $this->_ref_patient = new CPatient(); $this->_ref_patient = $this->_ref_patient->getCached($this->patient_id); }
if ($chir->isPraticien() and !$chir_id) { $chir_id = $chir->user_id; } // Chargement du praticien $chir = new CMediusers(); if ($chir_id) { $testChir = new CMediusers(); $testChir->load($chir_id); if ($testChir->isPraticien()) { $chir = $testChir; } } $chir->loadRefFunction(); $prat = $chir; // Chargement du patient $patient = new CPatient(); if ($patient_id && !$operation_id && !$sejour_id) { $patient->load($patient_id); $patient->loadRefsSejours(); } // On récupère le séjour $sejour = new CSejour(); if ($sejour_id && !$operation_id) { $sejour->load($sejour_id); CAccessMedicalData::checkForSejour($sejour); $sejour->loadRefsFwd(); $sejour->loadRefCurrAffectation()->loadRefService(); if (!$chir_id) { $chir = $sejour->_ref_praticien; } // On ne change a priori pas le praticien du séjour
if ($isolement) { $ljoin["sejour"] = "sejour.sejour_id = affectation.sejour_id"; $where["isolement"] = "= '1'"; } if ($item_prestation_id && $prestation_id) { if (isset($items_prestation[$item_prestation_id])) { $ljoin["item_liaison"] = "affectation.sejour_id = item_liaison.sejour_id"; $where["item_liaison.item_souhait_id"] = " = '{$item_prestation_id}'"; } } $affectation = new CAffectation(); $affectations = $affectation->loadList($where, $order, null, null, $ljoin); $_sejours = CStoredObject::massLoadFwdRef($affectations, "sejour_id"); $services = $services + CStoredObject::massLoadFwdRef($affectations, "service_id"); $patients = CStoredObject::massLoadFwdRef($_sejours, "patient_id"); CPatient::massCountPhotoIdentite($patients); foreach ($affectations as $_affectation_imc) { /* @var CAffectation $_affectation_imc*/ if (CAppUI::conf("dPhospi vue_temporelle show_imc_patient", "CService-" . $_affectation_imc->service_id)) { $_affectation_imc->loadRefSejour()->loadRefPatient()->loadRefLatestConstantes(null, array("poids", "taille")); } } // Préchargement des users $user = new CUser(); $where = array("user_id" => CSQLDataSource::prepareIn(CMbArray::pluck($_sejours, "praticien_id"))); $users = $user->loadList($where); $praticiens = CStoredObject::massLoadFwdRef($_sejours, "praticien_id"); CStoredObject::massLoadFwdRef($praticiens, "function_id"); CStoredObject::massCountBackRefs($affectations, "affectations_enfant"); $_operations = CStoredObject::massLoadBackRefs($sejours, "operations", "date ASC"); CStoredObject::massLoadFwdRef($_operations, "plageop_id");
<?php /** * $Id: ajax_list_assurances.php 19840 2013-07-09 19:36:14Z phenxdesign $ * * @package Mediboard * @subpackage PlanningOp * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 19840 $ */ CCanDo::checkRead(); $sejour_id = CValue::get("sejour_id"); $patient_id = CValue::get("patient_id"); // Chargement du patient $patient = new CPatient(); $patient->load($patient_id); $patient->loadRefsCorrespondantsPatient(); // On récupére le séjour $sejour = new CSejour(); if ($sejour_id) { $sejour->load($sejour_id); // On vérifie que l'utilisateur a les droits sur le sejour if (!$sejour->_canRead) { global $m, $tab; CAppUI::setMsg("Vous n'avez pas accés à ce séjour", UI_MSG_WARNING); CAppUI::redirect("m={$m}&tab={$tab}&sejour_id=0"); } $patient = $sejour->_ref_patient; } else { $sejour->patient_id = $patient->_id;
$this->redirectStore .= "&patient_id={$patient_id}&created={$patient_id}"; } elseif ($dialog) { $this->redirectStore .= "&name=" . $this->_obj->nom . "&firstname=" . $this->_obj->prenom; } } } $do = new CDoPatientMerge(); $patient1_id = CValue::post("patient1_id"); $patient2_id = CValue::post("patient2_id"); $base_object_id = CValue::post("_base_object_id"); // Erreur sur les ID du patient $patient1 = new CPatient(); if (!$patient1->load($patient1_id)) { $do->errorRedirect("Patient 1 n'existe pas ou plus"); } $patient2 = new CPatient(); if (!$patient2->load($patient2_id)) { $do->errorRedirect("Patient 2 n'existe pas ou plus"); } if (intval(CValue::post("del"))) { $do->errorRedirect("Fusion en mode suppression impossible"); } $patients = array($patient1, $patient2); if ($base_object_id) { $do->_obj->load($base_object_id); foreach ($patients as $key => $patient) { if ($base_object_id == $patient->_id) { unset($patients[$key]); unset($_POST["_merging"][$base_object_id]); } }