コード例 #1
0
/**
 * $Id: $
 *
 * @package    Mediboard
 * @subpackage Cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: $
 */
CCanDo::checkRead();
$chir_id = CValue::get("chir_id");
$function_id = CValue::get("function_id");
$list_chir_ids = array();
$user = new CMediusers();
$user->load($chir_id);
$ds = $user->getDS();
if ($function_id) {
    $users = CConsultation::loadPraticiens(PERM_EDIT, $function_id);
    $list_chir_ids = array_keys($users);
} else {
    $list_chir_ids = array($chir_id);
}
// Liste des consultations a avancer si desistement
$now = CMbDT::date();
$where = array("plageconsult.date" => " > '{$now}'", "plageconsult.chir_id" => $ds->prepareIn($list_chir_ids), "consultation.si_desistement" => "= '1'", "consultation.annule" => "= '0'");
$ljoin = array("plageconsult" => "plageconsult.plageconsult_id = consultation.plageconsult_id");
$consultation_desist = new CConsultation();
/** @var CConsultation[] $consultations */
$consultations = $consultation_desist->loadList($where, "date, heure", null, null, $ljoin);
foreach ($consultations as $_consult) {
    $_consult->loadRefPatient();
コード例 #2
0
 /**
  * Return or create the doctor of the message
  *
  * @param DOMNode $node Node
  *
  * @return CMediusers|int|null
  */
 function getDoctor($node)
 {
     $xpath = new CHPrimSanteMessageXPath($node ? $node->ownerDocument : $this);
     $nodeDoctor = $xpath->query("P.13", $node);
     $code = null;
     $nom = null;
     $prenom = null;
     $type_code = null;
     foreach ($nodeDoctor as $_node_doctor) {
         $code = $xpath->queryTextNode("CNA.1", $_node_doctor);
         $nom = $xpath->queryTextNode("CNA.2/PN.1", $_node_doctor);
         $prenom = $xpath->queryTextNode("CNA.2/PN.2", $_node_doctor);
         $type_code = $xpath->queryTextNode("CNA.3", $_node_doctor);
         if ($code && $nom) {
             break;
         }
     }
     $mediuser = new CMediusers();
     $mediuser->_user_last_name = $nom;
     switch ($type_code) {
         case "R":
             $mediuser->rpps = $code;
             break;
         case "A":
             $mediuser->adeli = $code;
             break;
         default:
             if (strlen($code) == 9 && luhn($code)) {
                 $mediuser->adeli = $code;
             }
             if (strlen($code) == 11 && luhn($code)) {
                 $mediuser->rpps = $code;
             }
     }
     // Cas où l'on a aucune information sur le médecin
     if (!$mediuser->rpps && !$mediuser->adeli && !$mediuser->_id && !$mediuser->_user_last_name) {
         return null;
     }
     $sender = $this->_ref_sender;
     $ds = $mediuser->getDS();
     $ljoin = array();
     $ljoin["functions_mediboard"] = "functions_mediboard.function_id = users_mediboard.function_id";
     $where = array();
     $where["functions_mediboard.group_id"] = " = '{$sender->group_id}'";
     if ($mediuser->rpps || $mediuser->adeli) {
         if ($mediuser->rpps) {
             $where[] = $ds->prepare("rpps = %", $mediuser->rpps);
         }
         if ($mediuser->adeli) {
             $where[] = $ds->prepare("adeli = %", $mediuser->adeli);
         }
         // Dans le cas où le praticien recherché par son ADELI ou RPPS est multiple
         if ($mediuser->countList($where, null, $ljoin) > 1) {
             $ljoin["users"] = "users_mediboard.user_id = users.user_id";
             $where[] = $ds->prepare("users.user_last_name = %", $nom);
         }
         $mediuser->loadObject($where, null, null, $ljoin);
         if ($mediuser->_id) {
             return $mediuser;
         }
     }
     $user = new CUser();
     $ljoin = array();
     $ljoin["users_mediboard"] = "users.user_id = users_mediboard.user_id";
     $ljoin["functions_mediboard"] = "functions_mediboard.function_id = users_mediboard.function_id";
     $where = array();
     $where["functions_mediboard.group_id"] = " = '{$sender->group_id}'";
     $where[] = $ds->prepare("users.user_first_name = %", $prenom);
     $where[] = $ds->prepare("users.user_last_name = %", $nom);
     $order = "users.user_id ASC";
     if ($user->loadObject($where, $order, null, $ljoin)) {
         return $user->loadRefMediuser();
     }
     $mediuser->_user_first_name = $prenom;
     $mediuser->_user_last_name = $nom;
     return $this->createDoctor($mediuser);
 }