/**
  * Intialize params
  *
  * @return void
  */
 static function initParams()
 {
     if (CAppUi::conf('ref_pays') == 2) {
         self::$list_constantes['saturation_air'] = array('type' => 'physio', 'unit' => '%', 'min' => 50, 'max' => 100);
     }
     // make a copy of the array as it will be modified
     $list_constantes = CConstantesMedicales::$list_constantes;
     foreach ($list_constantes as $_constant => &$_params) {
         self::$list_constantes_type[$_params["type"]][$_constant] =& $_params;
         // Champs de cumuls
         if (isset($_params["cumul_reset_config"])) {
             if (!isset(CConstantesMedicales::$list_constantes[$_constant]["cumul_in"])) {
                 CConstantesMedicales::$list_constantes[$_constant]["cumul_in"] = array();
             }
             if (empty($_params["formula"])) {
                 CMbArray::insertAfterKey(CConstantesMedicales::$list_constantes, $_constant, "_{$_constant}_cumul", array("cumul_for" => $_constant, "unit" => $_params["unit"]));
                 CConstantesMedicales::$list_constantes[$_constant]["cumul_in"][] = "_{$_constant}_cumul";
             } else {
                 foreach ($_params["formula"] as $_const => $_sign) {
                     CConstantesMedicales::$list_constantes[$_const]["cumul_in"][] = $_constant;
                 }
             }
         }
     }
 }
