function addIntervention($elParent, COperation $operation, $referent = null, $light = false) { $identifiant = $this->addElement($elParent, "identifiant"); $this->addElement($identifiant, "emetteur", $operation->_id); $last_idex = $operation->_ref_last_id400; if (isset($last_idex->_id)) { $this->addElement($identifiant, "recepteur", $last_idex->id400); } $sejour = $operation->loadRefSejour(); if (!$operation->plageop_id) { $operation->completeField("date"); } // Calcul du début de l'intervention $mbOpDate = CValue::first($operation->_ref_plageop->date, $operation->date); $time_operation = $operation->time_operation == "00:00:00" ? null : $operation->time_operation; $mbOpHeureDebut = CValue::first($operation->debut_op, $operation->entree_salle, $time_operation, $operation->horaire_voulu, $operation->_ref_plageop->debut); $mbOpDebut = CMbRange::forceInside($sejour->entree, $sejour->sortie, "{$mbOpDate} {$mbOpHeureDebut}"); // Calcul de la fin de l'intervention $mbOpHeureFin = CValue::first($operation->fin_op, $operation->sortie_salle, CMbDT::addTime($operation->temp_operation, CMbDT::time($mbOpDebut))); $mbOpFin = CMbRange::forceInside($sejour->entree, $sejour->sortie, "{$mbOpDate} {$mbOpHeureFin}"); $debut = $this->addElement($elParent, "debut"); $this->addElement($debut, "date", CMbDT::date($mbOpDebut)); $this->addElement($debut, "heure", CMbDT::time($mbOpDebut)); $fin = $this->addElement($elParent, "fin"); $this->addElement($fin, "date", CMbDT::date($mbOpFin)); $this->addElement($fin, "heure", CMbDT::time($mbOpFin)); if ($light) { // Ajout des participants $mbParticipants = array(); foreach ($operation->_ref_actes_ccam as $acte_ccam) { $acte_ccam->loadRefExecutant(); $mbParticipant = $acte_ccam->_ref_executant; $mbParticipants[$mbParticipant->user_id] = $mbParticipant; } $participants = $this->addElement($elParent, "participants"); foreach ($mbParticipants as $mbParticipant) { $participant = $this->addElement($participants, "participant"); $medecin = $this->addElement($participant, "medecin"); $this->addProfessionnelSante($medecin, $mbParticipant); } // Libellé de l'opération $this->addTexte($elParent, "libelle", $operation->libelle, 80); } else { $this->addUniteFonctionnelle($elParent, $operation); // Uniquement le responsable de l’'intervention $participants = $this->addElement($elParent, "participants"); $participant = $this->addElement($participants, "participant"); $medecin = $this->addElement($participant, "medecin"); $this->addProfessionnelSante($medecin, $operation->loadRefChir()); // Libellé de l'opération $this->addTexte($elParent, "libelle", $operation->libelle, 4000); // Remarques sur l'opération $this->addTexte($elParent, "commentaire", CMbString::convertHTMLToXMLEntities("{$operation->materiel} - {$operation->rques}"), 4000); // Conventionnée ? $this->addElement($elParent, "convention", $operation->conventionne ? 1 : 0); // TypeAnesthésie : nomemclature externe (idex) if ($operation->type_anesth) { $tag_hprimxml = $this->_ref_receiver->_tag_hprimxml; $idexTypeAnesth = CIdSante400::getMatch("CTypeAnesth", $tag_hprimxml, null, $operation->type_anesth); $this->addElement($elParent, "typeAnesthesie", $idexTypeAnesth->id400); } // Indicateurs $indicateurs = $this->addElement($elParent, "indicateurs"); $dossier_medical = new CDossierMedical(); $dossier_medical->object_class = "CPatient"; $dossier_medical->object_id = $operation->loadRefPatient()->_id; $dossier_medical->loadMatchingObject(); $antecedents = $dossier_medical->loadRefsAntecedents(); foreach ($antecedents as $_antecedent) { $rques = CMbString::htmlspecialchars($_antecedent->rques); $rques = CMbString::convertHTMLToXMLEntities($rques); $this->addCodeLibelle($indicateurs, "indicateur", $_antecedent->_id, $rques); } // Extemporané if ($operation->exam_extempo) { $this->addCodeLibelle($indicateurs, "indicateur", "EXT", "Extemporané"); } // Recours / Durée USCPO $this->addElement($elParent, "recoursUscpo", $operation->duree_uscpo ? 1 : 0); $this->addElement($elParent, "dureeUscpo", $operation->duree_uscpo ? $operation->duree_uscpo : null); // Côté (droit|gauche|bilatéral|total|inconnu) // D - Droit // G - Gauche // B - Bilatéral // T - Total // I - Inconnu $cote = array("droit" => "D", "gauche" => "G", "bilatéral" => "B", "total" => "T", "inconnu" => "I", "haut" => "HT", "bas" => "BS"); $this->addCodeLibelle($elParent, "cote", $cote[$operation->cote], CMbString::capitalize($operation->cote)); } }