Example #1
0
 /**
  * @param string $sSql
  * @return CDomain
  */
 protected function getDomainBySql($sSql)
 {
     $oDomain = null;
     if ($this->oConnection->Execute($sSql)) {
         $oRow = $this->oConnection->GetNextRecord();
         if ($oRow) {
             $oDomain = new CDomain();
             $oDomain->InitByDbRow($oRow);
         }
         $this->oConnection->FreeResult();
     }
     $this->throwDbExceptionIfExist();
     return $oDomain;
 }
 /**
  * @see parent::onAfterStore()
  */
 function onAfterStore(CMbObject $mbObject)
 {
     if (!$this->isHandled($mbObject)) {
         return false;
     }
     if (!$mbObject->_id || !$this->create) {
         return false;
     }
     $group_id = $mbObject->_id;
     $object_class = array("CSejour", "CPatient");
     global $dPconfig;
     $original_value = $dPconfig["eai"]["use_domain"];
     $dPconfig["eai"]["use_domain"] = "0";
     foreach ($object_class as $_class) {
         switch ($_class) {
             case "CSejour":
                 $tag_group = CSejour::getTagNDA($group_id);
                 break;
             case "CPatient":
                 $tag_group = CPatient::getTagIPP($group_id);
                 break;
             default:
                 $tag_group = null;
         }
         if (!$tag_group) {
             continue;
         }
         $domain = new CDomain();
         $domain->tag = $tag_group;
         if ($domain->store()) {
             continue;
         }
         $group_domain = new CGroupDomain();
         $group_domain->group_id = $group_id;
         $group_domain->domain_id = $domain->_id;
         $group_domain->object_class = $_class;
         $group_domain->master = "1";
         $group_domain->store();
     }
     $dPconfig["eai"]["use_domain"] = "{$original_value}";
     return true;
 }
 /**
  * Get AN identifier
  *
  * @param DOMNode        $node   Node
  * @param array          &$data  Data
  * @param CInteropSender $sender Sender
  *
  * @return void
  */
 function getANIdentifier(DOMNode $node, &$data, CInteropSender $sender)
 {
     if (CHL7v2Message::$handle_mode == "simple") {
         $data["AN"] = $this->queryTextNode("CX.1", $node);
         return;
     }
     $control_identifier_type_code = CValue::read($sender->_configs, "control_identifier_type_code");
     $search_master_NDA = CValue::read($sender->_configs, "search_master_NDA");
     if ($search_master_NDA) {
         $domain = CDomain::getMasterDomain("CSejour", $sender->group_id);
         if ($domain->namespace_id != $this->queryTextNode("CX.4/HD.1", $node)) {
             return;
         }
         if ($control_identifier_type_code) {
             if ($this->queryTextNode("CX.5", $node) == "AN") {
                 $data["AN"] = $this->queryTextNode("CX.1", $node);
             }
         } else {
             $data["AN"] = $this->queryTextNode("CX.1", $node);
         }
         return;
     }
     if ($control_identifier_type_code) {
         if ($this->queryTextNode("CX.5", $node) == "AN") {
             $data["AN"] = $this->queryTextNode("CX.1", $node);
         }
     } else {
         $data["AN"] = $this->queryTextNode("CX.1", $node);
     }
 }
Example #4
0
 /**
  * Save domain details back to the database upon modifying the object. 
  * 
  * @param CDomain $oDomain
  *
  * @return bool
  */
 public function updateDomain(CDomain $oDomain)
 {
     $bResult = false;
     try {
         if ($oDomain->validate()) {
             if ($oDomain->IsDefaultDomain) {
                 $oSettings =& CApi::GetSettings();
                 $aSettingsMap = $oDomain->GetSettingsMap();
                 foreach ($aSettingsMap as $sProperty => $sSettingsName) {
                     $oSettings->SetConf($sSettingsName, $oDomain->{$sProperty});
                 }
                 $bResult = $oSettings->SaveToXml();
             } else {
                 if (!$this->oStorage->updateDomain($oDomain)) {
                     throw new CApiManagerException(Errs::DomainsManager_DomainUpdateFailed);
                 }
                 $bResult = true;
             }
         }
     } catch (CApiBaseException $oException) {
         $bResult = false;
         $this->setLastException($oException);
     }
     return $bResult;
 }
