Exemple #1
0
 /**
  * @see parent::completeLabelFields()
  */
 function completeLabelFields(&$fields, $params)
 {
     if (!isset($this->_from_op)) {
         $this->loadRefLastOperation()->_from_sejour = 1;
         $this->_ref_last_operation->completeLabelFields($fields, $params);
     }
     $this->loadRefPatient()->completeLabelFields($fields, $params);
     $this->loadRefPraticien();
     $this->loadNDA();
     $this->loadNRA();
     $now = CMbDT::dateTime();
     $affectation = $this->getCurrAffectation($this->entree > $now ? $this->entree : null);
     $affectation->loadView();
     $affectation->loadRefService();
     $souhaits = array();
     if (CAppUI::conf("dPhospi prestations systeme_prestations", CGroups::loadCurrent()) == "expert") {
         /** @var CItemLiaison[] $items_liaisons */
         $items_liaisons = $this->loadBackRefs("items_liaisons", "date");
         CStoredObject::massLoadFwdRef($items_liaisons, "item_souhait_id");
         CStoredObject::massLoadFwdRef($items_liaisons, "sous_item_id");
         foreach ($items_liaisons as $_liaison) {
             $item_souhait = $_liaison->loadRefItem();
             if ($item_souhait->object_class == "CPrestationPonctuelle") {
                 continue;
             }
             $sous_item = $_liaison->loadRefSousItem();
             $nom = $item_souhait;
             if ($sous_item->_id) {
                 $nom = $sous_item->nom;
             }
             $souhaits[] = $nom;
         }
     }
     $meds_dispenses = array();
     if (isset($params["debut_dispensation"]) && isset($params["fin_dispensation"])) {
         $from = $params["debut_dispensation"];
         $to = $params["fin_dispensation"];
         $delivery = new CProductDelivery();
         $where = array("date_dispensation" => "BETWEEN '{$from}' AND '{$to}'", "sejour_id" => "= '{$this->_id}'");
         $deliveries = $delivery->loadList($where);
         $stocks = CStoredObject::massLoadFwdRef($deliveries, "stock_id");
         $products = CStoredObject::massLoadFwdRef($stocks, "product_id");
         /** @var CProduct $_product */
         foreach ($products as $_product) {
             $meds_dispenses[] = $_product->code . " " . $_product->name;
         }
     }
     $fields_sejour = array("DATE ENT" => CMbDT::dateToLocale(CMbDT::date($this->entree)), "HEURE ENT" => CMbDT::transform($this->entree, null, "%H:%M"), "DATE SORTIE" => CMbDT::dateToLocale(CMbDT::date($this->sortie)), "HEURE SORTIE" => CMbDT::transform($this->sortie, null, "%H:%M"), "PRAT RESPONSABLE" => $this->_ref_praticien->_view, "NDOS" => $this->_NDA, "NRA" => $this->_ref_NRA ? $this->_ref_NRA->id400 : "", "CODE BARRE NDOS" => "@BARCODE_" . $this->_NDA . "@", "CHAMBRE COURANTE" => $affectation->_view, "SERVICE COURANT" => $affectation->_ref_service->_view, "MEDICAMENTS DISPENSES" => implode("\n", $meds_dispenses));
     if (CAppUI::conf("dPhospi prestations systeme_prestations", CGroups::loadCurrent()) == "expert") {
         $fields_sejour["PRESTATIONS SOUHAITEES"] = implode(" - ", $souhaits);
     }
     $fields = array_merge($fields, $fields_sejour);
     if (CAppUI::conf("ref_pays") == 2) {
         $fields["NATURE SEJOUR"] = $this->getFormattedValue("_type_sejour");
         $fields["MODE TRT"] = $this->loadRefChargePriceIndicator()->code;
         $this->loadRefsFactureEtablissement();
         if ($this->_ref_last_facture) {
             $this->_ref_last_facture->loadRefAssurance();
             $fields["ASSUR MALADIE"] = $this->_ref_last_facture->_ref_assurance_maladie->nom;
             $fields["ASSUR ACCIDENT"] = $this->_ref_last_facture->_ref_assurance_accident->nom;
         }
     }
 }