/** * Generate content message * * @param CSejour $sejour Admit * * @return void */ function generateFromOperation(CSejour $sejour) { $evenementsServeurEtatsPatient = $this->documentElement; // Ajout du patient $mbPatient = $sejour->loadRefPatient(); $patient = $this->addElement($evenementsServeurEtatsPatient, "patient"); $this->addPatient($patient, $mbPatient, false, true); // Ajout de la venue, c'est-à-dire le séjour $venue = $this->addElement($evenementsServeurEtatsPatient, "venue"); $this->addVenue($venue, $sejour, false, true); $dateObservation = $this->addElement($evenementsServeurEtatsPatient, "dateObservation"); $this->addDateHeure($dateObservation, CMbDT::dateTime()); // Ajout des diagnostics $Diagnostics = $this->addElement($evenementsServeurEtatsPatient, "Diagnostics"); $this->addDiagnosticsEtat($Diagnostics, $sejour); // Traitement final $this->purgeEmptyElements(); }
// Fichiers et documents des interventions $interventions = $sejour->_ref_operations; foreach ($interventions as $_interv) { $_interv->loadRefPlageOp(); $_interv->loadRefsDocItems(false); } // Fichiers et documents des consultations $consultations = $sejour->loadRefsConsultations(); foreach ($consultations as $_consult) { $_consult->loadRefsDocItems(false); } $sejour->_ref_consult_anesth->_ref_consultation->loadRefsDocItems(false); $sejour->_ref_consult_anesth->loadRefsDocItems(false); } // Chargement du patient $patient = $sejour->loadRefPatient(); $patient->loadComplete(); $patient->loadIPP(); // Chargement du dossier medical $dossier_medical = $patient->_ref_dossier_medical; $dossier_medical->canRead(); $dossier_medical->countAntecedents(); $dossier = array(); $list_lines = array(); if (CModule::getActive("dPprescription")) { // Chargement du dossier de soins cloturé $prescription = $sejour->loadRefPrescriptionSejour(); // Chargement des lignes $prescription->loadRefsLinesMedComments("1", "1", "1", "", "", "0", "1"); $prescription->loadRefsLinesElementsComments("1"); $prescription->loadRefsPrescriptionLineMixes("", "1");
/** * 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); }
/** * Récupération du segment IN1 * * @param DOMNode $node Node * @param CSejour $newVenue Admit * * @return void */ function getIN1(DOMNode $node, CSejour $newVenue) { if (!$newVenue->_id) { return; } $IN1_2 = $this->queryTextNode("IN1.2/CE.1", $node); if ($IN1_2 != "AMO") { return; } $sender = $this->_ref_sender; $patient = $newVenue->loadRefPatient(); // AMO $IN1_3_1 = $this->queryTextNode("IN1.3/CX.1", $node); if ($IN1_3_1 != "") { $patient->code_regime = substr($IN1_3_1, 0, 2); $patient->caisse_gest = substr($IN1_3_1, 2, 3); $patient->centre_gest = substr($IN1_3_1, -4); } $IN1_3_6 = $this->queryTextNode("IN1.3/CX.6/HD.1", $node); $patient->notes_amo .= " {$IN1_3_6}"; $IN1_12 = $this->queryTextNode("IN1.12", $node); if ($IN1_12) { $patient->deb_amo = CMbDT::date($IN1_12); } $IN1_13 = $this->queryTextNode("IN1.13", $node); if ($IN1_13) { $patient->fin_amo = CMbDT::date($IN1_13); } $patient->code_exo = $this->queryTextNode("IN1.15", $node); $IN1_49 = $this->queryTextNode("IN1.49/CX.1", $node); if ($IN1_49 != "") { $patient->matricule = $IN1_49; } // Notifier les autres destinataires autre que le sender $patient->_eai_sender_guid = $sender->_guid; if ($msg = $patient->store()) { $patient->repair(); $patient->_eai_sender_guid = $sender->_guid; $patient->store(); } }
if ($object->load($operation_id)) { $object->loadRefSejour(); $mbSejour = $object->_ref_sejour; $mbSejour->loadNDA(); $NDA = $mbSejour->_NDA; $mbSejour->loadRefPatient(); $mbSejour->_ref_patient->loadIPP(); $IPP = $mbSejour->_ref_patient->_IPP; } break; case "CSejour": $object = new CSejour(); // Chargement du séjour et génération du document $sejour_id = CValue::post("mb_sejour_id", CValue::getOrSession("object_id")); if ($object->load($sejour_id)) { $object->loadRefPatient(); $object->loadRefDossierMedical(); $object->loadNDA(); $NDA = $object->_NDA; $object->_ref_patient->loadIPP(); $IPP = $object->_ref_patient->_IPP; } break; default: // Nothing to do } $object->countExchanges("pmsi", "evenementServeurActe"); // Création du template $smarty = new CSmartyDP(); $smarty->assign("canUnlockActes", $canUnlockActes); $smarty->assign("object", $object);
*/ CCanDo::checkRead(); $sejour_id = CValue::get("sejour_id"); $date = CValue::getOrSession("date", CMbDT::date()); $date_actuelle = CMbDT::dateTime("00:00:00"); $date_demain = CMbDT::dateTime("00:00:00", "+ 1 day"); $hier = CMbDT::date("- 1 day", $date); $demain = CMbDT::date("+ 1 day", $date); $date_min = CMbDT::dateTime("00:00:00", $date); $date_max = CMbDT::dateTime("23:59:59", $date); $sejour = new CSejour(); $sejour->load($sejour_id); // Chargenemt du praticien $sejour->loadRefPraticien(); // Chargement du patient $sejour->loadRefPatient(1)->loadIPP(); // Chargment du numéro de dossier $sejour->loadNDA(); // Chargements des notes sur le séjour $sejour->loadRefsNotes(); // Chargement des prestations $sejour->countPrestationsSouhaitees(); // Chargement des appels $sejour->loadRefsAppel('sortie'); // Chargement des interventions $whereOperations = array("annulee" => "= '0'"); $sejour->loadRefsOperations($whereOperations); foreach ($sejour->_ref_operations as $operation) { $operation->loadRefsActes(); } // Chargement des affectation
$_show_const = CValue::getOrSession("_show_const", 0); $show_header = CValue::getOrSession("show_header", 0); if ($cible != "") { $_show_obs = $_show_const = 0; } $cible = stripslashes($cible); $cibles = array("opened" => array(), "closed" => array()); $last_trans_cible = array(); $users = array(); // Chargement du sejour $sejour = new CSejour(); $sejour->load($sejour_id); $sejour->loadSuiviMedical(null, $cible, $cibles, $last_trans_cible, $user_id, $users); $sejour->loadRefPraticien(); if ($show_header) { $sejour->loadRefPatient()->loadRefPhotoIdentite(); } $sejour->loadRefPrescriptionSejour(); $prescription =& $sejour->_ref_prescription_sejour; $is_praticien = $user->isPraticien(); $has_obs_entree = 0; //TODO: Revoir l'ajout des constantes dans le suivi de soins //Ajout des constantes $group_guid = CGroups::loadCurrent()->_guid; if (!$cible && CAppUI::conf("soins CConstantesMedicales constantes_show", $group_guid) && $_show_const) { $sejour->loadRefConstantes($user_id); } //mettre les transmissions dans un tableau dont l'index est le datetime $list_trans_const = array(); $forms_active = CModule::getActive("forms"); CExObject::$_load_lite = true;
/** * Enregistrement des interventions * * @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) { $operation = $mbObject; $exchange_hprim = $this->_ref_echange_hprim; $sender = $exchange_hprim->_ref_sender; $sender->loadConfigValues(); $this->_ref_sender = $sender; $warning = null; $comment = null; // 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); } // 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); } // 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); } // 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); } // Chargement du patient du séjour $sejour->loadRefPatient(); $operation->sejour_id = $sejour->_id; // Mapping du séjour $sejour = $this->mappingVenue($data['venue'], $sejour); // Notifier les autres destinataires autre que le sender $sejour->_eai_sender_guid = $sender->_guid; /* TODO Supprimer ceci après l'ajout des times picker */ $sejour->_hour_entree_prevue = null; $sejour->_min_entree_prevue = null; $sejour->_hour_sortie_prevue = null; $sejour->_min_sortie_prevue = null; if ($msgVenue = $sejour->store()) { return $exchange_hprim->setAck($dom_acq, "A102", $msgVenue, null, $sejour); } // idex de l'intervention $idex = CIdSante400::getMatch("COperation", $sender->_tag_hprimxml, $data['idSourceIntervention']); if ($idex->_id) { $operation_source = new COperation(); $operation_source->load($idex->object_id); if ($operation_source->sejour_id != $sejour->_id) { return $exchange_hprim->setAckError($dom_acq, "E204", null, $mbObject); } $operation = $operation_source; } // ID Mediboard de l'intervention if ($data['idCibleIntervention']) { $operation_source = new COperation(); $operation_source->load($data['idCibleIntervention']); if ($operation_source->sejour_id != $sejour->_id) { return $exchange_hprim->setAckError($dom_acq, "E204", null, $mbObject); } if ($idex->_id && $operation->_id != $operation_source->_id) { return $exchange_hprim->setAckError($dom_acq, "E205", null, $mbObject); } $operation = $operation_source; } // Recherche de la salle $salle = $this->getSalle($data['intervention'], $sejour); if ($salle->nom && !$salle->_id) { $comment = "Salle '{$salle->nom}' inconnue dans l'infrastructure de l'établissement"; return $exchange_hprim->setAckError($dom_acq, "E202", $comment, $mbObject); } $operation->salle_id = $salle->_id; // Mapping du chirurgien $mediuser = $this->getParticipant($data['intervention'], $sejour); if ($mediuser->adeli && !$mediuser->_id || !$mediuser->adeli) { $comment = $mediuser->adeli ? "Participant '{$mediuser->adeli}' inconnu" : "Le code ADELI n'est pas renseigné"; return $exchange_hprim->setAckError($dom_acq, "E203", $comment, $mbObject); } $operation->chir_id = $mediuser->_id; // Mapping de la plage $this->mappingPlage($data['intervention'], $operation); $plageop_id = $operation->plageop_id; // Recherche d'une intervention existante sinon création if (!$operation->_id) { $operation->loadMatchingObject(); } // Si pas trouvé on recherche en hors plage if (!$operation->_id) { $operation->loadRefPlageOp(); $operation->plageop_id = null; $operation->temp_operation = null; $operation->time_operation = null; $operation->date = $operation->_ref_plageop->_id ? $operation->_ref_plageop->date : $operation->date; if ($operation->countMatchingList() == 1) { $operation->loadMatchingObject(); } if (!$operation->_id && $plageop_id) { $operation->plageop_id = $plageop_id; $operation->date = null; } } // Mapping de l'intervention $this->mappingIntervention($data, $operation); // Store de l'intervention // Notifier les autres destinataires autre que le sender $operation->_eai_sender_guid = $sender->_guid; $msgInterv = $operation->store(); CEAIMbObject::storeIdex($idex, $operation, $sender); $modified_fields = CEAIMbObject::getModifiedFields($operation); $codes = array($msgInterv ? "A201" : "I201"); if ($msgInterv) { $warning .= $msgInterv . " "; } else { $comment .= "Intervention : {$operation->_id}."; $comment .= $modified_fields ? " Les champs mis à jour sont les suivants : {$modified_fields}." : null; } return $exchange_hprim->setAck($dom_acq, $codes, $warning, $comment, $operation); }
$rang = CValue::post("rang"); $date_naissance = CValue::post("naissance"); $nom = CValue::post("nom"); $prenom = CValue::post("prenom"); $poids = CValue::post("poids"); $taille = CValue::post("taille"); $num_naissance = CValue::post("num_naissance"); $fausse_couche = CValue::post("fausse_couche"); $rques = CValue::post("rques"); $constantes_id = CValue::post("constantes_medicales_id"); $sejour_maman_id = CValue::post("sejour_maman_id"); $perimetre_cranien = CValue::post("perimetre_cranien"); $callback = CValue::post("callback"); $sejour = new CSejour(); $sejour->load($sejour_maman_id); $parturiente = $sejour->loadRefPatient(); $grossesse = $sejour->loadRefGrossesse(); $curr_affect = $sejour->loadRefCurrAffectation(); $datetime = CMbDT::dateTime(); $date = CMbDT::date($datetime); /** * Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message * * @param CMbObject $object Objet à enregister * * @return void */ function storeObject($object) { $title = $object->_id ? "-msg-modify" : "-msg-create"; if ($msg = $object->store()) {
/** * Prepare the data to send from the given sejour * * @param CSejour $sejour The sejour * @param string $encoding The encoding * @param string $modality The target modality * @param string $calling_ae_title The AE title who requested the worklist * @param CDicomConfig $dicom_config The Exchange Dicom * * @return array */ protected function getDataFromSejour($sejour, $encoding, $modality, $calling_ae_title, $dicom_config) { $libelle = ''; $date = ''; $time = ''; $patient = $sejour->loadRefPatient(); $sejour->updateFormFields(); $operation = $sejour->loadRefCurrOperation(CMbDT::dateTime()); if ($operation->_id) { $operation->updateFormFields(); $operation->loadRefPlageOp(); if ($operation->libelle) { $libelle = substr($operation->libelle, 0, 64); } else { $libelle = 'Pas de libellé'; } if ($operation->date) { $date = str_replace('-', '', $operation->date); } else { $date = str_replace('-', '', $operation->_ref_plageop->date); } if ($operation->time_operation) { $time = str_replace(':', '', $operation->time_operation) . '.000000'; } else { $time = str_replace(':', '', CMbDT::time()) . '.000000'; } } else { $libelle = "Pas de libellé"; $date = str_replace('-', '', CMBDT::date()); $time = str_replace(':', '', CMbDT::time()) . '.000000'; } $chir = $sejour->loadRefPraticien(); $patient->loadIPP(); $sejour->loadNDA(); $sejour_id = $sejour->_id; if ($sejour->_NDA) { $sejour_id = $sejour->_NDA; } $patient_id = $patient->_id; if ($patient->_IPP) { $patient_id = $patient->_IPP; } $age = intval(substr(trim($patient->_age), 0, 2)); $chir_name = "{$chir->_user_last_name} {$chir->_user_first_name}"; $data = array(0x8 => array(0x50 => self::encodeValue($sejour_id, $encoding)), 0x10 => array(0x10 => self::encodeValue("{$patient->nom}^{$patient->prenom}", $encoding), 0x20 => self::encodeValue("{$patient_id}", $encoding), 0x30 => self::encodeValue(str_replace("-", "", $patient->naissance), $encoding), 0x40 => self::encodeValue(strtoupper($patient->sexe), $encoding)), 0x20 => array(0xd => self::encodeValue($sejour_id, $encoding)), 0x38 => array(0x10 => self::encodeValue($sejour_id, $encoding)), 0x40 => array(0x100 => array(array(array("group_number" => 0x8, "element_number" => 0x60, "value" => self::encodeValue($modality, $encoding)), array("group_number" => 0x40, "element_number" => 0x1, "value" => self::encodeValue($calling_ae_title, $encoding)), array("group_number" => 0x40, "element_number" => 0x2, "value" => self::encodeValue($date, $encoding)), array("group_number" => 0x40, "element_number" => 0x3, "value" => self::encodeValue($time, $encoding)), array("group_number" => 0x40, "element_number" => 0x6, "value" => self::encodeValue($chir_name, $encoding)), array("group_number" => 0x40, "element_number" => 0x7, "value" => self::encodeValue($libelle, $encoding)), array("group_number" => 0x40, "element_number" => 0x9, "value" => self::encodeValue($sejour_id, $encoding)))), 0x1001 => self::encodeValue($sejour_id, $encoding))); /* We add the field 0x0032,0x1032 if it's configured */ if ($dicom_config->send_0032_1032) { if (!array_key_exists(0x32, $data)) { $data[0x32] = array(); } $data[0x32][0x1032] = self::encodeValue($chir_name, $encoding); /* Add the field into the sequence of item 0x0040,0x0100 */ /*$data[0x0040][0x0100][0][] = array( "group_number" => 0x0032, "element_number" => 0x1032, "value" => self::encodeValue($chir_name, $encoding) );*/ } return $data; }
foreach ($sejours as $_sejour) { if ($module == "dPurgences") { // Look for multiple RPU // Simulate loading as for now loading RPU are outrageously resource consuming // @todo use loadBackRef() as soon as CRPU.updateFormFields() get sanitized $_sejour->_back["rpu"] = array(); foreach ($_sejour->loadBackIds("rpu") as $_rpu_id) { $rpu = new CRPU(); $rpu->_id = $_rpu_id; $_sejour->_back["rpu"][$rpu->_id] = $rpu; } } // Chargement du numero de dossier $_sejour->loadNDA(); // Chargement de l'IPP $_sejour->loadRefPatient(); // Classement par patient if (!isset($patients[$_sejour->patient_id])) { //Cas des patients anonymes où un loadrefSejour est fait $_sejour->_ref_patient->_ref_sejours = array(); $patients["{$_sejour->patient_id}"] = $_sejour->_ref_patient; } $patients["{$_sejour->patient_id}"]->_ref_sejours[$_sejour->_id] = $_sejour; } // Chargement des détails sur les patients $mergeables_count = 0; foreach ($patients as $patient_id => $patient) { $patient->loadIPP(); $guess = array(); $nicer = array(); $guess["mergeable"] = isset($guesses[$patient_id]) ? true : false;