<?php

/**
 * View interop actors EAI
 *  
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @version  SVN: $Id:$ 
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$domain_id = CValue::get("domain_id");
// Domaine
$domain = new CDomain();
$domain->load($domain_id);
$domain->loadRefsGroupDomains();
foreach ($domain->_ref_group_domains as $_group_domain) {
    $_group_domain->loadRefGroup();
}
$group_domain = new CGroupDomain();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("domain", $domain);
$smarty->assign("group_domain", $group_domain);
$smarty->display("inc_vw_group_domains.tpl");
 /**
  * Build PID segement
  *
  * @param CHL7v2Event $event Event
  *
  * @return null
  */
 function build(CHL7v2Event $event)
 {
     parent::build($event);
     $message = $event->message;
     $sender = $event->_sender;
     $group = $sender->loadRefGroup();
     $domains_returned = $this->domains_returned;
     $patient = $this->patient;
     $data = array();
     // PID-1: Set ID - PID (SI) (optional)
     $data[] = $this->set_id;
     // PID-2: Patient ID (CX) (optional)
     $data[] = null;
     $identifiers = array();
     if (empty($domains_returned)) {
         $idex = new CIdSante400();
         $idex->object_id = $patient->_id;
         $idex->object_class = "CPatient";
         $ljoin = array();
         $ljoin[] = "group_domain AS g1 ON g1.domain_id = domain.domain_id AND g1.object_class = 'CPatient'";
         foreach ($idex->loadMatchingList() as $_idex) {
             $domain = new CDomain();
             $where["tag"] = " = '{$_idex->tag}'";
             $domain->loadObject($where, null, null, $ljoin);
             if (!$domain->_id) {
                 continue;
             }
             $identifiers[] = array($_idex->id400, null, null, $this->getAssigningAuthority("domain", null, null, $domain), "MR");
         }
     } else {
         foreach ($domains_returned as $_domain_returned) {
             $assigning_authority = $this->getAssigningAuthority("domain", null, null, $_domain_returned);
             $identifiers[] = array(CIdSante400::getValueFor($patient, $_domain_returned->tag), null, null, $assigning_authority, "MR");
         }
     }
     // PID-3: Patient Identifier List (CX) (repeating)
     $data[] = $identifiers;
     // PID-4: Alternate Patient ID - PID (CX) (optional repeating)
     $data[] = null;
     // PID-5: Patient Name (XPN) (repeating)
     $data[] = $this->getXPN($patient);
     // PID-6: Mother's Maiden Name (XPN) (optional repeating)
     $data[] = null;
     // PID-7: Date/Time of Birth (TS) (optional)
     $data[] = CMbDT::isLunarDate($patient->naissance) ? null : $patient->naissance;
     // PID-8: Administrative Sex (IS) (optional)
     // Table - 0001
     // F - Female
     // M - Male
     // O - Other
     // U - Unknown
     // A - Ambiguous
     // N - Not applicable
     $data[] = CHL7v2TableEntry::mapTo("1", $patient->sexe);
     // PID-9: Patient Alias (XPN) (optional repeating)
     $data[] = null;
     // PID-10: Race (CE) (optional repeating)
     $data[] = null;
     // PID-11: Patient Address (XAD) (optional repeating)
     $address = array();
     if ($patient->adresse || $patient->ville || $patient->cp) {
         $linesAdress = explode("\n", $patient->adresse, 2);
         $address[] = array(CValue::read($linesAdress, 0), str_replace("\n", $message->componentSeparator, CValue::read($linesAdress, 1)), $patient->ville, $patient->province, $patient->cp, CPaysInsee::getAlpha3($patient->pays_insee), "H");
     }
     if ($patient->lieu_naissance || $patient->cp_naissance || $patient->pays_naissance_insee) {
         $address[] = array(null, null, $patient->lieu_naissance, null, $patient->cp_naissance, CPaysInsee::getAlpha3($patient->pays_naissance_insee), "BDL");
     }
     $data[] = $address;
     // PID-12: County Code (IS) (optional)
     $data[] = null;
     // PID-13: Phone Number - Home (XTN) (optional repeating)
     // Table - 0201
     // ASN - Answering Service Number
     // BPN - Beeper Number
     // EMR - Emergency Number
     // NET - Network (email) Address
     // ORN - Other Residence Number
     // PRN - Primary Residence Number
     // VHN - Vacation Home Number
     // WPN - Work Number
     // Table - 0202
     // BP       - Beeper
     // CP       - Cellular Phone
     // FX       - Fax
     // Internet - Internet Address: Use Only If Telecommunication Use Code Is NET
     // MD       - Modem
     // PH       - Telephone
     // TDD      - Telecommunications Device for the Deaf
     // TTY      - Teletypewriter
     $phones = array();
     if ($patient->tel) {
         $area_city_code = null;
         $local_number = null;
         if ($sender->_configs["send_area_local_number"]) {
             $area_city_code = substr($patient->tel, 0, 3);
             $local_number = substr($patient->tel, 3);
         }
         $phones[] = array(null, "PRN", "PH", null, null, $area_city_code, $local_number, null, null, null, null, $sender->_configs["send_area_local_number"] ? null : $patient->tel);
     }
     $data[] = $phones;
     // PID-14: Phone Number - Business (XTN) (optional repeating)
     $data[] = null;
     // PID-15: Primary Language (CE) (optional)
     $data[] = null;
     // PID-16: Marital Status (CE) (optional)
     $data[] = null;
     // PID-17: Religion (CE) (optional)
     $data[] = null;
     // PID-18: Patient Account Number (CX) (optional)
     if ($this->sejour) {
         $sejour = $this->sejour;
         $sejour->loadNDA($group->_id);
         $domain = new CDomain();
         $domain->tag = $sejour->getTagNDA();
         $domain->loadMatchingObject();
         $data[] = $sejour->_NDA ? array(array($sejour->_NDA, null, null, $this->getAssigningAuthority("domain", null, null, $domain))) : null;
     } else {
         $data[] = null;
     }
     // PID-19: SSN Number - Patient (ST) (optional)
     $data[] = $patient->matricule;
     // PID-20: Driver's License Number - Patient (DLN) (optional)
     $data[] = null;
     // PID-21: Mother's Identifier (CX) (optional repeating)
     $data[] = null;
     // PID-22: Ethnic Group (CE) (optional repeating)
     $data[] = null;
     // PID-23: Birth Place (ST) (optional)
     $data[] = null;
     // PID-24: Multiple Birth Indicator (ID) (optional)
     $data[] = null;
     // PID-25: Birth Order (NM) (optional)
     $data[] = $patient->rang_naissance;
     // PID-26: Citizenship (CE) (optional repeating)
     $data[] = null;
     // PID-27: Veterans Military Status (CE) (optional)
     $data[] = null;
     // PID-28: Nationality (CE) (optional)
     $data[] = null;
     // PID-29: Patient Death Date and Time (TS) (optional)
     $data[] = $patient->deces ? $patient->deces : null;
     // PID-30: Patient Death Indicator (ID) (optional)
     $data[] = $patient->deces ? "Y" : "N";
     // PID-31: Identity Unknown Indicator (ID) (optional)
     $data[] = null;
     // PID-32: Identity Reliability Code (IS) (optional repeating)
     $data[] = null;
     // PID-33: Last Update Date/Time (TS) (optional)
     $data[] = null;
     // PID-34: Last Update Facility (HD) (optional)
     $data[] = null;
     // PID-35: Species Code (CE) (optional)
     $data[] = null;
     // PID-36: Breed Code (CE) (optional)
     $data[] = null;
     // PID-37: Strain (ST) (optional)
     $data[] = null;
     // PID-38: Production Class Code (CE) (optional)
     $data[] = null;
     // PID-39: Tribal Citizenship (CWE) (optional repeating)
     $data[] = null;
     $this->fill($data);
 }
