예제 #1
0
 function Netforce2()
 {
     global $session;
     global $options;
     if (strcmp($session->getNom(), "ADMIN") == 0 || strcmp($session->getNom(), "BOREL") == 0 || strcmp($session->getNom(), "DEROCK") == 0) {
         eko("NETFORCE2");
         // On prend tous les patients depuis le 01 Janvier 2008
         $requete = new clResultQuery();
         $listePatient = $requete->Execute("Fichier", "CCAM_Netforce", array(), "ResultQuery");
         //eko($listePatient);
         //$requete       = new clResultQuery;
         //unset($paramRq);
         //$paramRq["cw"] = "libelleActe='ATU'";
         //$codeNGAPATU   = $requete->Execute("Fichier","CCAM_getActesDomaine3",$paramRq,"ResultQuery");
         for ($i = 0; $i < $listePatient["INDIC_SVC"][2]; $i++) {
             //for ( $i = 0 ; $i < 2 ; $i++ ) {
             $idEvent = $listePatient["idEvent"][$i];
             // On prend tous les patients entree depuis le 01 Janvier 2008
             $requete = new clResultQuery();
             $tab["idpatient"] = $idEvent;
             $listePatient2 = $requete->Execute("Fichier", "CCAM_Netforce2", $tab, "ResultQuery");
             $date_entree = $listePatient2["dt_admission"][0];
             //eko($date_entree);
             list($dateActe, $heureActe) = explode(" ", $date_entree);
             list($annee, $mois, $jour) = explode("-", $dateActe);
             //eko($annee);
             if ($annee == "2008") {
                 //eko($heureCalcule);
                 //eko($idu_du_patient_en_question);
                 $this->patient = new clPatient($idEvent, "Sortis");
                 //eko (  $this->patient->getNom() );
                 $this->defineParamCCAM();
                 //eko($this->paramCCAM);
                 /*$dateEvent   = $this->paramCCAM["dateEvent"];
                           $dtFinInterv = $this->paramCCAM["dtFinInterv"];
                           $clDateDeb   = new clDate($dateEvent);
                           $clDateFin   = new clDate($dtFinInterv);
                 
                           if ( strcmp($options->getOption('ChoixHeureAffectationActes'),"Heure médiane")==0 ) {
                             $nbHeures     = $clDateFin->getDifference($clDateDeb)/3600;
                             $dateMediane  = $clDateDeb->addHours($nbHeures/2);
                             $dateMediane  = $clDateDeb->getDate("Y-m-d H:i:s");
                             $heureCalcule = $dateMediane;
                             //eko($dateEvent);
                             //eko($dtFinInterv);
                             //eko($heureCalcule);
                             }
                           elseif (strcmp($options->getOption('ChoixHeureAffectationActes'),"Heure d'admission")==0) {
                             $clDateAdm    = new clDate ( $this->dtAdmission );
                             $heureCalcule = $clDateAdm->getDate("Y-m-d H:i:s");
                             }
                           elseif (strcmp($options->getOption('ChoixHeureAffectationActes'),"Heure d'examen")==0) {
                             $clDateAdm    = new clDate ( $this->dateEvent );
                             $heureCalcule = $clDateAdm->getDate("Y-m-d H:i:s");
                             }
                           elseif (strcmp($options->getOption('ChoixHeureAffectationActes'),"Heure de sorti")==0) {
                             $clDateAdm    = $clDateFin;
                             $heureCalcule = $clDateAdm->getDate("Y-m-d H:i:s");
                             }
                           //eko($heureCalcule);
                           list($dateActe,$heureActe)=explode(" ",$heureCalcule);
                           list($annee,$mois,$jour)=explode("-",$dateActe);
                 
                           if ( $annee == "2008" ) {
                 
                             $maxIdentifiant = $requete->Execute("Fichier","CCAM_getMaxIdentifiantCCAMCotationActes",array(),"ResultQuery");
                           //eko($maxIdentifiant);
                           // On prepare la nouvelle ligne à inserer dans la table ccam_actes_domaine
                           unset($paramRq);
                           $paramRq["identifiant"]         =   $maxIdentifiant["maximun"][0]+1;
                           $paramRq["idEvent"]             =   $this->paramCCAM["idEvent"];
                           $paramRq["dateEvent"]           =   date("Y-m-d H:i:")."00";
                           $paramRq["idDomaine"]           =   CCAM_IDDOMAINE;
                           $paramRq["dtFinInterv"]         =   $this->paramCCAM["dtFinInterv"];
                           $paramRq["idu"]                 =   $this->paramCCAM["idu"];
                           $paramRq["ipp"]                 =   $this->paramCCAM["ipp"];
                           $paramRq["nomu"]                =   $this->paramCCAM["nomu"];
                 		      $paramRq["pren"]                =   $this->paramCCAM["pren"];
                 		      $paramRq["sexe"]                =   $this->paramCCAM["sexe"];
                 		      $paramRq["dtnai"]               =   $this->paramCCAM["dtnai"];
                           $paramRq["dateDemande"]         =   $heureCalcule;
                           $paramRq["typeAdm"]             =   $this->paramCCAM["typeAdm"];
                 		      $paramRq["lieuInterv"]          =   $this->paramCCAM["lieuInterv"];
                 		      $paramRq["numUFdem"]            =   $this->paramCCAM["numUFdem"];
                 		      $paramRq["numSejour"]           =   $this->paramCCAM["nsej"];
                           $paramRq["type"]                =   "ACTE";
                           $paramRq["Urgence"]             =   "O";
                 
                           if ( $this->paramCCAM["matriculeIntervenant"] == "" )
                             $this->paramCCAM["matriculeIntervenant"] =  $options->getOption('codeAdeliChefService');
                 
                           $paramRq["matriculeIntervenant"]=   $this->paramCCAM["matriculeIntervenant"];
                 
                           $paramRq["nomIntervenant"]      =   $this->paramCCAM["nomIntervenant"];
                           $paramRq["numUFexec"]           =   $this->paramCCAM["numUFdem"];
                           $paramRq["codeActe"]            =   $codeNGAPATU["idActe"][0];
                           $paramRq["libelleActe"]         =   "ATU";
                           $paramRq["cotationNGAP"]        =	  "ATU 1";
                           $paramRq["codeActivite4"]       =   "";
                           $paramRq["modificateurs"]       =   "";
                           $paramRq["categorie"]           =   "";
                           $paramRq["extensionDoc"]        =   "";
                           $paramRq["validDefinitive"]     =   "";
                           $paramRq["quantite"]            =   "1";
                           $paramRq["periodicite"]         =   "aucune";
                           $paramRq["lesionMultiple"]      =   "Non";
                           $paramRq["envoi_facturation"]   =   1;
                           $paramRq["envoi_nomIntervenant"]        =   $this->paramCCAM["nomIntervenant"];
                           $paramRq["envoi_matriculeIntervenant"]  =   $this->paramCCAM["matriculeIntervenant"];
                 
                           //eko($paramRq);
                 
                           // Insertion de la nouvelle ligne
                           $requete =  new clRequete(CCAM_BDD,"ccam_cotation_actes",$paramRq);
                           $requete -> addRecord();
                       */
                 $cot = new clCCAMCotationActesDiags($this->paramCCAM);
                 unset($paramRq);
                 $paramRq["cw"] = "idEvent=" . $listePatient["idEvent"][$i] . " and libelleActe='ATU'";
                 $requete = new clResultQuery();
                 $res = $requete->Execute("Fichier", "CCAM_getActesDiagsCotation", $paramRq, "ResultQuery");
                 //eko($res);
                 if ($options->getOption('EnvoiATURegleFacturation')) {
                     if ($this->patient->getTypeDestination() == "H" || $this->patient->ifInUHCD() == 1) {
                         $rien = 0;
                     } else {
                         $type = "creation";
                         $cot->contenuBAL_Netforce($res, $type);
                     }
                 } else {
                     $type = "creation";
                     $cot->contenuBAL_Netforce($res, $type);
                 }
             }
             //if ( $annee == "2008"  )
         }
         eko("NETFORCE2");
     }
     // for ( $i = 0 ; $i < $listePatient["INDIC_SVC"][2]; $i++ )
 }