コード例 #1
0
function Calcul_Delai_Traumatologie_Main($formx)
{
    global $session;
    global $options;
    $date_accident = utf8_decode($formx->getFormVar('Val_Horaire_Date_Accident'));
    $heure_accident = utf8_decode($formx->getFormVar('Val_Horaire_Heure_Accident'));
    $date_examen = utf8_decode($formx->getFormVar('Val_Horaire_Date_Examen'));
    $heure_examen = utf8_decode($formx->getFormVar('Val_Horaire_Heure_Examen'));
    $posted = explode("-", $date_accident);
    $date_accident = $posted[2] . "-" . $posted[1] . "-" . $posted[0];
    $posted = explode("-", $date_examen);
    $date_examen = $posted[2] . "-" . $posted[1] . "-" . $posted[0];
    $accident = new clDate($date_accident . " " . $heure_accident . ":00");
    $examen = new clDate($date_examen . " " . $heure_examen);
    $duree = new clDuree($examen->getDifference($accident));
    //eko ($accident->getDatetime());
    //eko ($examen->getDatetime());
    return $duree->getDuree();
}
コード例 #2
0
ファイル: clHprimXML.php プロジェクト: jeromecc/tuv2
 function createActes($res, $j = '', $tous = '', $id = '')
 {
     //eko($res);
     //eko($id);
     global $options;
     if (!$tous) {
         $deb = $j;
         $max = $j;
     } else {
         $deb = 0;
         $max = $res['INDIC_SVC'][2] - 1;
     }
     $mod = new ModeliXe("HprimXMLActes.html");
     $mod->SetModeliXe();
     $tabActe = explode('|', XhamTools::sansAccent($res['CONTENU'][$deb]));
     $type = $res['TYPE'][$deb];
     $idpass = $tabActe[0];
     $idu = $tabActe[1];
     $nomu = $tabActe[2];
     $pren = $tabActe[3];
     $sexe = $tabActe[4];
     $dtnai = $tabActe[5];
     $dtdem = $tabActe[6];
     $hhdem = $tabActe[7];
     $ufd = $tabActe[8];
     $action = $tabActe[9];
     $date = new clDate($dtdem . ' ' . $hhdem);
     $date = new clDate();
     if ($options->getOption("HprimXML_UF")) {
         $ufr = $options->getOption("HprimXML_UF");
         $ufd = $options->getOption("HprimXML_UF");
     }
     if ($options->getOption('HprimXML_AttributsESA')) {
         $mod->MxText("attributsesa", ' version="1.03a" xsi:schemaLocation="http://www.hprim.org/hprimXML msgEvenementsServeurActes103a.xsd" xmlns="http://www.hprim.org/hprimXML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"');
     } else {
         $mod->MxText("attributsesa", "");
     }
     if ($options->getOption('HprimXML_EnvoiGroupeParIntervenant')) {
         if ($options->getOption('HprimXML_EmetInterv') == 'ID') {
             $emetti = $id + 1;
         } else {
             $emetti = $res['DISCR'][$deb];
         }
     } else {
         if ($options->getOption('HprimXML_EmetInterv') == 'ID') {
             $emetti = $res['ID'][$deb];
         } elseif ($options->getOption('HprimXML_EmetInterv')) {
             $emetti = $options->getOption('HprimXML_EmetInterv');
         } else {
             $emetti = $res['DISCR'][$deb];
         }
     }
     if ($options->getOption('HprimXML_EnvoiGroupeParIntervenant')) {
         if ($options->getOption('HprimXML_EmetInterv') == 'ID') {
             $mod->MxText('identifiantMessage', $id);
             //eko("avignon");
         } else {
             $mod->MxText('identifiantMessage', $res['ID'][$deb]);
         }
     } else {
         $mod->MxText('identifiantMessage', $res['ID'][$deb]);
         // eko("reste");
     }
     $mod->MxText('codeEmetteur', $options->getOption('HprimXML_Emet') ? $options->getOption('HprimXML_Emet') : $res['DISCR'][$deb]);
     $mod->MxText('codeDestinataire', $options->getOption('HprimXML_Dest'));
     $mod->MxText('patientEmetteur', $idu);
     $mod->MxText('patientRecepteur', $idu);
     $mod->MxText('sexe', $sexe);
     $mod->MxText('patientNom', $nomu);
     $mod->MxText('patientPrenom', $pren);
     if ($dtnai != "00/00/0000") {
         $mod->MxText('patientNaissance', $dtnai);
     } else {
         $mod->MxText('patientNaissance', "");
     }
     $pati = new clPatient($res['DISCR'][$deb], '');
     if (!$pati->getID()) {
         $pati = new clPatient($res['DISCR'][$deb], 'Sortis');
     }
     //$pati -> debugInfos ( ) ;
     //eko ( "UUUUUUUUUUUUUUUUUUUUUUUUFFFFFFFFFFFFFFFFFF : ".$pati->getInformation('uf').' pour '.$pati->getDateNaissance() ) ;
     // Correction date foireuse module ccam
     $datadmi = new clDate($pati->getDateAdmission());
     $datexam = new clDate($pati->getDateExamen());
     $datsort = new clDate($pati->getDateSortie());
     if ($options->getOption("ChoixHeureAffectationActes") == "Heure d'admission") {
         $datdema = $datadmi;
     } elseif ($options->getOption("ChoixHeureAffectationActes") == "Heure d'examen") {
         $datdema = $datexam;
     } elseif ($options->getOption("ChoixHeureAffectationActes") == "Heure de sorti") {
         $datdema = $datsort;
     } else {
         if ($datadmi->getDatetime() != '1999-12-31 00:00:00' and $datsort->getDatetime() != '1999-12-31 00:00:00') {
             $time = (int) ($datadmi->getTimestamp() / 2) + $datsort->getTimestamp() / 2;
         } elseif ($datadmi->getDatetime() != '1999-12-31 00:00:00') {
             $time = $datadmi->getTimestamp();
         } else {
             $time = $datsort->getTimestamp();
         }
         $datdema = new clDate($time);
         $datmed = new clDate($time);
         //eko ( $datadmi->getTimestamp ( ).' + '.$datsort->getTimestamp ( ).' = '.$time.' = '.$datdema -> getTimestamp ( ) ) ;
         //eko ( $datadmi->getDatetime ( ).' + '.$datsort->getDatetime ( ).' = '.$time.' = '.$datdema -> getDatetime ( ) ) ;
     }
     $dtdem = $datdema->getDate('Y-m-d');
     $hhdem = $datdema->getDate('H:i:s');
     if ($options->getOption('HprimXML_DateProduction') == 'Heure médiane') {
         $date = $datmed;
     } elseif ($options->getOption('HprimXML_DateProduction') == 'Heure admission') {
         $date = $datadmi;
     } elseif ($options->getOption('HprimXML_DateProduction') == 'Heure examen') {
         $date = $datadmi;
     } elseif ($options->getOption('HprimXML_DateProduction') == 'Heure sortie') {
         $date = $datsort;
     }
     if ($options->getOption('HprimXML_DateT')) {
         $mod->MxText('dateHeureProduction', $date->getDate("Y-m-d\\TH:i:s"));
     } else {
         $mod->MxText('dateHeureProduction', $date->getDatetime());
     }
     if ($options->getOption('HprimXML_DateVenue') == 'Heure médiane') {
         $dateve = $datmed;
     } elseif ($options->getOption('HprimXML_DateVenue') == 'Heure admission') {
         $dateve = $datadmi;
     } elseif ($options->getOption('HprimXML_DateVenue') == 'Heure examen') {
         $dateve = $datadmi;
     } elseif ($options->getOption('HprimXML_DateVenue') == 'Heure sortie') {
         $dateve = $datsort;
     } else {
         $dateve = $datdema;
     }
     $dtven = $dateve->getDate('Y-m-d');
     $hhven = $dateve->getDate('H:i:s');
     $mod->MxText('venueEmetteur', $idpass);
     $mod->MxText('venueRecepteur', $idpass);
     $mod->MxText('venueDate', $dtven);
     $mod->MxText('venueHeure', $hhven);
     $mod->MxText('interventionDate', $dtdem);
     $mod->MxText('interventionHeure', $hhdem);
     $mod->MxText('interventionEmetteur', $emetti);
     $mod->MxText('interventionDemandeDate', $dtdem);
     $mod->MxText('interventionDemandeHeure', $hhdem);
     $mod->MxText('interventionUF', $pati->getUF() ? $pati->getUF() : $ufr);
     $nbngap = 0;
     $nbccam = 0;
     $datenai = new clDate($pati->getDateNaissance());
     $duree = new clDuree($datenai->getTimestamp());
     $duree->getDuree($datenai->getTimestamp());
     $ageannees = $duree->getYears();
     //eko ( $ageannees ) ;
     for ($i = $deb; $i <= $max; $i++) {
         $tabActe = explode('|', XhamTools::sansAccent($res['CONTENU'][$i]));
         $type = $res['TYPE'][$i];
         $idpass = $tabActe[0];
         $idu = $tabActe[1];
         $nomu = $tabActe[2];
         $pren = $tabActe[3];
         $sexe = $tabActe[4];
         $dtnai = $tabActe[5];
         $dtdem = $tabActe[6];
         $hhdem = $tabActe[7];
         $ufd = $tabActe[8];
         $action = $tabActe[9];
         $idact = $tabActe[10];
         $cdccam = $tabActe[11];
         $cddiags = $tabActe[12];
         $cdacti = $tabActe[13];
         $cdphase = $tabActe[14];
         $dtr = $tabActe[15];
         $hhr = $tabActe[16];
         $nomumed = $tabActe[17];
         $prenmed = $tabActe[18];
         $adeli = $tabActe[19];
         $ufr = $tabActe[20];
         $modif = $tabActe[21];
         $ngapl = $tabActe[22];
         $ngapc = $tabActe[23];
         $factu = $tabActe[24];
         $cdasso = $tabActe[25];
         $nuitjf = $tabActe[26];
         $tabm = explode('~', $modif);
         if ($options->getOption("HprimXML_UF")) {
             $ufr = $options->getOption("HprimXML_UF");
             $ufd = $options->getOption("HprimXML_UF");
         }
         if (!$this->adeliMedecin) {
             if ($options->getOption("HprimXML_CodeMedecinInterv") == 'ADELI9') {
                 $this->adeliMedecin = '<code>' . sprintf('%09d', $adeli) . '</code>';
             } elseif ($options->getOption("HprimXML_CodeMedecinInterv") == 'NOMMED') {
                 $this->adeliMedecin = '<code>' . $nomumed . ' ' . $prenmed . '</code>';
             } elseif ($options->getOption("HprimXML_CodeMedecinInterv") == 'NOMMED10') {
                 $this->adeliMedecin = '<code>' . substr($nomumed . ' ' . $prenmed, 0, 10) . '</code>';
             } elseif ($options->getOption("HprimXML_CodeMedecinInterv") == 'ADELI') {
                 $this->adeliMedecin = '<code>' . $adeli . '</code>';
             } else {
                 $this->adeliMedecin = '';
             }
         } elseif (!ereg('<code>', $this->adeliMedecin)) {
             $this->adeliMedecin = '<code>' . $adeli . '</code>';
         }
         if ($options->getOption("HprimXML_CodeMedecin") == 'ADELI') {
             $codeade = '<code>' . $adeli . '</code>';
         } elseif ($options->getOption("HprimXML_CodeMedecin") == 'NOMMED') {
             $codeade = '<code>' . $nomumed . '</code>';
         } elseif ($options->getOption("HprimXML_CodeMedecin") == 'ADELI9') {
             $codeade = '<code>' . sprintf('%09d', $adeli) . '</code>';
         } elseif ($options->getOption("HprimXML_CodeMedecin") == 'VIDE') {
             $codeade = '';
         } else {
             $codeade = '<code>' . 'x' . '</code>';
         }
         //eko ( "CODE MEDECIN : $codeade" ) ;
         if ($options->getOption("HprimXML_ExecPrinc")) {
             $medExec = ' principal="oui"';
         } else {
             $medExec = '';
         }
         if ($options->getOption('HprimXML_StatutFT')) {
             $modStatut = ' statut="ft"';
         } else {
             $modStatut = '';
         }
         if ($action == 'creation') {
             $action = utf8_encode('création');
         }
         if ($nuitjf == 'F') {
             $isFerie = "oui";
         } else {
             // Encore une gestion supplémentaire d'un bug du module CACAM
             if ($type == 'NGAP' and $ngapl == 'AMI' and $datdema->getDate('w') == 6 and $datdema->getDate('H') >= 8) {
                 $isFerie = "oui";
             } else {
                 $isFerie = "non";
             }
         }
         if ($nuitjf == 'N') {
             $isNuit = '1t';
         } elseif ($nuitjf == 'NM') {
             $isNuit = '2t';
         } else {
             $isNuit = 'non';
         }
         $listeTraited[$res['ID'][$i]] = $res['ID'][$i];
         if ($options->getOption('LettreCleCSPsy') and $ngapl == 'CNPSY') {
             $ngapl = $options->getOption('LettreCleCSPsy');
         }
         //$mod -> MxText ( 'identifiantMessage', $res['ID'][$deb] ) ;
         // Correction date foireuse module ccam
         $dtdem = $datdema->getDate('Y-m-d');
         $hhdem = $datdema->getDate('H:i:s');
         if ($type == 'NGAP') {
             if ($ngapl == 'MNO' and $ageannees > 2) {
                 $erreurngap = 1;
             }
             if (!($ngapl == 'AMI' and $factu == 'non') and !$erreurngap) {
                 if ($ngapl == 'C' or $ngapl == 'CS') {
                     $tri = '2.';
                 } else {
                     $tri = '3.';
                 }
                 $mod->MxText('codeAdeliMedecin', $this->codeMedecinUrgentiste);
                 $mod->MxText('actesngap.ngap.action', $action);
                 $mod->MxText('actesngap.ngap.facturable', $factu);
                 if ($ngapl == 'C' and isset($this->deqp[$pati->getID()]['U'])) {
                     $isNuit = 'non';
                 }
                 $mod->MxText('actesngap.ngap.executionNuit', $isNuit);
                 if ($ngapl == 'C' and isset($this->deqp[$pati->getID()]['F'])) {
                     $isFerie = 'non';
                 }
                 $mod->MxText('actesngap.ngap.executionDimancheJourFerie', $isFerie);
                 $mod->MxText('actesngap.ngap.ngapEmetteur', $idact);
                 $mod->MxText('actesngap.ngap.lettreCle', $ngapl);
                 $mod->MxText('actesngap.ngap.coefficient', $ngapc);
                 $mod->MxText('actesngap.ngap.ngapDate', $dtdem);
                 $mod->MxText('actesngap.ngap.ngapHeure', $hhdem);
                 $mod->MxText('actesngap.ngap.medecinADELI', $adeli);
                 $mod->MxText('actesngap.ngap.medecinCode', $codeade);
                 $mod->MxText('actesngap.ngap.medecinNom', $nomumed);
                 if ($ngapl == 'CS') {
                     $mod->MxText('actesngap.ngap.medecinUF', $ufr);
                 } else {
                     $mod->MxText('actesngap.ngap.medecinUF', $pati->getUF() ? $pati->getUF() : $ufr);
                 }
                 $mod->MxBloc('actesngap.ngap', 'loop');
                 $nbngap++;
                 if ($ngapl == 'ATU') {
                     $repfic = "atuxml/";
                 } else {
                     $repfic = "ngapxml/";
                 }
             }
             $erreurngap = 0;
         } elseif ($type == 'CCAM') {
             $tri = '1.';
             $mod->MxText('codeAdeliMedecin', $this->codeMedecinUrgentiste);
             $mod->MxText('actesccam.ccam.action', $action);
             $mod->MxText('actesccam.ccam.ccamEmetteur', $idact);
             if ($options->getOption('HprimXML_Recepteur')) {
                 $mod->MxText('actesccam.ccam.ccamRecepteur', '<recepteur>' . $options->getOption('HprimXML_Recepteur') . '</recepteur');
             } else {
                 $mod->MxText('actesccam.ccam.ccamRecepteur', '');
             }
             $mod->MxText('actesccam.ccam.codeActe', $cdccam);
             $mod->MxText('actesccam.ccam.codeActivite', $cdacti);
             $mod->MxText('actesccam.ccam.codePhase', $cdphase);
             $mod->MxText('actesccam.ccam.ccamDate', $dtdem);
             $mod->MxText('actesccam.ccam.ccamHeure', $hhdem);
             $mod->MxText('actesccam.ccam.medExec', $medExec);
             $mod->MxText('actesccam.ccam.medecinADELI', $adeli);
             $mod->MxText('actesccam.ccam.medecinCode', $codeade);
             $mod->MxText('actesccam.ccam.medecinNom', $nomumed);
             //$mod -> MxText ( 'actesccam.ccam.medecinUF', $ufr ) ;
             $mod->MxText('actesccam.ccam.medecinUF', $pati->getUF() ? $pati->getUF() : $ufr);
             //if ( $options -> getOption ( 'HprimXML_AssoNonVide' ) ) $asso = ($cdasso==''?1:$cdasso) ;
             //else $asso = $cdasso ;
             if ($cdasso) {
                 $asso = '<codeAssociationNonPrevue>' . $cdasso . '</codeAssociationNonPrevue>';
             } else {
                 $asso = '';
             }
             $mod->MxText('actesccam.ccam.codeAssociationNonPrevue', $asso);
             $nbMod = 0;
             for ($k = 0; isset($tabm[$k]); $k++) {
                 if ($tabm[$k]) {
                     $mod->MxText('actesccam.ccam.modificateur.modificateur', $tabm[$k]);
                     $mod->MxText('actesccam.ccam.modificateur.modStatut', $modStatut);
                     $mod->MxBloc('actesccam.ccam.modificateur', 'loop');
                     if ($cdccam == 'DEQP003') {
                         if ($tabm[$k] == 'U') {
                             $this->deqp[$pati->getID()]['U'] = 1;
                         }
                         if ($tabm[$k] == 'P') {
                             $this->deqp[$pati->getID()]['U'] = 1;
                         }
                         if ($tabm[$k] == 'S') {
                             $this->deqp[$pati->getID()]['U'] = 1;
                         }
                         if ($tabm[$k] == 'F') {
                             $this->deqp[$pati->getID()]['F'] = 1;
                         }
                     }
                     $nbMod++;
                 }
             }
             if ($nbMod == 0) {
                 $mod->MxBloc('actesccam.ccam.modificateur', 'delete');
             }
             $mod->MxBloc('actesccam.ccam', 'loop');
             $nbccam++;
             $repfic = "ccamxml/";
         }
     }
     if ($nbngap == 0) {
         $mod->MxBloc('actesngap', 'delete');
     }
     if ($nbccam == 0) {
         $mod->MxBloc('actesccam', 'delete');
     }
     if ($options->getOption("HprimXML_tri_CCAM_CCS_NGAP")) {
         $numfic = $tri . $res['ID'][$deb];
     } else {
         $numfic = $res['ID'][$deb];
     }
     if ($options->getOption('HprimXML_NomFic')) {
         $nomFic = $options->getOption('HprimXML_NomFic') . '_' . $numfic . '';
     } else {
         $nomFic = 'fic' . $options->getOption('HprimXML_ChaineFic') . 'TV2_' . $numfic . '';
     }
     if ($options->getOption('HprimXML_NomFic') and $options->getOption('HprimXML_NomModulo')) {
         $nomFic = $options->getOption('HprimXML_NomFic') . sprintf('%03d', $res['ID'][$deb] % 1000);
     }
     $num = $res['ID'][$deb];
     if (!$pati->getManuel()) {
         $this->genFile($mod->MxWrite("1"), $num, $nomFic, $listeTraited, $repfic);
     }
 }