Example #7
0
 /**
  * Construit le tag NDA en fonction des variables de configuration
  *
  * @param int    $group_id Permet de charger le NDA pour un établissement donné si non null
  * @param string $type_tag Permet de spécifier le type de tag
  *
  * @return string|void
  */
 static function getTagNDA($group_id = null, $type_tag = "tag_dossier")
 {
     // Recherche de l'établissement
     $group = CGroups::get($group_id);
     if (!$group_id) {
         $group_id = $group->_id;
     }
     $cache = new Cache(__METHOD__, array($group_id, $type_tag), Cache::INNER);
     if ($cache->exists()) {
         return $cache->get();
     }
     // Gestion du tag NDA par son domaine d'identification
     if (CAppUI::conf("eai use_domain")) {
         $tag_NDA = CDomain::getMasterDomain("CSejour", $group_id)->tag;
         if ($type_tag != "tag_dossier") {
             $tag_NDA = CAppUI::conf("dPplanningOp CSejour {$type_tag}") . $tag_NDA;
         }
         return $cache->put($tag_NDA, false);
     }
     $tag_NDA = CAppUI::conf("dPplanningOp CSejour tag_dossier");
     if ($type_tag != "tag_dossier") {
         $tag_NDA = CAppUI::conf("dPplanningOp CSejour {$type_tag}") . $tag_NDA;
     }
     // Si on est dans le cas d'un établissement gérant la numérotation
     $group->loadConfigValues();
     if ($group->_configs["smp_idex_generator"]) {
         $tag_NDA = CAppUI::conf("smp tag_nda");
     }
     // Pas de tag Num dossier
     if (null == $tag_NDA) {
         return $cache->put(null, false);
     }
     // Préférer un identifiant externe de l'établissement
     if ($tag_group_idex = CAppUI::conf("dPplanningOp CSejour tag_dossier_group_idex")) {
         $idex = new CIdSante400();
         $idex->loadLatestFor($group, $tag_group_idex);
         $group_id = $idex->id400;
     }
     return $cache->put(str_replace('$g', $group_id, $tag_NDA), false);
 }