Example #2
0
 /**
  * Construct
  **/
 function __construct()
 {
     parent::__construct();
     $this->mod_name = "dPccam";
     $this->makeRevision("all");
     $query = "CREATE TABLE `ccamfavoris` (\r\n                `favoris_id` bigint(20) NOT NULL auto_increment,\r\n                `favoris_user` int(11) NOT NULL default '0',\r\n                `favoris_code` varchar(7) NOT NULL default '',\r\n                PRIMARY KEY  (`favoris_id`)\r\n              ) /*! ENGINE=MyISAM */ COMMENT='table des favoris'";
     $this->addQuery($query);
     $this->makeRevision("0.1");
     $query = "ALTER TABLE `ccamfavoris` \r\n                CHANGE `favoris_id` `favoris_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n                CHANGE `favoris_user` `favoris_user` int(11) unsigned NOT NULL DEFAULT '0';";
     $this->addQuery($query);
     $this->makeRevision("0.11");
     $query = "ALTER TABLE `ccamfavoris`\r\n                ADD `object_class` VARCHAR(25) NOT NULL DEFAULT 'COperation';";
     $this->addQuery($query);
     $this->makeRevision("0.12");
     $query = "ALTER TABLE `ccamfavoris` \r\n                ADD INDEX (`favoris_user`);";
     $this->addQuery($query);
     $this->makeRevision("0.13");
     $query = "CREATE TABLE `frais_divers` (\r\n                `frais_divers_id` INT (11) UNSIGNED NOT NULL auto_increment PRIMARY KEY,\r\n                `type_id` INT (11) UNSIGNED NOT NULL,\r\n                `coefficient` FLOAT NOT NULL DEFAULT '1',\r\n                `quantite` INT (11) UNSIGNED,\r\n                `facturable` ENUM ('0','1') NOT NULL DEFAULT '0',\r\n                `montant_depassement` DECIMAL  (10,3),\r\n                `montant_base` DECIMAL  (10,3),\r\n                `executant_id` INT (11) UNSIGNED NOT NULL,\r\n                `object_id` INT (11) UNSIGNED NOT NULL,\r\n                `object_class` VARCHAR (255) NOT NULL\r\n              ) /*! ENGINE=MyISAM */;";
     $this->addQuery($query);
     $query = "ALTER TABLE `frais_divers` \r\n                ADD INDEX (`type_id`),\r\n                ADD INDEX (`executant_id`),\r\n                ADD INDEX (`object_id`);";
     $this->addQuery($query);
     $query = "CREATE TABLE `frais_divers_type` (\r\n                `frais_divers_type_id` INT (11) UNSIGNED NOT NULL auto_increment PRIMARY KEY,\r\n                `code` VARCHAR (16) NOT NULL,\r\n                `libelle` VARCHAR (255) NOT NULL,\r\n                `tarif` DECIMAL (10,3) NOT NULL,\r\n                `facturable` ENUM ('0','1') NOT NULL DEFAULT '0'\r\n              ) /*! ENGINE=MyISAM */;";
     $this->addQuery($query);
     $this->makeRevision("0.14");
     $this->addPrefQuery("new_search_ccam", "1");
     $this->makeRevision("0.15");
     $query = "ALTER TABLE `frais_divers` \r\n                CHANGE `facturable` `facturable` ENUM ('0','1') NOT NULL DEFAULT '1';";
     $this->addQuery($query);
     $this->makeRevision("0.16");
     $this->addPrefQuery("multiple_select_ccam", "0");
     $this->makeRevision("0.17");
     $this->addPrefQuery("user_executant", "0");
     $this->makeRevision("0.18");
     $this->addDependency("dPcabinet", "0.1");
     $this->addDependency("dPplanningOp", "1.07");
     $query = "ALTER TABLE `frais_divers`\r\n                ADD `execution` DATETIME NOT NULL;";
     $this->addQuery($query);
     $query = "UPDATE `frais_divers`\r\n                INNER JOIN `consultation` ON (`frais_divers`.`object_id` = `consultation`.`consultation_id`)\r\n                INNER JOIN `plageconsult` ON (`consultation`.`plageconsult_id` = `plageconsult`.`plageconsult_id`)\r\n                SET `frais_divers`.`execution` = CONCAT(`plageconsult`.`date`, ' ', `consultation`.`heure`)\r\n                WHERE `frais_divers`.`object_class` = 'CConsultation';";
     $this->addQuery($query);
     $query = "UPDATE `frais_divers`\r\n                INNER JOIN `operations` ON (`frais_divers`.`object_id` = `operations`.`operation_id`)\r\n                INNER JOIN `plagesop` ON (`operations`.`plageop_id` = `plagesop`.`plageop_id`)\r\n                SET `frais_divers`.`execution` = CONCAT(`plagesop`.`date`, ' ', `operations`.`time_operation`)\r\n                WHERE `frais_divers`.`object_class` = 'COperation'\r\n                AND `operations`.`date` IS NULL;";
     $this->addQuery($query);
     $query = "UPDATE `frais_divers`\r\n                INNER JOIN `operations` ON (`frais_divers`.`object_id` = `operations`.`operation_id`)\r\n                SET `frais_divers`.`execution` = CONCAT(`operations`.`date`, ' ', `operations`.`time_operation`)\r\n                WHERE `frais_divers`.`object_class` = 'COperation'\r\n                AND `operations`.`date` IS NOT NULL;";
     $this->addQuery($query);
     $query = "UPDATE `frais_divers`\r\n                INNER JOIN `sejour` ON (`frais_divers`.`object_id` = `sejour`.`sejour_id`)\r\n                SET `frais_divers`.`execution` = `sejour`.`entree`\r\n                WHERE `frais_divers`.`object_class` = 'CSejour';";
     $this->addQuery($query);
     $this->makeRevision("0.19");
     $query = "ALTER TABLE `frais_divers`\r\n                ADD `num_facture` INT (11) UNSIGNED NOT NULL DEFAULT '1'";
     $this->addQuery($query);
     $query = "ALTER TABLE `frais_divers`\r\n                ADD INDEX (`execution`),\r\n                ADD INDEX (`object_class`);";
     $this->addQuery($query);
     $this->makeRevision("0.20");
     $query = "ALTER TABLE `acte_ccam`\r\n                ADD `position_dentaire` VARCHAR (255),\r\n                ADD `numero_forfait_technique` INT (11) UNSIGNED,\r\n                ADD `numero_agrement` BIGINT (20) UNSIGNED,\r\n                ADD `rapport_exoneration` ENUM ('4','7','C','R');";
     $this->addQuery($query);
     $this->makeRevision('0.21');
     $query = "CREATE TABLE `codage_ccam` (\r\n       `codage_ccam_id` INT (11) UNSIGNED NOT NULL auto_increment PRIMARY KEY,\r\n       `association_rule` ENUM('G1', 'EA', 'EB', 'EC', 'ED', 'EE', 'EF', 'EG1', 'EG2',\r\n       'EG3', 'EG4', 'EG5', 'EG6', 'EG7', 'EH', 'EI', 'GA', 'GB', 'G2'),\r\n       `association_mode` ENUM('auto', 'user_choice') DEFAULT 'auto',\r\n       `codable_class` ENUM('CConsultation', 'CSejour', 'COperation') NOT NULL,\r\n       `codable_id` INT (11) UNSIGNED NOT NULL,\r\n       `praticien_id` INT (11) UNSIGNED NOT NULL,\r\n       `locked` ENUM('0', '1') NOT NULL DEFAULT '0'\r\n    ) /*! ENGINE=MyISAM */;";
     $this->addQuery($query);
     $query = "ALTER TABLE `codage_ccam`\r\n      ADD INDEX (`codable_class`, `codable_id`),\r\n      ADD INDEX (`praticien_id`),\r\n      ADD UNIQUE INDEX  (`codable_class`, `codable_id`, `praticien_id`);";
     $this->addQuery($query);
     $this->makeRevision('0.22');
     $query = "ALTER TABLE `codage_ccam`\r\n      ADD `nb_acts` INT (2) NOT NULL;";
     $this->addQuery($query);
     $this->makeRevision('0.23');
     $query = "ALTER TABLE `codage_ccam`\r\n      CHANGE `association_rule` `association_rule` ENUM('G1', 'EA', 'EB', 'EC', 'ED', 'EE', 'EF', 'EG1', 'EG2',\r\n       'EG3', 'EG4', 'EG5', 'EG6', 'EG7', 'EH', 'EI', 'GA', 'GB', 'G2', 'M');";
     $this->addQuery($query);
     $this->makeRevision('0.24');
     $query = "ALTER TABLE  `codage_ccam`\r\n      DROP `nb_acts`;";
     $this->addQuery($query);
     $this->makeRevision('0.25');
     $query = "ALTER TABLE `codage_ccam` DROP INDEX `codable_class_2`;";
     $this->addQuery($query);
     $query = "ALTER TABLE `codage_ccam`\r\n      ADD `activite_anesth` ENUM('0', '1') NOT NULL DEFAULT '0',\r\n      ADD UNIQUE INDEX uk_codage_ccam (`codable_class`, `codable_id`, `praticien_id`, `activite_anesth`);";
     $this->addQuery($query);
     $this->makeRevision('0.26');
     $this->addPrefQuery('actes_comp_supp_favoris', '1');
     $query = "ALTER TABLE `acte_ccam`\r\n                ADD `accord_prealable` ENUM ('0', '1') DEFAULT '0',\r\n                ADD `date_demande_accord` DATE;";
     $this->addQuery($query);
     $this->makeRevision('0.27');
     $query = "ALTER TABLE `codage_ccam`\r\n      ADD `date` DATE NOT NULL,\r\n      DROP INDEX uk_codage_ccam;";
     $this->addQuery($query);
     $query = "ALTER TABLE `frais_divers`\r\n                ADD `gratuit` ENUM('0', '1') NOT NULL DEFAULT '0';";
     $this->addQuery($query);
     $this->addMethod('updateDateCodage');
     $this->makeRevision('0.28');
     $query = "CREATE TABLE `devis_codage` (\r\n      `devis_codage_id` INT(11) UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\r\n      `codable_class` ENUM('CConsultation', 'COperation') NOT NULL,\r\n      `codable_id` INT(11) UNSIGNED NOT NULL,\r\n      `patient_id` INT(11) UNSIGNED NOT NULL,\r\n      `praticien_id` INT(11) UNSIGNED NOT NULL,\r\n      `creation_date` DATETIME NOT NULL,\r\n      `date` DATE,\r\n      `event_type` ENUM('CConsultation', 'COperation') DEFAULT 'CConsultation',\r\n      `libelle` VARCHAR (255),\r\n      `comment` TEXT,\r\n      `codes_ccam` VARCHAR(255),\r\n      `facture` ENUM ('0','1') DEFAULT '0',\r\n      `tarif` VARCHAR(50),\r\n      `exec_tarif` DATETIME,\r\n      `consult_related_id` INT (11) UNSIGNED,\r\n      `base` FLOAT(6),\r\n      `dh` FLOAT(6),\r\n      `ht` FLOAT(6),\r\n      `tax_rate` FLOAT\r\n    ) /*! ENGINE=MyISAM */;";
     $this->addQuery($query);
     $query = "ALTER TABLE `devis_codage`\r\n                ADD INDEX (`codable_class`),\r\n                ADD INDEX (`codable_id`);";
     $this->addQuery($query);
     $query = "ALTER TABLE `codage_ccam`\r\n                CHANGE `codable_class` `codable_class` ENUM('CConsultation', 'CSejour', 'COperation', 'CDevisCodage') NOT NULL;";
     $this->addQuery($query);
     $this->makeRevision('0.29');
     $this->addPrefQuery('precode_modificateur_7', CAppUi::conf('dPccam CCodable precode_modificateur_7'));
     $this->addPrefQuery('precode_modificateur_J', CAppUi::conf('dPccam CCodable precode_modificateur_J'));
     $this->makeRevision('0.30');
     $this->makeRevision('0.31');
     $this->addPrefQuery('spread_modifiers', 0);
     $this->mod_version = '0.32';
     // Data source query
     // Nouvelle version CCAM
     $query = "SHOW TABLES LIKE 'p_acte'";
     $this->addDatasource("ccamV2", $query);
     // Tarifs de convergence
     if (array_key_exists('ccamV2', CAppUI::conf('db'))) {
         $dsn = CSQLDataSource::get('ccamV2');
         if ($dsn->fetchRow($dsn->exec('SHOW TABLES LIKE \'convergence\';'))) {
             // Nouvelle table de convergence
             $query = "SELECT COUNT(*) FROM `convergence` HAVING COUNT(*) = 3761;";
             $this->addDatasource("ccamV2", $query);
         } else {
             $query = "SHOW TABLES LIKE 'convergence'";
             $this->addDatasource("ccamV2", $query);
         }
     }
     // Tarifs NGAP
     $query = "SHOW TABLES LIKE 'tarif_ngap';";
     $this->addDatasource("ccamV2", $query);
     if (array_key_exists('ccamV2', CAppUI::conf('db'))) {
         $dsn = CSQLDataSource::get('ccamV2');
         if ($dsn->fetchRow($dsn->exec('SHOW TABLES LIKE \'tarif_ngap\';'))) {
             // Suppression des actes CNP et VNP (codes exacts CNPSY et VNPSY)
             $query = "SELECT * FROM `tarif_ngap` WHERE `code` = 'CNPSY';";
             $this->addDatasource("ccamV2", $query);
         }
     }
     // Nouvelle architecture CCAM
     $query = "SHOW TABLES LIKE 'p_acte';";
     $this->addDatasource("ccamV2", $query);
     // Version 40 de la CCAM
     $query = "SELECT *\r\n              FROM  `c_notesarborescence`\r\n              WHERE  `CODEMENU` LIKE  '000583'\r\n                AND TEXTE LIKE 'Facturation : Possibilité de facturation de l\\'association des actes GAQE001 et  GCQE001%'";
     $this->addDatasource("ccamV2", $query);
 }