コード例 #1
0
 function handle($ack, CMbObject $object, $data)
 {
     // Traitement du message des erreurs
     $comment = "";
     $exchange_hpr = $this->_ref_exchange_hpr;
     $exchange_hpr->_ref_sender->loadConfigValues();
     $sender = $exchange_hpr->_ref_sender;
     $this->_ref_sender = $sender;
     CMbObject::$useObjectCache = false;
     // Rejets partiels du message
     $errors = array();
     if (isset($data["REG"])) {
         $regs = $data["REG"];
     } else {
         $regs = $data["//REG"];
     }
     // Récupération des règlements
     foreach ($regs as $_REG) {
         $sejour = new CSejour();
         $NDA = $this->getNDA($_REG);
         $user_reg = $this->getUser($_REG);
         $segment_row = $this->getREGSegmentRow($_REG);
         // Recherche si on retrouve le séjour
         if (!$this->admitFound($NDA, $sejour)) {
             $errors[] = $this->addError("P", null, array("REG", $segment_row, array($NDA, $user_reg)), null, $NDA, "I", CAppUI::tr("CHL7EventADT-P-01", $NDA));
             continue;
         }
         $consults = array();
         $consultations = $sejour->loadRefsConsultations();
         // Sélection des consultations éligibles
         foreach ($consultations as $_consult) {
             $user = $_consult->loadRefPraticien();
             if ($user_reg) {
                 if ($user->adeli == $user_reg) {
                     $consults[$_consult->_id] = $_consult;
                 }
                 continue;
             }
         }
         // Si une seule consultation donnée
         if (!count($consults) && count($consultations) == 1) {
             $consults = $consultations;
         }
         $consultation = new CConsultation();
         // On essaie d'en trouver une qui ne soit pas acquittée
         foreach ($consults as $_consult) {
             $facture = $_consult->loadRefFacture();
             if (!$facture->patient_date_reglement) {
                 $consultation = $_consult;
                 break;
             }
         }
         // Aucune consultation trouvée
         if (!$consultation->_id && count($consults) > 0) {
             $consultation = end($consults);
         }
         if (!$consultation || !$consultation->_id) {
             $errors[] = $this->addError("P", null, array("REG", $segment_row, array($NDA, $user_reg)), null, $NDA, "I", CAppUI::tr("CHL7EventADT-P-02"));
             continue;
         }
         $facture = $consultation->loadRefFacture();
         if (!$facture->_id) {
             /* @TODO avant de transposer la création de la facture dans le store */
             $facture = $consultation->createFactureConsult();
             if (!$facture->_id) {
                 $errors[] = $this->addError("P", null, array("REG", $segment_row, array($NDA, $user_reg)), null, $NDA, "I", CAppUI::tr("CHL7EventADT-P-03"));
                 continue;
             }
         }
         // Recherche d'un reglèment par tag + idex (nom fichier - id reg)
         $idex_value = $NDA . "_" . $segment_row;
         $tag = CHprim21::getTag($sender->group_id);
         $idex = CIdSante400::getMatch("CReglement", $tag, $idex_value);
         // Mapping des règlements
         $return_payment = $this->mapAndStorePayment($_REG, $facture, $idex);
         if (is_string($return_payment)) {
             $errors[] = $this->addError("P", null, array("REG", $segment_row, array($NDA, $user_reg)), null, $NDA, "I", CAppUI::tr("CHL7EventADT-P-04", $return_payment));
             continue;
         }
     }
     if (count($errors) > 0) {
         return $exchange_hpr->setAckP($ack, $errors, $object);
     }
     return $exchange_hpr->setAckI($ack, null, $object);
 }
コード例 #2
0
            CAppUI::stepAjax(CAppUI::tr("CDocumentItem-_not_available"), UI_MSG_WARNING);
            CApp::rip();
        }
    } else {
        // Objet Inexistant
        $object = null;
    }
}
$show_editor = true;
// Gestion des pages pour les Fichiers PDF et fichiers TXT
if ($fileSel && $elementClass == "CFile" && !$acces_denied) {
    if (file_exists($fileSel->_file_path)) {
        $raw_content = file_get_contents($fileSel->_file_path);
        switch ($fileSel->file_type) {
            case "application/x-hprim":
                $includeInfosFile = CHprim21::formatHPRIMBiologie($raw_content);
                $display_as_is = true;
                $show_editor = false;
                break;
            case "text/osoft":
                if (class_exists("COsoftHistorique")) {
                    $osoft_histo = new COsoftHistorique(false);
                    $includeInfosFile = $osoft_histo->toHTML($raw_content);
                    $show_editor = false;
                    break;
                }
            case "application/osoft":
                if (class_exists("COsoftDossier")) {
                    $osoft_dossier = new COsoftDossier(false);
                    $includeInfosFile = $osoft_dossier->toHTML($raw_content);
                    $show_editor = false;