<?php

/**
 * Refresh incrementer/actor EAI
 *  
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @version  SVN: $Id:$ 
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$domain_id = CValue::get("domain_id");
// Liste des domaines
$domain = new CDomain();
$domain->load($domain_id);
$domain->loadRefsGroupDomains();
$domain->loadRefActor();
$domain->loadRefIncrementer()->loadView();
$domain->isMaster();
// Liste des acteurs
$actor = new CInteropActor();
$actors = $actor->getObjects();
$groups = CGroups::loadGroups();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("domain", $domain);
$smarty->assign("actors", $actors);
$smarty->assign("groups", $groups);
$smarty->display("inc_vw_incrementer_actor.tpl");
 /**
  * @param CDomain $oDomain
  */
 public function PluginDomainConstruct(&$oDomain)
 {
     $aFolderMap =& $oDomain->GetFoldersMap();
     $aFolderMap = array(EFolderType::Inbox => 'INBOX', EFolderType::Trash => 'Trash');
 }
Example #10
0
 /**
  * Get actor tag
  *
  * @param int $group_id Group
  *
  * @return string
  */
 function getTag($group_id = null)
 {
     // Recherche de l'établissement
     $group = CGroups::get($group_id);
     if (!$group_id) {
         $group_id = $group->_id;
     }
     $cache = new Cache(__METHOD__, array($group_id), Cache::INNER);
     if ($cache->exists()) {
         return $cache->get();
     }
     $ljoin["group_domain"] = "`group_domain`.`domain_id` = `domain`.`domain_id`";
     $where = array();
     $where["group_domain.group_id"] = " = '{$group_id}'";
     $where["domain.actor_class"] = " = '{$this->_class}'";
     $where["domain.actor_id"] = " = '{$this->_id}'";
     $domain = new CDomain();
     $domain->loadObject($where, null, null, $ljoin);
     return $cache->put($domain->tag, false);
 }
 * @version  SVN: $Id:$ 
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
CApp::setMemoryLimit("712M");
$domains_id = CValue::get("domains_id");
if (!is_array($domains_id)) {
    $domains_id = explode("-", $domains_id);
}
CMbArray::removeValue("", $domains_id);
$d1_id = $domains_id[0];
$d2_id = $domains_id[1];
$d1 = new CDomain();
$d1->load($d1_id);
$d1->isMaster();
$d2 = new CDomain();
$d2->load($d2_id);
$d2->isMaster();
$ds = $d1->_spec->ds;
$and = null;
if ($d1->_is_master_ipp || $d2->_is_master_ipp) {
    $and .= "AND id1.object_class = 'CPatient' \n AND id2.object_class = 'CPatient'";
}
if ($d1->_is_master_nda || $d2->_is_master_nda) {
    $and .= "AND id1.object_class = 'CSejour' \n AND id2.object_class = 'CSejour'";
}
$intersect_id400s = $ds->loadList("SELECT id1.id400\n                                   FROM id_sante400 AS id1 \n                                   LEFT JOIN id_sante400 AS id2 ON id2.id400 = id1.id400 \n                                   AND id2.object_class = id1.object_class\n                                   WHERE id1.tag = '{$d1->tag}'\n                                   AND id2.tag = '{$d2->tag}'\n                                   {$and}");
$intersect_id400s = CMbArray::pluck($intersect_id400s, "id400");
if (!$intersect_id400s) {
    $intersect_id400s = array();
}
<?php

