fuyu 5 gadi atpakaļ
vecāks
revīzija
ed713ada44

+ 2 - 2
server/bin/server.js

@@ -7,9 +7,9 @@ import config from '../config'
 
 //建立MYSQL连接
 require('../src/new_dao');
-require('../src/old_dao');
+// require('../src/old_dao');
 require('../src/old_dao2');
-require('../src/test_dao');
+// require('../src/test_dao');
 //创建Koa对象
 const app = new Koa()
 

+ 2 - 2
server/config/env/development.js

@@ -42,8 +42,8 @@ export default {
   //   database: 'pacsonline_pro',
   // },
   dbconfig5: {
-    host: '10.46.2.149',
-    port: '3306',
+    host: '117.50.71.166',
+    port: '7001',
     username: 'pacs_pro',
     password: 'Zskk@2019~!@#',
     database: 'pacsonline_pro',

+ 454 - 80
server/src/modules/import/controller.js

@@ -42,7 +42,7 @@ import {
   Wechat_bind as OldWechat_bind,
   Wechat_pay_log as OldWechat_pay_log,
   Wechat_refund_log as OldWechat_refund_log
-} from '../../old_dao'
+} from '../../old_dao2'
 
 
 import {
@@ -88,8 +88,9 @@ import {
   Version as TestVersion,
   Wechat_bind as TestWechat_bind,
   Wechat_pay_log as TestWechat_pay_log,
-  Wechat_refund_log as TestWechat_refund_log
-} from '../../test_dao';
+  Wechat_refund_log as TestWechat_refund_log,
+  Register as TestRegister
+} from '../../new_dao';
 // exam
 // register 
 // messages is_remote exam_id
@@ -107,136 +108,388 @@ import {
 // Studies as TestStudies,
 
 import Sequelize from 'sequelize'
+const fs = require('fs');
+const path = require('path');
+
+export async function message(ctx) {
+  // is_remote exam_id              doctor_id = req_doctor_id 相等是2
+  const messages = await TestMessages.findAll();
+  for (let i = 0; i < messages.length; i++) {
+    const message = messages[i];
+    const application_id = message.application_id;
+    const application = await TestRemote_application.findOne({ where: { id: application_id } });
+    if (application) {
+      message.exam_id = application.exam_id;
+      message.is_remote = application.req_doctor_id === message.doctor_id ? '2' : '1';
+      await message.save();
+    }
+  }
+  ctx.body = true;
+}
+
+
+
+export async function report(ctx) {
+  const doctors = await TestDoctors.findAll();
+  const doctorMap = {}
+  for (let i = 0; i < doctors.length; i++) {
+    const doctor = doctors[i];
+    doctorMap[doctor.id] = doctor.realname;
+  }
+  let res = await limitCallBack(TestReport, 'report', reportCallback, { doctorMap });
+  ctx.body = res;
+  // report_doctor_name review_doctor_name confirm_doctor_name
+}
+
+export async function reportCallback(report, { doctorMap }) {
+  report.report_doctor_name = doctorMap[report.report_doctor_id];
+  report.review_doctor_name = doctorMap[report.review_doctor_id];
+  report.confirm_doctor_name = doctorMap[report.confirm_doctor_id];
+  await report.save();
+  // report_doctor_name review_doctor_name confirm_doctor_name
+}
+
+
+export async function exam(ctx) {
+  let res = await limitMultipleCallBack(TestExams, 'exams', examCallbck);
+  ctx.body = res;
+
+  // name card_num studyid sex age birthday  exam_sub_class body_part device_name
+  // report_result report_status:远程
+  // del_datetime:del_time del_doctor_id:null
+}
+let count = 0;
+export async function examCallbck(exam) {
+  const patient = await TestPatient_infos.findOne({ where: { id: exam.patient_id } })
+  const study = await TestStudies.findOne({ where: { id: exam.study_id } })
+  const report = await TestReport.findOne({ where: { exam_id: exam.id, type: '1' } })
+  if (patient) {
+    let sex = patient && patient.sex;
+    if (sex === '男' || sex === 'M') {
+      sex = 'M';
+    } else if (sex === '女' || sex === 'F') {
+      sex = 'F';
+    } else {
+      sex = 'O';
+    }
+    exam.name = patient.name;
+    exam.sex = sex;
+    exam.age = patient.age;
+    exam.birthday = patient.birthday;
+  }
+
+  if (report) {
+    exam.report_result = report.report_result;
+  }
+  if (study) {
+    study.exam_id = exam.id;
+    exam.studyid = study.studyid;
+    exam.studyuid = study.studyuid;
+    exam.body_part = study.partExamined;
+    await study.save();
+  } else {
+    exam.studyuid = 'nono';
+  }
+  await exam.save();
+  // const register = await TestRegister.findOne({ where: { exam_id: exam.id } });
+  // if (!register) {
+  //   const oldExam = await OldExams.findOne({ where: { id: exam.id } });
+  //   await TestRegister.create({
+  //     id: uuid16(),
+  //     exam_id: exam.id,
+  //     register_datetime: oldExam.register_datetime,
+  //     illness_desc: oldExam.illness_desc,
+  //     phys_sign: oldExam.phys_sign,
+  //     clin_symp: oldExam.lin_symp,
+  //     anamnesis: oldExam.anamnesis,
+  //     family_ill: oldExam.film_type,
+  //     clin_diag: oldExam.clin_diag,
+  //     ext: oldExam.ext
+  //   })
+  // }
+  console.log(count++);
+  // name card_num studyid sex age birthday  exam_sub_class body_part device_name
+  // report_result report_status:远程
+  // del_datetime:del_time del_doctor_id:null
+}
+
+export let uuid16 = () => {
+  function S4() {
+    return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
+  }
+  return ('1' + new Date().getTime().toString(16) + S4());
+}
+
+export async function register(ctx) {
+  // id: { type: Sequelize.STRING(255), allowNull: false, primaryKey: true, comment: ''},
+  // exam_id: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查key'},
+  // exam_sub_class: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查子类'},
+  // body_part: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查部位'},
+  // null device_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查设备'},
+  // null technician_id: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查技师ID'},
+  // null technician_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查技师姓名'},
+  // null technician_datetime: { type: Sequelize.DATE, allowNull: true, primaryKey: false, comment: '计划检查时间'},
+  // null register_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '登记医师ID'},
+  // null register_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '登记医师姓名'},
+  // register_datetime: { type: Sequelize.DATE, allowNull: true, primaryKey: false, comment: '登记时间'},
+  // illness_desc: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '患者主诉'},
+  // phys_sign: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '体征'},
+  // clin_symp: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '症状'},
+  // anamnesis: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '疾病史'},
+  // family_ill: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '家族病史'},
+  // application_department: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '申请科室'},
+  // clin_diag: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '初步诊断'},
+  // ext: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '备注'},
+  // null clin_department: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '送诊科室'},
+  // null clin_doctors_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '送诊医生ID'},
+  // null clin_doctors_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '送诊医生姓名'},
+  // null clin_datetime: { type: Sequelize.DATE, allowNull: true, primaryKey: false, comment: '送诊时间'},
+}
+
+// exam report
+export async function remoteApplication(ctx) {
+  const applications = await TestRemote_application.findAll();
+  const hospitals = await TestInstitution.findAll();
+  const hospitalMap = {}
+  for (let i = 0; i < hospitals.length; i++) {
+    const hospital = hospitals[i];
+    if (hospital)
+      hospitalMap[hospital.id] = hospital.name;
+  }
+
+  const doctors = await TestDoctors.findAll();
+  const doctorMap = {}
+  for (let i = 0; i < doctors.length; i++) {
+    const doctor = doctors[i];
+    doctorMap[doctor.id] = doctor.realname;
+  }
+  for (let i = 0; i < applications.length; i++) {
+    const application = applications[i];
+    const exam = await TestExams.findOne({ where: { id: application.exam_id } });
+    if (exam) {
+      application.name = exam.name;
+      application.patient_num = exam.patient_num;
+      application.accession_num = exam.accession_num;
+      application.card_num = exam.card_num;
+      application.sex = exam.sex;
+      application.age = exam.age;
+      application.birthday = exam.birthday;
+      application.exam_sub_class = exam.exam_sub_class;
+      application.body_part = exam.body_part;
+      application.device_name = exam.device_name;
+      application.exam_datetime = exam.exam_datetime;
+      application.exam_class = exam.exam_class;
+      application.exam_project = exam.exam_project;
+      application.study_id = exam.study_id;
+      application.studyid = exam.studyid;
+      application.exam_sub_class = exam.exam_sub_class;
+      application.body_part = exam.body_part;
+      application.device_name = exam.device_name;
+    }
+
+    application.pay_status = '1';
+    application.local_institution_name = hospitalMap[application.local_institution_id];
+    application.remote_institution_name = hospitalMap[application.remote_institution_id];
+    application.req_doctor_name = doctorMap[application.req_doctor_id];
+    application.remote_doctor_name = doctorMap[application.req_doctor_id];
+    const report = await TestReport.findOne({ where: { exam_id: application.exam_id, type: '2' } })
+    if (report) {
+      application.report_result = report.report_result;
+      if (exam) {
+        exam.report_result = application.report_status;
+        await exam.save();
+      }
+
+    }
+    await application.save();
+  }
+  ctx.body = true;
+  // report_result
+  // name sex age patient_num accession_num card_num birthday
+  // exam_datetime exam_class exam_project body_part exam_sub_class study_id
+  // local_institution_name req_doctor_name remote_institution_name
+  // pay_status:1
+}
+
+
+
 export async function normalLimit(ctx) {
+  const res = {};
   // await copyLimit(OldMessages, TestMessages, 'id');
   // await copyLimit(OldRemote_application, TestRemote_application, 'id');
 
-  await copyLimit(OldImages, TestImages, 'id');
-  // await copyLimit(OldSeries, TestSeries, 'id');
-  // await copyLimit(OldStudies, TestStudies, 'id');
-  // await copyLimit(OldPatient_infos, TestPatient_infos, 'id');
+  // await copyLimit(OldImages, TestImages, 'id');
+
+  // res.patient_infos = await copyLimit(OldPatient_infos, TestPatient_infos, 'id', 'patient_infos');
+  // res.studies = await copyLimit(OldStudies, TestStudies, 'id', 'studies');
+  // res.exams = await copyLimit(OldExams, TestExams, 'id', 'exams');
+  // res.report = await copyLimit(OldReport, TestReport, 'id', 'report');
+  // res.series = await copyLimit(OldSeries, TestSeries, 'id', 'series');
+  res.images = await copyLimit(OldImages, TestImages, 'id', 'images');
+
+  const fileUri = path.join(__dirname, '../../logs', 'normalLimit.log');
+  fs.writeFileSync(fileUri, JSON.stringify(res));
+  ctx.body = res;
 }
 
 export async function normal(ctx) {
+  const res = {};
+
+  // Messages
+  res.message = await copy(OldMessages, TestMessages, 'id', 'message');
+  // Remote_application
+  res.remote_application = await copy(OldRemote_application, TestRemote_application, 'id', 'remote_application');
+
   // Bbs
-  await copy(OldBbs, TestBbs, 'id', 'bbs');
+  res.bbs = await copy(OldBbs, TestBbs, 'id', 'bbs');
   // Bodypart
-  await copy(OldBodypart, TestBodypart, 'id', 'bodypart');
+  res.bodypart = await copy(OldBodypart, TestBodypart, 'id', 'bodypart');
   // Constant
-  await copy(OldConstant, TestConstant, 'id', 'constant');
+  res.constant = await copy(OldConstant, TestConstant, 'id', 'constant');
   // Default_cost
-  await copy(OldDefault_cost, TestDefault_cost, 'id', 'default_cost');
+  res.default_cost = await copy(OldDefault_cost, TestDefault_cost, 'id', 'default_cost');
   // Department
-  await copy(OldDepartment, TestDepartment, 'id', '');
+  res.department = await copy(OldDepartment, TestDepartment, 'id', 'department');
   // Device
-  await copy(OldDevice, TestDevice, 'id');
+  res.device = await copy(OldDevice, TestDevice, 'id', 'device');
   // Doctor_class
-  await copy(OldDoctor_class, TestDoctor_class, 'id');
+  res.doctor_class = await copy(OldDoctor_class, TestDoctor_class, 'id', 'doctor_class');
   // Doctors
-  await copy(OldDoctors, TestDoctors, 'id');
+  res.doctors = await copy(OldDoctors, TestDoctors, 'id', 'doctors');
   // Dr_cla_permission
-  await copy(OldDr_cla_permission, TestDr_cla_permission, 'id');
+  res.dr_cla_permission = await copy(OldDr_cla_permission, TestDr_cla_permission, 'id', 'dr_cla_permission');
   // Every_studies
-  await copy(OldEvery_studies, TestEvery_studies, 'id');
+  res.every_studies = await copy(OldEvery_studies, TestEvery_studies, 'id', 'every_studies');
   // Exam_class
-  await copy(OldExam_class, TestExam_class, 'id');
+  res.exam_clas = await copy(OldExam_class, TestExam_class, 'id', 'exam_clas');
   // Exam_project
-  await copy(OldExam_project, TestExam_project, 'id');
+  res.exam_project = await copy(OldExam_project, TestExam_project, 'id', 'exam_project');
   // Exam_subclass
-  await copy(OldExam_subclass, TestExam_subclass, 'id');
+  res.exam_subclass = await copy(OldExam_subclass, TestExam_subclass, 'id', 'exam_subclass');
   // Institution
-  await copy(OldInstitution, TestInstitution, 'id');
-  // Menu as TestMenu,
-  await copy(OldMenu, TestMenu, 'id');
-  // Messages as TestMessages,
-  await copy(OldManager, TestManager, 'id');
-  // Open_application as TestOpen_application,
-  await copy(OldOpen_application, TestOpen_application, 'id');
-  // Operating as TestOperating,
-  await copy(OldOperating, TestOperating, 'id');
-  // Remote_contact as TestRemote_contact,
-  await copy(OldRemote_contact, TestRemote_contact, 'id');
-  // Remote_cost as TestRemote_cost,
-  await copy(OldRemote_cost, TestRemote_cost, 'id');
-  // Remote_order as TestRemote_order,
-  await copy(OldRemote_order, TestRemote_order, 'id');
-  // Remote_water as TestRemote_water,
-  await copy(OldRemote_water, TestRemote_water, 'id');
-  // Remote_water_log as TestRemote_water_log,
-  await copy(OldRemote_water_log, TestRemote_water_log, 'id');
-  // Report_record as TestReport_record,
-  await copy(OldReport_record, TestReport_record, 'id');
-  // Send_message as TestSend_message,
-  await copy(OldSend_message, TestSend_message, 'id');
-  // Sys_logs as TestSys_logs,
-  await copy(OldSys_logs, TestSys_logs, 'id');
-  // Sys_menus as TestSys_menus,
-  await copy(OldSys_menus, TestSys_menus, 'id');
-  // Templates as TestTemplates,
-  await copy(OldTemplates, TestTemplates, 'id');
-  // User as TestUser,
-  await copy(OldUser, TestUser, 'id');
-  // User_bind as TestUser_bind,
-  await copy(OldUser_bind, TestUser_bind, 'id');
-  // Version as TestVersion,
-  await copy(OldVersion, TestVersion, 'id');
-  // Wechat_bind as TestWechat_bind,
-  await copy(OldWechat_bind, TestWechat_bind, 'id');
-  // Wechat_pay_log as TestWechat_pay_log,
-  await copy(OldWechat_pay_log, TestWechat_pay_log, 'id');
-  // Wechat_refund_log as TestWechat_refund_log
-  await copy(OldWechat_refund_log, TestWechat_refund_log, 'id');
+  res.institution = await copy(OldInstitution, TestInstitution, 'id', 'institution');
+  // Menu
+  res.menu = await copy(OldMenu, TestMenu, 'id', 'menu');
+  // Messages
+  res.messages = await copy(OldManager, TestManager, 'id', 'messages');
+  // Open_application
+  res.open_application = await copy(OldOpen_application, TestOpen_application, 'id', 'open_application');
+  // Operating
+  res.operating = await copy(OldOperating, TestOperating, 'id', 'operating');
+  // Remote_contact
+  res.remote_contact = await copy(OldRemote_contact, TestRemote_contact, 'id', 'remote_contact');
+  // Remote_cost
+  res.remote_cost = await copy(OldRemote_cost, TestRemote_cost, 'id', 'remote_cost');
+  // Remote_order
+  res.remote_order = await copy(OldRemote_order, TestRemote_order, 'id', 'remote_order');
+  // Remote_water
+  res.remote_water = await copy(OldRemote_water, TestRemote_water, 'id', 'remote_water');
+  // Remote_water_log
+  res.remote_water_log = await copy(OldRemote_water_log, TestRemote_water_log, 'id', 'remote_water_log');
+  // Report_record
+  res.report_record = await copy(OldReport_record, TestReport_record, 'id', 'report_record');
+  // Send_message
+  res.send_message = await copy(OldSend_message, TestSend_message, 'id', 'send_message');
+  // Sys_logs
+  res.sys_logs = await copy(OldSys_logs, TestSys_logs, 'id', 'sys_logs');
+  // Sys_menus
+  res.sys_menus = await copy(OldSys_menus, TestSys_menus, 'id', 'sys_menus');
+  // Templates
+  res.templates = await copy(OldTemplates, TestTemplates, 'id', 'templates');
+  // User
+  res.user = await copy(OldUser, TestUser, 'id', 'user');
+  // User_bind
+  res.user_bind = await copy(OldUser_bind, TestUser_bind, 'id', 'user_bind');
+  // Version
+  res.version = await copy(OldVersion, TestVersion, 'id', 'version');
+  // Wechat_bind
+  res.wechat_bind = await copy(OldWechat_bind, TestWechat_bind, 'id', 'wechat_bind');
+  // Wechat_pay_log
+  res.wechat_pay_log = await copy(OldWechat_pay_log, TestWechat_pay_log, 'id', 'wechat_pay_log');
+  // Wechat_refund_log
+  res.wechat_refund_log = await copy(OldWechat_refund_log, TestWechat_refund_log, 'id', 'wechat_refund_log');
+  ctx.body = res;
 }
-
-async function copy(oldDb, newDb, key) {
+async function copy(oldDb, newDb, key, tableName) {
   if (!newDb) {
-    return
+    return { tableName, err: '没有新库' }
   }
   let olds = await oldDb.findAll();
-
+  const errors = [];
   for (let i = 0; i < olds.length; i++) {
     const where = {};
     where[key] = olds[i][key];
-    console.log('where', where, newDb)
     const old = await newDb.findOne({ where });
 
     if (!old) {
-      console.log(olds[i].dataValues)
-      newDb.create({...olds[i].dataValues });
+      try {
+        newDb.create({...olds[i].dataValues });
+      } catch (err) {
+        errors.push(err.getMessage());
+      }
     }
   }
+  const oldCount = await oldDb.count();
+  const newCount = await newDb.count();
+
+  return {
+    tableName,
+    oldCount,
+    newCount,
+    dCount: newCount - oldCount,
+    errors
+  }
 }
 const Op = Sequelize.Op;
-async function copyLimit(oldDb, newDb, key) {
+async function copyLimit(oldDb, newDb, key, tableName) {
   if (!newDb) {
-    return
+    return { tableName, err: '没有新表' }
   }
   let createdAt = null;
   let id = null;
-  const limit = 1000;
+  const limit = 1;
   const order = [
     ['id', 'asc']
   ];
-
-  let olds = await oldDb.findAll({ limit, order });
+  const errors = [];
+  let olds = await oldDb.findAll({
+    limit,
+    order,
+    // where: {
+    //   id: {
+    //     [Sequelize.Op.gt]: '116cc1a93d0ad836'
+    //   }
+    // }
+  });
   while (olds && olds.length) {
     for (let i = 0; i < olds.length; i++) {
       const where = {};
       where[key] = olds[i][key];
-
-      const old = await newDb.findOne({ where });
+      console.log('old', where)
+      const old = await newDb.findAll({ where });
+      console.log('old', old)
       if (!old) {
-        console.log(olds[i].dataValues)
         let obj = {...olds[i].dataValues };
-        if (!obj.size) {
-          obj.size = 0;
+        // if (tableName === 'images') {
+        //   obj.image_id = obj.imageId;
+        //   obj.sop_uid = obj.sopUid;
+        //   obj.image_number = obj.imageNumber;
+        //   obj.window_width = obj.windowWidth;
+        //   obj.windo_center = obj.windoCenter;
+        //   obj.pixe_spacing = obj.pixeSpacing;
+        //   obj.image_position = obj.imagePosition;
+        //   obj.image_orientation = obj.imageOrientation;
+        //   obj.institution_id = obj.hospitalId;
+        // }
+        try {
+          newDb.create(obj);
+        } catch (err) {
+          errors.push(err.getMessage());
         }
-        newDb.create(obj);
       }
       if (olds[i].id) {
         id = olds[i].id;
       }
-      console.log('where', where, newDb, olds[i], createdAt, { where: { id: { "$gte": id } } })
     }
     olds = await oldDb.findAll({
       where: {
@@ -248,8 +501,129 @@ async function copyLimit(oldDb, newDb, key) {
       order
     });
   }
+  const oldCount = await oldDb.count();
+  const newCount = await newDb.count();
+  return {
+    tableName,
+    oldCount,
+    newCount,
+    dCount: newCount - oldCount,
+    errors
+  }
+}
+
+
+
+export async function limitCallBack(DbController, tableName, callback, param) {
+  let id = null;
+  const limit = 1000;
+  const order = [
+    ['id', 'asc']
+  ];
+  const errors = [];
+  let olds = await DbController.findAll({
+    limit,
+    order
+  });
+  while (olds && olds.length) {
+    for (let i = 0; i < olds.length; i++) {
+      try {
+        await callback(olds[i], param);
+        id = olds[i].id;
+      } catch (err) {
+        console.log(err)
+          // return
+        errors.push(err.getMessage());
+      }
+    }
+    olds = await DbController.findAll({
+      where: {
+        id: {
+          [Sequelize.Op.gt]: id
+        }
+      },
+      limit,
+      order
+    });
+  }
+  return {
+    tableName,
+    errors
+  }
 }
 
+export async function limitMultipleCallBack(DbController, tableName, callback, param) {
+  const dict = '0123456789abcdefghigklmnopqrstuvwxyz';
+
+  let i = 0;
+  let j = 0;
+  while (i < dict.length) {
+    j = 0;
+    while (j < dict.length) {
+      limitMultipleCallBackSingle(DbController, tableName, callback, param, dict[i] + dict[j], dict[i] + dict[j++] + 'ffffffffffffffff');
+    }
+    i++;
+  }
+  // limitMultipleCallBackSingle(DbController, tableName, callback, param, '116d6d', '116d' + 'ffffffffffffffff');
+  // limitMultipleCallBackSingle(DbController, tableName, callback, param, '116f', '116f' + 'ffffffffffffffff');
+}
+
+
+export async function limitMultipleCallBackSingle(DbController, tableName, callback, params, start, end) {
+  let id = start;
+  const limit = 1000;
+  const order = [
+    ['id', 'asc']
+  ];
+  const errors = [];
+  let olds = await DbController.findAll({
+    limit,
+    order,
+    where: {
+      id: {
+        [Sequelize.Op.gt]: id,
+        [Sequelize.Op.lt]: end
+      },
+      study_id: {
+        [Op.ne]: null
+      },
+      studyuid: null
+    },
+  });
+  while (olds && olds.length) {
+    for (let i = 0; i < olds.length; i++) {
+      try {
+        await callback(olds[i], params);
+        id = olds[i].id;
+      } catch (err) {
+        console.log(err)
+          // return
+        errors.push(err.getMessage());
+      }
+    }
+    olds = await DbController.findAll({
+      where: {
+        id: {
+          [Sequelize.Op.gt]: id,
+          [Sequelize.Op.lt]: end
+        },
+        study_id: {
+          [Op.ne]: null
+        },
+        studyuid: null
+      },
+      limit,
+      order
+    });
+  }
+  return {
+    tableName,
+    errors
+  }
+}
+
+
+
 
 // 2.0      
 // bbs  表          (对话表)

+ 16 - 0
server/src/modules/import/router.js

@@ -10,4 +10,20 @@ export default [{
   method: 'POST',
   route: '/limit',
   handlers: [_import.normalLimit]
+}, {
+  method: 'POST',
+  route: '/report',
+  handlers: [_import.report]
+}, {
+  method: 'POST',
+  route: '/message',
+  handlers: [_import.message]
+}, {
+  method: 'POST',
+  route: '/exam',
+  handlers: [_import.exam]
+}, {
+  method: 'POST',
+  route: '/remote',
+  handlers: [_import.remoteApplication]
 }]

+ 16 - 1
server/src/modules/test/controller.js

@@ -2,7 +2,7 @@ import sequelize from '../../new_dao/db/sequelize'
 import { generateKeyPair } from 'crypto';
 const fs = require('fs');
 const path = require('path');
-const database = 'pacsonline_3';
+const database = 'pacsonline_pro';
 export async function test(ctx) {
   const fileUri = path.join(__dirname, '../../test_dao', 'table.json');
   const sql = `SELECT table_name, table_comment FROM information_schema.TABLES WHERE table_schema = '${database}';`;
@@ -30,6 +30,20 @@ export async function test(ctx) {
     // console.log(res)
 }
 
+export async function modifyTable() {
+  const sql = `SELECT table_name, table_comment FROM information_schema.TABLES WHERE table_schema = '${database}';`;
+  const res = await sequelize.query(sql);
+  const tables = getTables(res[0]);
+  console.log('tables', tables)
+  for (let i = 0; i < tables.length; i++) {
+    const table = await getTableDetail(tables[i]);
+    const table_name = table.name;
+    if (table_name !== 'images')
+      await sequelize.query(`alter table ${table_name} modify column createdAt datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', modify column updatedAt datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间';`)
+  }
+
+}
+
 function generateIndex(dbs) {
   console.log(dbs)
   const fileUri = path.join(__dirname, '../../test_dao', 'index.js');
@@ -40,6 +54,7 @@ function generateIndex(dbs) {
 
 }
 
+
 function generateDb(json) {
   const name = json.name;
   // let createdAt = false;

+ 4 - 0
server/src/modules/test/router.js

@@ -6,4 +6,8 @@ export default [{
   method: 'POST',
   route: '/',
   handlers: [test.test]
+}, {
+  method: 'POST',
+  route: '/modify',
+  handlers: [test.modifyTable]
 }]

+ 1 - 1
server/src/new_dao/db/sequelize.js

@@ -2,7 +2,7 @@ import Sequelize from 'sequelize'
 
 import config from '../../../config'
 
-const DB = config.dbconfig2
+const DB = config.dbconfig5
 export default new Sequelize(DB.database, DB.username, DB.password, {
   host: DB.host,
   port: DB.port,

+ 1 - 1
server/src/test_dao/db/sequelize.js

@@ -2,7 +2,7 @@ import Sequelize from 'sequelize'
 
 import config from '../../../config'
 
-const DB = config.dbconfig5
+const DB = config.dbconfig3
 export default new Sequelize(DB.database, DB.username, DB.password, {
   host: DB.host,
   port: DB.port,

+ 36 - 29
server/src/test_dao/exams.js

@@ -1,35 +1,42 @@
 const Sequelize = require('sequelize');
 import sequelize from './db/sequelize';
 
-const Exams = sequelize.define('exams', {
-  id: { type: Sequelize.STRING(50), allowNull: false, primaryKey: true, comment: ''},
-  institution_id: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '医院id'},
-  name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '患者姓名'},
-  phone: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '患者手机号'},
-  card_num: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '患者身份证'},
-  patient_num: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '病历号'},
-  patient_id: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '患者'},
-  accession_num: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查号'},
-  hopitalized_no: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '住院号'},
-  bed_no: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '病床号'},
-  studyid: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查id'},
-  studyuid: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: 'studyuid'},
-  study_id: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '检查key'},
-  exam_class: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查类别'},
-  exam_project: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查项目'},
-  exam_datetime: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '检查时间'},
-  exam_status: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '检查状态'},
-  report_result: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查结果'},
-  report_status: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '远程诊断状态'},
-  pay_status: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '支付状态'},
-  status: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, defaultValue: '1', comment: '删除状态 0 禁用 1 正常'},
-  urgent: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, defaultValue: '0', comment: '是否急诊 0 否 1是'},
-  severe: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, defaultValue: '0', comment: '重症标识 0 否 1 是'},
-  film_type: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, defaultValue: '2', comment: '胶片属性:0 未定义  1传统胶片  2电子胶片'},
-  del_datetime: { type: Sequelize.DATE, allowNull: true, primaryKey: false, comment: '删除时间'},
-  del_doctor_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '删除医师ID'},
-  del_doctor_name: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '删除医师姓名'},
-},{
+const Exams = sequelize.define('exams', {
+  id: { type: Sequelize.STRING(50), allowNull: false, primaryKey: true, comment: '' },
+  institution_id: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '医院id' },
+  name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '患者姓名' },
+  phone: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '患者手机号' },
+  card_num: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '患者身份证' },
+  patient_num: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '病历号' },
+  patient_id: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '患者' },
+  accession_num: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查号' },
+  hopitalized_no: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '住院号' },
+  bed_no: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '病床号' },
+  studyid: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查id' },
+  studyuid: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: 'studyuid' },
+  study_id: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '检查key' },
+  exam_class: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查类别' },
+  exam_project: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查项目' },
+  exam_datetime: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '检查时间' },
+  exam_status: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '检查状态' },
+  report_result: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查结果' },
+  report_status: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '远程诊断状态' },
+  pay_status: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '支付状态' },
+  status: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, defaultValue: '1', comment: '删除状态 0 禁用 1 正常' },
+  urgent: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, defaultValue: '0', comment: '是否急诊 0 否 1是' },
+  severe: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, defaultValue: '0', comment: '重症标识 0 否 1 是' },
+  film_type: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, defaultValue: '2', comment: '胶片属性:0 未定义  1传统胶片  2电子胶片' },
+  del_datetime: { type: Sequelize.DATE, allowNull: true, primaryKey: false, comment: '删除时间' },
+  del_doctor_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '删除医师ID' },
+  del_doctor_name: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '删除医师姓名' },
+  patient_area: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '病区' },
+  sex: { type: Sequelize.STRING(32), allowNull: true, primaryKey: false, comment: '病区' },
+  age: { type: Sequelize.STRING(32), allowNull: true, primaryKey: false, comment: '病区' },
+  birthday: { type: Sequelize.STRING(32), allowNull: true, primaryKey: false, comment: '病区' },
+  exam_sub_class: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '病区' },
+  body_part: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '病区' },
+  device_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '病区' },
+}, {
   freezeTableName: true,
   charset: 'utf8',
   createdAt: 'createdAt',

+ 44 - 43
server/src/test_dao/remote_application.js

@@ -1,49 +1,50 @@
 const Sequelize = require('sequelize');
 import sequelize from './db/sequelize';
 
-const Remote_application = sequelize.define('remote_application', {
-  id: { type: Sequelize.STRING(50), allowNull: false, primaryKey: true, comment: ''},
-  name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '姓名'},
-  sex: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '性别'},
-  age: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '年龄'},
-  report_result: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查结果'},
-  patient_num: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '病历号'},
-  accession_num: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '检查号'},
-  exam_datetime: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查时间'},
-  exam_class: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查类型'},
-  exam_project: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查项目'},
-  report_status: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '远程诊断状态'},
-  req_date_time: { type: Sequelize.DATE, allowNull: true, primaryKey: false, comment: '邀请时间'},
-  local_institution_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '邀请方医院'},
-  local_institution_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '邀请方医院名称'},
-  req_doctor_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '邀请方医生id'},
-  req_doctor_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '邀请方医生姓名'},
-  remote_institution_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: ''},
-  remote_institution_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '受邀方医院名称'},
-  remote_doctor_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '受邀方医生id'},
-  remote_doctor_name: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '受邀方医生姓名'},
-  illness_desc: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '患者主诉'},
-  clin_symp: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '临床症状'},
-  phys_sign: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '体征'},
-  clin_diag: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '临床诊断'},
-  anamnesis: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '既往史'},
-  family_ill: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '家族史'},
-  remark: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '备注'},
-  exam_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '检查表id'},
-  is_urgent: { type: Sequelize.STRING(20), allowNull: true, primaryKey: false, defaultValue: '0', comment: '是否急诊 0 否 1 是'},
-  status: { type: Sequelize.STRING(20), allowNull: false, primaryKey: false, defaultValue: '0', comment: '删除状态  0 否  1 是'},
-  application_desc: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '申请描述'},
-  attachment: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '附件'},
-  remote_department: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '申请科室'},
-  more: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '补充说明'},
-  odd_number: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '申请单单号'},
-  pay_status: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, defaultValue: '0', comment: '付款状态 0未付款 1已付款'},
-  birthday: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '生日'},
-  card_num: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '身份证号'},
-  body_part: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查部位'},
-  exam_sub_class: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '检查子类'},
-  study_id: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: ''},
-},{
+const Remote_application = sequelize.define('remote_application', {
+  id: { type: Sequelize.STRING(50), allowNull: false, primaryKey: true, comment: '' },
+  name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '姓名' },
+  sex: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '性别' },
+  age: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '年龄' },
+  report_result: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查结果' },
+  patient_num: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '病历号' },
+  accession_num: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '检查号' },
+  exam_datetime: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查时间' },
+  exam_class: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查类型' },
+  exam_project: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查项目' },
+  report_status: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '远程诊断状态' },
+  req_date_time: { type: Sequelize.DATE, allowNull: true, primaryKey: false, comment: '邀请时间' },
+  local_institution_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '邀请方医院' },
+  local_institution_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '邀请方医院名称' },
+  req_doctor_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '邀请方医生id' },
+  req_doctor_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '邀请方医生姓名' },
+  remote_institution_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '' },
+  remote_institution_name: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '受邀方医院名称' },
+  remote_doctor_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '受邀方医生id' },
+  remote_doctor_name: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '受邀方医生姓名' },
+  illness_desc: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '患者主诉' },
+  clin_symp: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '临床症状' },
+  phys_sign: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '体征' },
+  clin_diag: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '临床诊断' },
+  anamnesis: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '既往史' },
+  family_ill: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '家族史' },
+  remark: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '备注' },
+  exam_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '检查表id' },
+  is_urgent: { type: Sequelize.STRING(20), allowNull: true, primaryKey: false, defaultValue: '0', comment: '是否急诊 0 否 1 是' },
+  status: { type: Sequelize.STRING(20), allowNull: false, primaryKey: false, defaultValue: '0', comment: '删除状态  0 否  1 是' },
+  application_desc: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '申请描述' },
+  attachment: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '附件' },
+  remote_department: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '申请科室' },
+  more: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '补充说明' },
+  odd_number: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '申请单单号' },
+  pay_status: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, defaultValue: '0', comment: '付款状态 0未付款 1已付款' },
+  birthday: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '生日' },
+  card_num: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '身份证号' },
+  body_part: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查部位' },
+  exam_sub_class: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '检查子类' },
+  study_id: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '' },
+  phone: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '' },
+}, {
   freezeTableName: true,
   charset: 'utf8',
   createdAt: 'createdAt',

+ 19 - 19
server/src/test_dao/studies.js

@@ -1,25 +1,25 @@
 const Sequelize = require('sequelize');
 import sequelize from './db/sequelize';
 
-const Studies = sequelize.define('studies', {
-  id: { type: Sequelize.STRING(32), allowNull: false, primaryKey: true, comment: ''},
-  studyuid: { type: Sequelize.STRING(200), allowNull: false, primaryKey: true, defaultValue: '', comment: ''},
-  patient_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '患者id'},
-  studyid: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: ''},
-  accession_num: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '科室检查号'},
-  studydate: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: ''},
-  modality: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: ''},
-  status: { type: Sequelize.INTEGER(11), allowNull: true, primaryKey: false, comment: ''},
-  patient_age: { type: Sequelize.STRING(20), allowNull: true, primaryKey: false, comment: ''},
-  institution_name: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '机构名称'},
-  institution_id: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: ''},
-  ext: { type: Sequelize.JSON, allowNull: true, primaryKey: false, comment: ''},
-  exam_id: { type: Sequelize.STRING(32), allowNull: true, primaryKey: false, comment: ''},
-  weight: { type: Sequelize.STRING(20), allowNull: true, primaryKey: false, comment: ''},
-  pregnancy: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: ''},
-  partExamined: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: ''},
-  studyDescribe: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: ''},
-},{
+const Studies = sequelize.define('studies', {
+  id: { type: Sequelize.STRING(32), allowNull: false, primaryKey: true, comment: '' },
+  studyuid: { type: Sequelize.STRING(200), allowNull: false, primaryKey: true, defaultValue: '', comment: '' },
+  patient_id: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '患者id' },
+  studyid: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '' },
+  accession_num: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '科室检查号' },
+  studydate: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '' },
+  modality: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '' },
+  status: { type: Sequelize.INTEGER(11), allowNull: true, primaryKey: false, comment: '' },
+  patient_age: { type: Sequelize.STRING(20), allowNull: true, primaryKey: false, comment: '' },
+  institution_name: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '机构名称' },
+  institution_id: { type: Sequelize.STRING(200), allowNull: true, primaryKey: false, comment: '' },
+  ext: { type: Sequelize.JSON, allowNull: true, primaryKey: false, comment: '' },
+  exam_id: { type: Sequelize.STRING(32), allowNull: true, primaryKey: false, comment: '' },
+  weight: { type: Sequelize.STRING(20), allowNull: true, primaryKey: false, comment: '' },
+  pregnancy: { type: Sequelize.STRING(50), allowNull: true, primaryKey: false, comment: '' },
+  partExamined: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '' },
+  studyDescribe: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '' },
+}, {
   freezeTableName: true,
   charset: 'utf8',
   createdAt: 'createdAt',