/** * Return the Object with the information of the medecin in the message * * @param DOMNode $node Node * @param CMbObject $object object * * @return int|null|string */ function getDoctor(DOMNode $node, CMbObject $object) { $type_id = $this->queryTextNode("XCN.13", $node); $id = $this->queryTextNode("XCN.1", $node); $last_name = $this->queryTextNode("XCN.2/FN.1", $node); $first_name = $this->queryTextNode("XCN.3", $node); switch ($type_id) { case "RPPS": $object->rpps = $id; break; case "ADELI": $object->adeli = $id; break; case "RI": // Notre propre RI if ($this->queryTextNode("XCN.9/HD.2", $node) == CAppUI::conf("hl7 assigning_authority_universal_id")) { return $id; } default: // Recherche du praticien par son idex $idex = CIdSante400::getMatch($object->_class, $this->_ref_sender->_tag_mediuser, $id); if ($idex->_id) { return $idex->object_id; } if ($object instanceof CMediusers) { $object->_user_first_name = $first_name; $object->_user_last_name = $last_name; } if ($object instanceof CMedecin) { $object->prenom = $first_name; $object->nom = $last_name; } break; } // Cas où l'on a aucune information sur le médecin if (!$object->rpps && !$object->adeli && !$object->_id && ($object instanceof CMediusers && !$object->_user_last_name || $object instanceof CMedecin && !$object->nom)) { return null; } if ($object instanceof CMedecin && $object->loadMatchingObjectEsc()) { return $object->_id; } $sender = $this->_ref_sender; $ds = $object->getDS(); if ($object instanceof CMediusers) { $ljoin = array(); $ljoin["functions_mediboard"] = "functions_mediboard.function_id = users_mediboard.function_id"; $where = array(); $where["functions_mediboard.group_id"] = " = '{$sender->group_id}'"; if ($object->rpps || $object->adeli) { if ($object->rpps) { $where[] = $ds->prepare("rpps = %", $object->rpps); } if ($object->adeli) { $where[] = $ds->prepare("adeli = %", $object->adeli); } // Dans le cas où le praticien recherché par son ADELI ou RPPS est multiple if ($object->countList($where, null, $ljoin) > 1) { $ljoin["users"] = "users_mediboard.user_id = users.user_id"; $where[] = $ds->prepare("users.user_last_name = %", $last_name); } $object->loadObject($where, null, null, $ljoin); if ($object->_id) { return $object->_id; } } $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 = %", $first_name); $where[] = $ds->prepare("users.user_last_name = %", $last_name); $order = "users.user_id ASC"; if ($user->loadObject($where, $order, null, $ljoin)) { return $user->_id; } $object->_user_first_name = $first_name; $object->_user_last_name = $last_name; return $this->createDoctor($object); } }