/**
 * Edit domain EAI
 *
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$domain_id = CValue::getOrSession("domain_id");
$group_domain_id = CValue::getOrSession("group_domain_id");
// Récupération du domaine à ajouter/editer
$domain = new CDomain();
$domain->load($domain_id);
// Récupération de l'établissement du domaine à editer
$group_domain = new CGroupDomain();
$group_domain->load($group_domain_id);
$groups = CGroups::loadGroups();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("domain", $domain);
$smarty->assign("group_domain", $group_domain);
$smarty->assign("groups", $groups);
$smarty->display("inc_edit_group_domain.tpl");
Example #13
0
<?php

/**
 * Actor domain aed
 *  
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @version  SVN: $Id:$ 
 * @link     http://www.mediboard.org
 */
$actor_guid = CValue::post("actor_guid");
$domain_id = CValue::post("domain_id");
$disassociated = CValue::post("disassociated");
list($actor_class, $actor_id) = explode('-', $actor_guid);
$domain = new CDomain();
$domain->load($domain_id);
if ($disassociated == 1) {
    $domain->actor_id = "";
    $domain->actor_class = "";
} else {
    $domain->actor_id = $actor_id;
    $domain->actor_class = $actor_class;
}
if ($msg = $domain->store()) {
    CAppUI::stepAjax(CAppUI::tr("CDomain") . CAppUI::tr("CMbObject-msg-store-failed") . $msg, UI_MSG_ERROR);
} else {
    $disassociated == 1 ? CAppUI::stepAjax("CDomain-actor-disassociated-desc") : CAppUI::stepAjax("CDomain-actor-associated");
}
CApp::rip();
<?php

