-- XML処方
create table xml_recipe (
  xml_recipe_id int auto_increment not null comment 'XML処方ID'
  , file_name VARCHAR(128) not null comment 'ファイル名'
  , xml_contents text not null comment 'XMLコンテンツ'
  , doctor_id INT not null comment 'ドクターID'
  , card_number VARCHAR(100) not null comment '診察券番号'
  , patient_code VARCHAR(128) not null comment '患者コード(from PORT API)'
  , export_flag tinyint not null comment '出力フラグ(0:未, 1:済)'
  , date_regist DATETIME not null comment '登録日時'
  , constraint xml_recipe_PKC primary key (xml_recipe_id,date_regist)
) comment 'XML処方' engine=innodb default charset=utf8;


-- XML経過
create table xml_process (
  xml_process_id int auto_increment not null comment 'XML経過ID'
  , file_name VARCHAR(128) not null comment 'ファイル名'
  , xml_contents text not null comment 'XMLコンテンツ'
  , doctor_id INT not null comment 'ドクターID'
  , card_number VARCHAR(100) not null comment '診察券番号'
  , patient_code VARCHAR(128) not null comment '患者コード(from PORT API)'
  , export_flag tinyint not null comment '出力フラグ(0:未, 1:済)'
  , date_regist DATETIME not null comment '登録日時'
  , constraint xml_process_PKC primary key (xml_process_id,date_regist)
) comment 'XML経過' engine=innodb default charset=utf8 ;


-- 患者コード
create table patient_code (
  card_number VARCHAR(100) not null comment '診察券番号'
  , patient_code VARCHAR(20) not null comment '患者コード'
  , insurance_no VARCHAR(12) comment '保険組番号'
  , insurance_name VARCHAR(64) comment '保険名称'
  , date_regist DATETIME not null comment '登録日時'
  , date_update DATETIME not null comment '更新日時'
  , constraint patient_code_PKC primary key (card_number)
) comment '患者コード' engine=innodb default charset=utf8;

