Ejemplo n.º 1
0
 /**
  * Formate la chaine pour l'INSC
  *
  * @param String $string String
  *
  * @return String
  */
 static function formatString($string)
 {
     $String_no_accent = CMbString::removeAccents($string);
     $normalize = preg_replace("/([^A-Za-z])/", " ", $String_no_accent);
     return mb_strtoupper($normalize);
 }
Ejemplo n.º 2
0
 /**
  * Main function
  *
  * @return void
  */
 function run()
 {
     $content = trim(file_get_contents($this->input));
     $lines = preg_replace_callback('/[^"|]\\n/', array('CImportCim10', 'removeLineFeeds'), $content);
     $lines = explode("\n", $lines);
     $headers = array('code', 'type', 'origine', 'date', 'label');
     $insertions = array('chapter' => array(), 'group' => array(), 'category' => array(), 'subcategory' => array(), 'subdivision' => array(), 'inclusion' => array(), 'exclusion' => array(), 'definition' => array(), 'memo' => array(), 'glossaire' => array());
     $deletions = array('inclusion' => array(), 'exclusion' => array(), 'definition' => array(), 'memo' => array(), 'glossaire' => array(), 'subdivision' => array(), 'subcategory' => array(), 'category' => array(), 'group' => array());
     $entry_chapter = null;
     foreach ($lines as $_row => $_line) {
         if ($_row == 0) {
             continue;
         }
         $entry = str_getcsv($_line, '|', '"');
         if (count($entry) != 5) {
             continue;
         }
         $entry = array_combine($headers, str_getcsv($_line, '|', '"'));
         $entry['type'] = strtolower(CMbString::removeAccents($entry['type']));
         switch ($entry['type']) {
             case 'creation chapitre':
                 if (strpos($entry['code'], 'Chapitre') !== false) {
                     $entry_chapter = $entry;
                 } else {
                     $insertions['chapter'][] = array($entry, $entry_chapter);
                 }
                 break;
             case 'creation groupe':
                 $insertions['group'][] = $entry;
                 break;
             case 'creation categorie':
                 $insertions['category'][] = $entry;
                 break;
             case 'creation sous-categorie':
                 $insertions['subcategory'][] = $entry;
                 break;
             case 'subdivision de libelle':
                 $insertions['subdivision'][] = $entry;
                 break;
             case 'ajout note d\'inclusion':
                 $insertions['inclusion'][] = $entry;
                 break;
             case 'ajout note d\'exclusion':
                 $insertions['exclusion'][] = $entry;
                 break;
             case 'ajout note de definition':
                 $insertions['definition'][] = $entry;
                 break;
             case 'ajout note d\'utilisation':
                 $insertions['memo'][] = $entry;
                 break;
             case 'suppression subdivision':
                 $deletions['subdivision'][] = $entry;
                 break;
             case 'suppression sous-categorie':
                 $deletions['subcategory'][] = $entry;
                 break;
             case 'suppression categorie':
                 $deletions['category'][] = $entry;
                 break;
             case 'suppression groupe':
                 $deletions['group'][] = $entry;
                 break;
             case 'suppression note d\'exclusion':
                 $deletions['exclusion'][] = $entry;
                 break;
             case 'suppression note d\'inclusion':
                 $deletions['inclusion'][] = $entry;
                 break;
             case 'suppression note d\'utilisation':
                 $deletions['memo'][] = $entry;
                 break;
             case 'suppression note de definition':
                 $deletions['definition'][] = $entry;
                 break;
             case 'suppression note d\'utilisation et d\'inclusion':
                 $labels = explode('#EOL', $entry['label']);
                 foreach ($labels as $_label) {
                     $_entry = $entry;
                     /* Utilisation note */
                     if (strpos($_label, 'Note') === 0) {
                         $_entry['label'] = str_replace('Note : ', '', $_label);
                         $deletions['memo'][] = $_entry;
                     } else {
                         $_entry['label'] = str_replace('Comprend : ', '', $_label);
                         $deletions['inclusion'][] = $_entry;
                     }
                 }
                 break;
             default:
                 continue;
                 break;
         }
     }
     foreach ($insertions as $_type => $_insertions) {
         foreach ($_insertions as $_insert) {
             $this->add($_type, $_insert);
         }
     }
     CAppUI::stepAjax("{$this->added_codes} codes ont été ajoutés à la CIM10", UI_MSG_OK);
     CAppUI::stepAjax("{$this->added_inclusions} notes d'inclusions ont été ajoutées à la CIM10", UI_MSG_OK);
     CAppUI::stepAjax("{$this->added_exclusions} notes d'exclusions ont été ajoutées à la CIM10", UI_MSG_OK);
     CAppUI::stepAjax("{$this->added_notes} notes (descriptions, memos) ont été ajoutées à la CIM10", UI_MSG_OK);
     foreach ($deletions as $_type => $_deletions) {
         foreach ($_deletions as $_delete) {
             $this->delete($_type, $_delete);
         }
     }
     CAppUI::stepAjax("{$this->deleted_codes} codes ont été supprimés de la CIM10", UI_MSG_OK);
     CAppUI::stepAjax("{$this->deleted_inclusions} notes d'inclusions ont été supprimées de la CIM10", UI_MSG_OK);
     CAppUI::stepAjax("{$this->deleted_exclusions} notes d'exclusions ont été supprimées de la CIM10", UI_MSG_OK);
     CAppUI::stepAjax("{$this->deleted_notes} notes (descriptions, memos) ont été supprimées de la CIM10", UI_MSG_OK);
 }