/**
 * $Id$
 *  
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$domain_id = CValue::get("domain_id");
$domain = new CDomain();
$domain->load($domain_id);
$domain->countObjects();
$smarty = new CSmartyDP();
$smarty->assign("domain", $domain);
$smarty->display("inc_show_domain_details.tpl");
 /**
  * Handle event
  *
  * @param CHL7v2PatientDemographicsAndVisitResponse $ack     Acknowledgement
  * @param CPatient                                  $patient Person
  * @param array                                     $data    Nodes data
  *
  * @return null|string
  */
 function handle(CHL7v2PatientDemographicsAndVisitResponse $ack, CPatient $patient, $data)
 {
     $exchange_hl7v2 = $this->_ref_exchange_hl7v2;
     $sender = $exchange_hl7v2->_ref_sender;
     $sender->loadConfigValues();
     $this->_ref_sender = $sender;
     $ds = $patient->getDS();
     $where = array();
     foreach ($this->getRequestPatient($data["QPD"]) as $field => $value) {
         if ($value == "") {
             continue;
         }
         if (!in_array($field, array("naissance", "cp"))) {
             $value = preg_replace("/[^a-z\\d\\*]/i", "_", $value);
             $value = preg_replace("/\\*+/", "%", $value);
         }
         $where["patients.{$field}"] = $ds->prepare("LIKE %", $value);
     }
     $ljoin = null;
     $identifier_list = $this->getRequestPatientIdentifierList($data["QPD"]);
     if (count(array_filter($identifier_list)) > 0) {
         $ljoin[10] = "id_sante400 AS id_pat_list ON id_pat_list.object_id = patients.patient_id";
         $where[] = "`id_pat_list`.`object_class` = 'CPatient'";
         // Requête sur un IPP
         if (!empty($identifier_list["id_number"]) && empty($identifier_list["namespace_id"]) && empty($identifier_list["universal_id"]) && empty($identifier_list["universal_id_type"])) {
             $where[] = $ds->prepare("id_pat_list.id400 = %", $identifier_list["id_number"]);
         }
         if (!empty($identifier_list["id_number"]) && (!empty($identifier_list["namespace_id"]) || !empty($identifier_list["universal_id"]))) {
             $namespace_id = $identifier_list["namespace_id"];
             $universal_id = $identifier_list["universal_id"];
             $domain = new CDomain();
             if ($namespace_id) {
                 $domain->namespace_id = $namespace_id;
             }
             if ($universal_id) {
                 $domain->OID = $universal_id;
             }
             if ($domain->tag || $domain->OID) {
                 $domain->loadMatchingObject();
             }
             $where[] = $ds->prepare("id_pat_list.id400 = %", $identifier_list["id_number"]);
             $where[] = $ds->prepare("id_pat_list.tag = %", $domain->tag);
         }
         if (empty($identifier_list["id_number"]) && (!empty($identifier_list["namespace_id"]) || !empty($identifier_list["universal_id"]))) {
             $namespace_id = $identifier_list["namespace_id"];
             $universal_id = $identifier_list["universal_id"];
             $domain = new CDomain();
             if ($namespace_id) {
                 $domain->namespace_id = $namespace_id;
             }
             if ($universal_id) {
                 $domain->OID = $universal_id;
             }
             if ($domain->namespace_id || $domain->OID) {
                 $domain->loadMatchingObject();
                 $where[] = $ds->prepare("id_pat_list.tag = %", $domain->tag);
             }
         }
     }
     $request_admit = false;
     // Requête sur un NDA
     $identifier_list = $this->getRequestSejourIdentifierList($data["QPD"]);
     if (count(array_filter($identifier_list)) > 0) {
         $ljoin[100] = "sejour ON `patients`.`patient_id` = `sejour`.`patient_id`";
         $ljoin[10] = "id_sante400 AS id_sej_list ON id_sej_list.object_id = sejour.sejour_id";
         $where[] = "`id_sej_list`.`object_class` = 'CSejour'";
         // Requête sur un IPP
         if (!empty($identifier_list["id_number"]) && empty($identifier_list["namespace_id"]) && empty($identifier_list["universal_id"]) && empty($identifier_list["universal_id_type"])) {
             $where[] = $ds->prepare("id_sej_list.id400 = %", $identifier_list["id_number"]);
         }
         if (!empty($identifier_list["id_number"]) && (!empty($identifier_list["namespace_id"]) || !empty($identifier_list["universal_id"]))) {
             $namespace_id = $identifier_list["namespace_id"];
             $universal_id = $identifier_list["universal_id"];
             $domain = new CDomain();
             if ($namespace_id) {
                 $domain->namespace_id = $namespace_id;
             }
             if ($universal_id) {
                 $domain->OID = $universal_id;
             }
             if ($domain->namespace_id || $domain->OID) {
                 $domain->loadMatchingObject();
             }
             $where[] = $ds->prepare("id_sej_list.id400 = %", $identifier_list["id_number"]);
             $where[] = $ds->prepare("id_sej_list.tag = %", $domain->tag);
         }
         if (empty($identifier_list["id_number"]) && (!empty($identifier_list["namespace_id"]) || !empty($identifier_list["universal_id"]))) {
             $namespace_id = $identifier_list["namespace_id"];
             $universal_id = $identifier_list["universal_id"];
             $domain = new CDomain();
             if ($namespace_id) {
                 $domain->namespace_id = $namespace_id;
             }
             if ($universal_id) {
                 $domain->OID = $universal_id;
             }
             if ($domain->namespace_id || $domain->OID) {
                 $domain->loadMatchingObject();
                 $where[] = $ds->prepare("id_sej_list.tag = %", $domain->tag);
             }
         }
     }
     foreach ($this->getRequestSejour($data["QPD"]) as $field => $value) {
         if ($value == "") {
             continue;
         }
         $value = preg_replace("/[^a-z\\*]/i", "_", $value);
         $value = preg_replace("/\\*+/", "%", $value);
         $where["sejour.{$field}"] = $ds->prepare("LIKE %", $value);
         $request_admit = true;
     }
     if ($other_request = $this->getOtherRequestSejour($data["QPD"])) {
         $where = array_merge($other_request, $where);
         $request_admit = true;
     }
     $i = 1;
     $domains = array();
     foreach ($this->getQPD8s($data["QPD"]) as $_QPD8) {
         // Requête sur un domaine particulier
         $domains_returned_namespace_id = $_QPD8["domains_returned_namespace_id"];
         // Requête sur un OID particulier
         $domains_returned_universal_id = $_QPD8["domains_returned_universal_id"];
         $domain = new CDomain();
         if ($domains_returned_namespace_id) {
             $domain->namespace_id = $domains_returned_namespace_id;
         }
         if ($domains_returned_universal_id) {
             $domain->OID = $domains_returned_universal_id;
         }
         if ($domain->namespace_id || $domain->OID) {
             $domain->loadMatchingObject();
         }
         $value = $domain->OID ? $domain->OID : $domain->tag;
         // Cas où le domaine n'est pas retrouvé
         if (!$domain->_id) {
             return $exchange_hl7v2->setPDRAE($ack, null, $value);
         }
         $domains[] = $domain;
         if ($domains_returned_namespace_id) {
             $ljoin[20 + $i] = "id_sante400 AS id{$i} ON id{$i}.object_id = patients.patient_id";
             $where[] = $ds->prepare("id{$i}.tag = %", $domain->tag);
             $i++;
         }
     }
     $quantity_limited_request = $this->getQuantityLimitedRequest($data["RCP"]);
     $limit_quantity = !!$quantity_limited_request;
     $quantity_limited_request = $quantity_limited_request ? $quantity_limited_request : 100;
     $pointer = null;
     if (isset($data["DSC"])) {
         $pointer = $this->getContinuationPointer($data["DSC"]);
     }
     $objects = array();
     if (!$request_admit) {
         // Pointeur pour continuer
         if ($pointer) {
             $patient->_pointer = $pointer;
             // is_numeric
             $where["patients.patient_id"] = $ds->prepare(" > %", $pointer);
         }
         $order = "patients.patient_id ASC";
         if (!empty($where)) {
             $objects = $patient->loadList($where, $order, $quantity_limited_request, "patients.patient_id", $ljoin);
             // If we have no next match, we won't have to add a DSC segment
             if ($limit_quantity) {
                 $next_one = $patient->loadList($where, $order, "{$quantity_limited_request},1", "patients.patient_id", $ljoin);
                 if (count($next_one) == 0) {
                     $limit_quantity = false;
                 }
             }
         }
     } else {
         $ljoin[100] = "patients ON `patients`.`patient_id` = `sejour`.`patient_id`";
         /** @var $sejour CSejour */
         $sejour = new CSejour();
         if (!empty($where)) {
             $objects = $sejour->loadList($where, null, $quantity_limited_request, "sejour.sejour_id", $ljoin);
         }
     }
     // Save information indicating that we are doing an incremental query
     $last = end($objects);
     if ($last && $limit_quantity) {
         $last->_incremental_query = true;
     }
     return $exchange_hl7v2->setPDRAA($ack, $objects, null, $domains);
 }
Example #16
0
 * @version  SVN: $Id:$ 
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$domains_id = CValue::get("domains_id");
if (!is_array($domains_id)) {
    $domains_id = explode("-", $domains_id);
}
CMbArray::removeValue("", $domains_id);
$domains = array();
$checkMerge = array();
if (count($domains_id) != 2) {
    $checkMerge[] = CAppUI::tr("mergeTooFewObjects");
}
foreach ($domains_id as $domain_id) {
    $domain = new CDomain();
    // the CMbObject is loaded
    if (!$domain->load($domain_id)) {
        CAppUI::setMsg("Chargement impossible de l'objet [{$domain_id}]", UI_MSG_ERROR);
        continue;
    }
    $domain->loadRefIncrementer();
    $domain->loadRefActor();
    $domains[] = $domain;
}
$domain1 = $domains[0];
$domain2 = $domains[1];
if ($domain1->incrementer_id && $domain2->actor_id || $domain2->incrementer_id && $domain1->actor_id) {
    $checkMerge[] = CAppUI::tr("CDomain-merge_incompatible-incrementer_actor");
}
/*if (($domain1->derived_from_idex && !$domain2->derived_from_idex) || ($domain2->derived_from_idex && !$domain1->derived_from_idex)) {
 /**
  * Get actors identifiers
  *
  * @param array         &$identifiers Identifiers
  * @param CMbObject     $object       Object
  * @param CInteropActor $actor        Actor
  *
  * @return void
  */
 function fillActorsIdentifiers(&$identifiers, CMbObject $object, CInteropActor $actor = null)
 {
     if (!$actor->_configs["send_actor_identifier"]) {
         return;
     }
     $domain = new CDomain();
     $where = array();
     $where["incrementer_id"] = "IS NULL";
     $where["actor_id"] = "IS NOT NULL";
     /** @var CDomain[] $domains */
     $domains = $domain->loadList($where);
     foreach ($domains as $_domain) {
         $value = CIdSante400::getValueFor($object, $_domain->tag);
         if (!$value) {
             continue;
         }
         $identifiers[] = array($value, null, null, $this->getAssigningAuthority("domain", null, null, $_domain), $actor->_configs["build_identifier_authority"] == "PI_AN" ? "PI" : "RI");
     }
 }
Example #18
0
 /**
  * Construit le tag IPP en fonction des variables de configuration
  *
  * @param int $group_id Permet de charger l'IPP pour un établissement donné si non null
  *
  * @return string|null
  */
 static function getTagIPP($group_id = null)
 {
     // Recherche de l'établissement
     $group = CGroups::get($group_id);
     if (!$group_id) {
         $group_id = $group->_id;
     }
     $cache = new Cache(__METHOD__, array($group_id), Cache::INNER);
     if ($cache->exists()) {
         return $cache->get();
     }
     // Gestion du tag IPP par son domaine d'identification
     if (CAppUI::conf("eai use_domain")) {
         return $cache->put(CDomain::getMasterDomain("CPatient", $group_id)->tag, false);
     }
     // Pas de tag IPP => pas d'affichage d'IPP
     if (null == ($tag_ipp = CAppUI::conf("dPpatients CPatient tag_ipp"))) {
         return $cache->put(null, false);
     }
     // Si on est dans le cas d'un établissement gérant la numérotation
     $group->loadConfigValues();
     if ($group->_configs["sip_idex_generator"]) {
         $tag_ipp = CAppUI::conf("sip tag_ipp");
     }
     // Préférer un identifiant externe de l'établissement
     if ($tag_group_idex = CAppUI::conf("dPpatients CPatient tag_ipp_group_idex")) {
         $idex = new CIdSante400();
         $idex->loadLatestFor($group, $tag_group_idex);
         $group_id = $idex->id400;
     }
     return $cache->put(str_replace('$g', $group_id, $tag_ipp), false);
 }
 /**
  * @param string $sName
  * @param mixed $mValue
  * @return string
  */
 protected function getDomainByWhere($sWhere)
 {
     $aMap = api_AContainer::DbReadKeys(CDomain::GetStaticMap());
     $aMap = array_map(array($this, 'escapeColumn'), $aMap);
     $sSql = 'SELECT %s FROM %sawm_domains WHERE %s';
     return sprintf($sSql, implode(', ', $aMap), $this->Prefix(), $sWhere);
 }
<?php

/**
 * Refresh list domains EAI
 *  
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @version  SVN: $Id:$ 
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
// Liste des domaines
$domain = new CDomain();
$domains = $domain->loadList();
foreach ($domains as $_domain) {
    $_domain->loadRefActor();
    $_domain->loadRefIncrementer()->loadView();
    $_domain->loadRefsGroupDomains();
    foreach ($_domain->_ref_group_domains as $_group_domain) {
        $_group_domain->loadRefGroup();
    }
    $_domain->isMaster();
}
// Récupération due l'incrementeur à ajouter/editer
$domain = new CDomain();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("domains", $domains);
$smarty->assign("domain", $domain);
Example #21
0
 /**
  * Get master domain tag
  *
  * @param string $domain_type Object class
  * @param string $group_id    Group
  *
  * @return CDomain
  */
 static function getMasterDomain($domain_type, $group_id = null)
 {
     $group = CGroups::loadCurrent();
     if (!$group_id) {
         $group_id = $group->_id;
     }
     $group_domain = new CGroupDomain();
     $group_domain->object_class = $domain_type;
     $group_domain->group_id = $group_id;
     $group_domain->master = true;
     $group_domain->loadMatchingObject();
     $domain = new CDomain();
     $domain->load($group_domain->domain_id);
     return $domain;
 }