fuyu před 4 roky
revize
de5a437f3d
56 změnil soubory, kde provedl 2199 přidání a 0 odebrání
  1. 1 0
      .babelrc
  2. 30 0
      .editorconfig
  3. 5 0
      .eslintrc.json
  4. 14 0
      .gitignore
  5. 57 0
      bin/server.js
  6. 75 0
      build/config.gypi
  7. 12 0
      config/env/common.js
  8. 85 0
      config/env/development.js
  9. 51 0
      config/env/production.js
  10. 46 0
      config/env/test.js
  11. 6 0
      config/index.js
  12. 20 0
      gulpfile.js
  13. 4 0
      index.js
  14. 30 0
      merge.config.js
  15. 45 0
      package.json
  16. 32 0
      src/dao_new/ApplicationProgressLog.js
  17. 33 0
      src/dao_new/Bbs.js
  18. 71 0
      src/dao_new/Exams.js
  19. 50 0
      src/dao_new/Images.js
  20. 43 0
      src/dao_new/PatientInfos.js
  21. 31 0
      src/dao_new/QualityCause.js
  22. 36 0
      src/dao_new/QualityControl.js
  23. 48 0
      src/dao_new/Register.js
  24. 70 0
      src/dao_new/RemoteApplication.js
  25. 56 0
      src/dao_new/RemoteOrder.js
  26. 33 0
      src/dao_new/RemoteWater.js
  27. 43 0
      src/dao_new/Report.js
  28. 32 0
      src/dao_new/ReportRecord.js
  29. 32 0
      src/dao_new/Series.js
  30. 40 0
      src/dao_new/Studies.js
  31. 30 0
      src/dao_new/db/sequelize.js
  32. 32 0
      src/dao_new/index.js
  33. 32 0
      src/dao_old/ApplicationProgressLog.js
  34. 33 0
      src/dao_old/Bbs.js
  35. 71 0
      src/dao_old/Exams.js
  36. 50 0
      src/dao_old/Images.js
  37. 43 0
      src/dao_old/PatientInfos.js
  38. 31 0
      src/dao_old/QualityCause.js
  39. 36 0
      src/dao_old/QualityControl.js
  40. 48 0
      src/dao_old/Register.js
  41. 70 0
      src/dao_old/RemoteApplication.js
  42. 56 0
      src/dao_old/RemoteOrder.js
  43. 33 0
      src/dao_old/RemoteWater.js
  44. 43 0
      src/dao_old/Report.js
  45. 32 0
      src/dao_old/ReportRecord.js
  46. 32 0
      src/dao_old/Series.js
  47. 40 0
      src/dao_old/Studies.js
  48. 30 0
      src/dao_old/db/sequelize.js
  49. 32 0
      src/dao_old/index.js
  50. 11 0
      src/modules/api/controller.js
  51. 17 0
      src/modules/api/router.js
  52. 31 0
      src/modules/index.js
  53. 16 0
      src/service/common.js
  54. 40 0
      src/service/log.js
  55. 152 0
      src/service/move.js
  56. 27 0
      src/service/time.js

+ 1 - 0
.babelrc

@@ -0,0 +1 @@
+{"presets": ["es2015-node5", "stage-0"]}

+ 30 - 0
.editorconfig

@@ -0,0 +1,30 @@
+# http://editorconfig.org
+
+# A special property that should be specified at the top of the file outside of
+# any sections. Set to true to stop .editor config file search on current file
+root = true
+
+[*]
+# Indentation style
+# Possible values - tab, space
+indent_style = space
+
+# Indentation size in single-spaced characters
+# Possible values - an integer, tab
+indent_size = 2
+
+# Line ending file format
+# Possible values - lf, crlf, cr
+end_of_line = lf
+
+# File character encoding
+# Possible values - latin1, utf-8, utf-16be, utf-16le
+charset = utf-8
+
+# Denotes whether to trim whitespace at the end of lines
+# Possible values - true, false
+trim_trailing_whitespace = true
+
+# Denotes whether file should end with a newline
+# Possible values - true, false
+insert_final_newline = true

+ 5 - 0
.eslintrc.json

@@ -0,0 +1,5 @@
+{
+  "parser" : "babel-eslint",
+  "extends": "standard",
+  "env": {"node" : true, "mocha": true}
+}

+ 14 - 0
.gitignore

@@ -0,0 +1,14 @@
+.DS_Store
+node_modules/
+# /dist/
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln

+ 57 - 0
bin/server.js

@@ -0,0 +1,57 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-23 11:56:31
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 13:43:53
+ * @FilePath: /202103/code/sql_merge/bin/server.js
+ */
+// import mongoose from 'mongoose'
+
+import Koa from 'koa'
+// import mount from 'koa-mount'
+// import serve from 'koa-static'
+import logger from 'koa-logger'
+import convert from 'koa-convert'
+// import passport from 'koa-passport'
+import bodyParser from 'koa-bodyparser'
+// import session    from 'koa-generic-session'
+
+import config from '../config'
+
+//建立MYSQL连接
+require('../src/dao_new');
+require('../src/dao_old');
+//创建Koa对象
+const app = new Koa()
+  // app.keys  = [config.session]
+
+//加载中间件
+app.use(convert(logger()))
+  // app.use(convert(session()))
+app.use(convert(bodyParser()))
+//本地访问跨域
+var cors = require('koa-cors');
+app.use(convert(cors()));
+//加载docs
+// app.use(convert(mount('/docs', serve(`${process.cwd()}/docs`))))
+// //加载passport
+// require('../config/passport')
+// app.use(passport.initialize())
+// app.use(passport.session())
+
+//加载路由
+require('../src/modules')(app)
+
+//接入Socket.IO
+const server = require('http').createServer(app.callback());
+// const io = require('socket.io')(server);
+// io.on('connection', (socket) => {
+//   console.log('connection');
+// });
+console.log('config', config)
+  //启动服务
+server.listen(config.port, () => {
+  console.log(`Server started on ${config.port}`)
+});
+
+export default app

+ 75 - 0
build/config.gypi

@@ -0,0 +1,75 @@
+# Do not edit. File was generated by node-gyp's "configure" step
+{
+  "target_defaults": {
+    "cflags": [],
+    "default_configuration": "Release",
+    "defines": [],
+    "include_dirs": [],
+    "libraries": []
+  },
+  "variables": {
+    "asan": 0,
+    "build_v8_with_gn": "false",
+    "coverage": "false",
+    "debug_nghttp2": "false",
+    "enable_lto": "false",
+    "enable_pgo_generate": "false",
+    "enable_pgo_use": "false",
+    "force_dynamic_crt": 0,
+    "host_arch": "x64",
+    "icu_data_in": "../../deps/icu-small/source/data/in/icudt62l.dat",
+    "icu_endianness": "l",
+    "icu_gyp_path": "tools/icu/icu-generic.gyp",
+    "icu_locales": "en,root",
+    "icu_path": "deps/icu-small",
+    "icu_small": "true",
+    "icu_ver_major": "62",
+    "llvm_version": "0",
+    "node_byteorder": "little",
+    "node_debug_lib": "false",
+    "node_enable_d8": "false",
+    "node_enable_v8_vtunejit": "false",
+    "node_install_npm": "true",
+    "node_module_version": 64,
+    "node_no_browser_globals": "false",
+    "node_prefix": "/usr/local",
+    "node_release_urlbase": "https://nodejs.org/download/release/",
+    "node_shared": "false",
+    "node_shared_cares": "false",
+    "node_shared_http_parser": "false",
+    "node_shared_libuv": "false",
+    "node_shared_nghttp2": "false",
+    "node_shared_openssl": "false",
+    "node_shared_zlib": "false",
+    "node_tag": "",
+    "node_target_type": "executable",
+    "node_use_bundled_v8": "true",
+    "node_use_dtrace": "true",
+    "node_use_etw": "false",
+    "node_use_large_pages": "false",
+    "node_use_openssl": "true",
+    "node_use_pch": "false",
+    "node_use_perfctr": "false",
+    "node_use_v8_platform": "true",
+    "node_with_ltcg": "false",
+    "node_without_node_options": "false",
+    "openssl_fips": "",
+    "openssl_no_asm": 0,
+    "shlib_suffix": "64.dylib",
+    "target_arch": "x64",
+    "v8_enable_gdbjit": 0,
+    "v8_enable_i18n_support": 1,
+    "v8_enable_inspector": 1,
+    "v8_no_strict_aliasing": 1,
+    "v8_optimized_debug": 0,
+    "v8_promise_internal_field_count": 1,
+    "v8_random_seed": 0,
+    "v8_trace_maps": 0,
+    "v8_typed_array_max_size_in_heap": 0,
+    "v8_use_snapshot": "true",
+    "want_separate_host_toolset": 0,
+    "xcode_version": "7.0",
+    "nodedir": "/Users/fuyu/Library/Caches/node-gyp/10.15.0",
+    "standalone_static_library": 1
+  }
+}

+ 12 - 0
config/env/common.js

@@ -0,0 +1,12 @@
+/*
+ * @Author: fuyu
+ * @Date: 2020-10-21 19:57:13
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-02-26 18:08:36
+ * @FilePath: /zskk_manage/server/config/env/common.js
+ */
+export default {
+  port: process.env.PORT || 12399,
+  expansion: 1,
+  add: 0
+}

+ 85 - 0
config/env/development.js

@@ -0,0 +1,85 @@
+/*
+ * @Author: fuyu
+ * @Date: 2019-12-12 18:12:16
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 16:06:47
+ * @FilePath: /202103/code/sql_merge/config/env/development.js
+ */
+export default {
+  token: 'secret-jwt-token',
+  session: 'secret-boilerplate-token',
+  mongodb: 'mongodb://localhost:27017/koa2-boilerplate-dev',
+  limit: 100,
+  old_db_config: {
+    database: 'pacsonline_pro',
+    username: 'pacs_pro',
+    password: 'Zskk@2019~!@#',
+    host: '117.50.71.166',
+    port: 7001,
+    db_type: 'mysql',
+  },
+  new_db_config: {
+    database: 'by_yj',
+    username: 'root',
+    password: 'admin123',
+    host: '127.0.0.1',
+    port: 3306,
+    db_type: 'mysql',
+  },
+
+  //mysql配置
+  // db_type: 'mysql', //数据库类型
+
+  // dbconfig: {
+  //   host    : 'localhost',    //服务器地址
+  //   port    : 3306,           //数据库端口号
+  //   username: 'root',         //数据库用户名
+  //   password: 'admin123',    //数据库密码
+  //   database: 'pacs',         //数据库名称
+  // },
+
+  //mysql配置
+  // dbconfig: {
+  //   host    : 'localhost',    //服务器地址
+  //   port    : 3306,           //数据库端口号
+  //   username: 'root',         //数据库用户名
+  //   password: 'admin123',    //数据库密码
+  //   database: 'pacs',         //数据库名称
+  // },
+
+  // dbtempconfig: {
+  //   host    : 'localhost',    //服务器地址
+  //   port    : 3306,           //数据库端口号
+  //   username: 'root',         //数据库用户名
+  //   password: 'admin123',    //数据库密码
+  //   database: 'pacsonline',         //数据库名称
+  // },
+
+  // dbconfig: {
+  //   host: '117.50.71.166',
+  //   port: '7001',
+  //   username: 'pacs_pro',
+  //   password: 'Zskk@2019~!@#',
+  //   database: 'pacsonline_pro',
+  // },
+
+
+  // dbconfig: {
+  //   host    : '127.0.0.1',  //服务器地址
+  //   port    : 3306,             //数据库端口号
+  //   username: 'root',           //数据库用户名
+  //   password: 'admin123',           //数据库密码
+  //   database: 'pacs_test_local',           //数据库名称
+  // },
+
+
+  //fdfs 配置
+  fdfs: {
+    trackers: [{ host: '47.104.6.21', port: 22122 }],
+    timeout: 10000000,
+    charset: 'utf8'
+  },
+
+  //上传文件配置
+  upload: {}
+}

+ 51 - 0
config/env/production.js

@@ -0,0 +1,51 @@
+/*
+ * @Author: fuyu
+ * @Date: 2019-12-12 18:12:16
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 17:50:25
+ * @FilePath: /202103/code/sql_merge/config/env/production.js
+ */
+export default {
+  token: 'secret-jwt-token',
+  session: 'secret-boilerplate-token',
+  mongodb: 'mongodb://localhost:27017/koa2-boilerplate-dev',
+
+  //mysql配置
+  db_type: 'mysql', //数据库类型
+
+  limit: 100,
+  old_db_config: {
+    database: 'pacsonline_pro',
+    username: 'pacs_pro',
+    password: 'Zskk@2019~!@#',
+    host: '117.50.71.166',
+    port: 7001,
+    db_type: 'mysql',
+  },
+  new_db_config: {
+    database: 'pacsonline_pro',
+    username: 'pacs',
+    password: 'Zskk@2019~!@#',
+    host: '127.0.0.1',
+    port: 3306,
+    db_type: 'mysql',
+  },
+  // 'hostname'        => '10.46.2.149',
+  // // 数据库名
+  // 'database'        => 'pacsonline_pro',
+  // // 用户名
+  // 'username'        => 'pacs_pro',
+  // // 密码
+  // 'password'        => 'Zskk@2019~!@#',
+  // // 端口
+  // 'hostport'        => '3306',
+  //fdfs 配置
+  fdfs: {
+    trackers: [{ host: '127.0.0.1', port: 22122 }],
+    timeout: 10000000,
+    charset: 'utf8'
+  },
+
+  //上传文件配置
+  upload: {}
+}

+ 46 - 0
config/env/test.js

@@ -0,0 +1,46 @@
+export default {
+  token   : 'secret-jwt-token',
+  session : 'secret-boilerplate-token',
+  mongodb : 'mongodb://localhost:27017/koa2-boilerplate-dev',
+  port    : 9998,
+  //mysql配置
+  db_type : 'mysql',          //数据库类型
+
+  // dbconfig: {
+  //   host    : 'localhost',    //服务器地址
+  //   port    : 3306,           //数据库端口号
+  //   username: 'root',         //数据库用户名
+  //   password: 'admin123',     //数据库密码
+  //   database: 'pacs',         //数据库名称
+  //   prefix  : 'api_'          //默认"api_"    
+  // },
+//mysql配置
+  dbconfig: {
+    host    : '127.0.0.1',            
+    port    : '3306',                 
+    username: 'pacs',            
+    password: 'ZSKK@2017~!@#',          
+    database: 'pacs_test',
+  },
+  /**
+  //mysql配置
+  dbconfig: {
+    host    : '119.29.239.64',    //服务器地址
+    port    : 3306,           //数据库端口号
+    username: 'fuyu',         //数据库用户名
+    password: 'fyuu',     //数据库密码
+    database: 'pacs',         //数据库名称
+    prefix  : 'api_'          //默认"api_"
+  }
+  */
+
+  //fdfs 配置
+  fdfs: {
+    trackers: [{host: '127.0.0.1', port: 22122}],
+    timeout : 100000,
+    charset : 'utf8'          
+  },
+
+  //上传文件配置
+  upload: {}
+}

+ 6 - 0
config/index.js

@@ -0,0 +1,6 @@
+import common from './env/common'
+
+//默认无开发环境
+const env = process.env.NODE_ENV || 'development'
+const config = require(`./env/${env}`).default
+export default Object.assign({}, common, config)

+ 20 - 0
gulpfile.js

@@ -0,0 +1,20 @@
+const gulp    = require('gulp')
+const nodemon = require('gulp-nodemon')
+
+var jsScript = 'node';
+if (process.env.npm_config_argv.indexOf('debug') > 0) {  
+  jsScript = 'node debug';
+}
+
+gulp.task('nodemon', function (){
+  return nodemon({
+    script : 'index.js',
+    ext    : 'js json',
+    execMap: {js: jsScript},
+    env    : {NODE_ENV: 'development'},
+    verbose: true,
+    ignore : ['build/*.js', 'dist/*.js', 'nodemon.json', '.git', 'node_modules/**/node_modules', 'gulpfile.js'],
+  });
+});
+
+gulp.task('default', ['nodemon'], function () {});

+ 4 - 0
index.js

@@ -0,0 +1,4 @@
+require('babel-polyfill')
+require('babel-core/register')()
+
+require('./bin/server.js')

+ 30 - 0
merge.config.js

@@ -0,0 +1,30 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-23 11:56:31
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 17:49:35
+ * @FilePath: /202103/code/sql_merge/merge.config.js
+ */
+/**
+ * PM2启动配置
+ */
+module.exports = {
+  apps: [{
+      name: "merge",
+      script: 'index.js',
+
+      watch: ['src'],
+      ignore_watch: ['node_modules', 'dist', 'logs'],
+
+      out_file: '/data/logs/pm2/merge/out.log',
+      error_file: '/data/logs/pm2/merge/error.log',
+
+      max_memory_restart: '2G', //超过多大内存自动重启,仅防止内存泄露有意义,需要根据自己的业务设置
+      exec_mode: 'cluster', //开启多线程模式,用于负载均衡
+      instances: '1', //启用多少个实例,可用于负载均衡
+      autorestart: true, //程序崩溃后自动重启
+
+      env: { NODE_ENV: 'production' },
+    }
+  ]
+}

+ 45 - 0
package.json

@@ -0,0 +1,45 @@
+{
+  "name": "pacs-api",
+  "main": "index.js",
+  "version": "1.0.0",
+  "keywords": [],
+  "scripts": {
+    "start": "node index.js",
+    "build": "babel src -d dist",
+    "dev": "./node_modules/.bin/nodemon index.js",
+    "test": "NODE_ENV=test ./node_modules/.bin/mocha --compilers js:babel-register --require babel-polyfill"
+  },
+  "dependencies": {
+    "babel-core": "^6.25.0",
+    "babel-polyfill": "^6.26.0",
+    "babel-preset-es2015-node5": "^1.2.0",
+    "babel-preset-stage-0": "^6.24.1",
+    "babel-register": "^6.26.0",
+    "bcrypt": "^3.0.2",
+    "busboy": "^0.2.14",
+    "dicom-parser": "1.7.3",
+    "fdfs": "^1.0.4",
+    "glob": "^7.1.2",
+    "koa": "^2.3.0",
+    "koa-bodyparser": "^4.2.1",
+    "koa-convert": "^1.2.0",
+    "koa-cors": "^0.0.16",
+    "koa-generic-session": "^2.0.0",
+    "koa-logger": "^3.0.1",
+    "koa-mount": "^3.0.0",
+    "koa-passport": "^3.0.0",
+    "koa-router": "^7.2.1",
+    "koa-static": "^4.0.1",
+    "mysql2": "^1.3.6",
+    "sequelize": "^4.4.2",
+    "watch": "^1.0.2"
+  },
+  "devDependencies": {
+    "babel-eslint": "^7.2.3",
+    "babel-register": "^6.24.1",
+    "gulp": "^3.9.1",
+    "gulp-nodemon": "^2.2.1",
+    "mocha": "^3.4.2",
+    "nodemon": "^1.11.0"
+  }
+}

+ 32 - 0
src/dao_new/ApplicationProgressLog.js

@@ -0,0 +1,32 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 11:15:15
+ * @FilePath: /202103/code/test/tmp/ApplicationProgressLog.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const ApplicationProgressLog = sequelize.define('application_progress_log', {
+  id: {type: Sequelize.STRING(50),   allowNull: false, primaryKey: true}, // id,
+  operator_id: {type: Sequelize.STRING(50),   allowNull: true, defaultValue: null}, // operator_id, 操作人id
+  operator_name: {type: Sequelize.STRING(255),   allowNull: true, defaultValue: ''}, // operator_name, 操作人姓名
+  current_step: {type: Sequelize.STRING(100),   allowNull: false, defaultValue: ''}, // current_step, 当前操作步骤\r\n1、待支付\r\n2、已支付发起申请\r\n3、已接受\r\n4、已撤回\r\n5、已驳回\r\n6、已写\r\n7、已审核\r\n8、远程确认\r\n9、本地完成\r\n10、取消订单\r\n11、已退款
+  remark: {type: Sequelize.STRING(2000),   allowNull: true}, // remark,
+  application_id: {type: Sequelize.STRING(50),   allowNull: false, defaultValue: ''}, // application_id 申请单id
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['application_id']}
+  ],
+  updatedAt: false
+});
+ApplicationProgressLog.sync({ force: false }).then(function() {});
+export default ApplicationProgressLog;

+ 33 - 0
src/dao_new/Bbs.js

@@ -0,0 +1,33 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-22 19:27:20
+ * @FilePath: /202103/code/test/tmp/Bbs.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+
+const Bbs = sequelize.define('bbs', {
+  id: {type: Sequelize.STRING(50),   allowNull: false, primaryKey: true}, // id,
+  initiator: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // initiator, 发起人
+  reply: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // reply, 回复人
+  remote_application_id: {type: Sequelize.STRING(50),  allowNull: true, defaultValue: null}, // remote_application_id, 申请单id
+  content: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // content, 内容
+  attachment: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // attachment, 附件
+  type: {type: Sequelize.STRING(10), allowNull: true, defaultValue: null}, // type BBS类型\r\n1 发起申请\r\n2 接收申请\r\n3 驳回申请\r\n4 撤回申请\r\n5 完成申请\r\n99 bbs对话
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['remote_application_id']}
+  ],
+});
+Bbs.sync({ force: false }).then(function() {});
+export default Bbs;

+ 71 - 0
src/dao_new/Exams.js

@@ -0,0 +1,71 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 14:10:04
+ * @FilePath: /202103/code/sql_merge/src/dao_new/Exams.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+
+
+const Exams = sequelize.define('exams', {
+  id: {type: Sequelize.STRING(255), allowNull: false, primaryKey: true}, // id,
+  institution_id: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // institution_id, 医院id
+  name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // name, 患者姓名
+  phone: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // phone, 患者手机号
+  card_num: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // card_num, 患者身份证
+  patient_num: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // patient_num, 病历号
+  patient_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // patient_id, 患者key
+  accession_num: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // accession_num, 检查号
+  hopitalized_no: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // hopitalized_no, 住院号
+  bed_no: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // bed_no, 病床号
+  studyid: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // studyid, 检查id
+  studyuid: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // studyuid, studyuid
+  study_id: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // study_id, 检查key
+  exam_class: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_class, 检查类别
+  exam_project: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_project, 检查项目
+  exam_datetime: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // exam_datetime, 检查时间
+  exam_status: {type: Sequelize.INTEGER(10), allowNull: true, defaultValue: 1}, // exam_status, 检查状态\r\n1  登记\r\n2  登记完成\r\n3  影像到达\r\n7  写报告\r\n8  审核报告\r\n9  确认报告
+  report_result: {type: Sequelize.STRING(10), allowNull: true, defaultValue: null}, // report_result, 检查结果  1阴性 2阳性
+  report_status: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // report_status, 远程诊断状态\r\n2  保存完善病例资料\r\n3  完善病例资料保存继续\r\n4  选择医院发起申请\r\n5  驳回申请\r\n6  接收申请\r\n7  写报告\r\n8  审核报告\r\n9  最终完成报告\r\n11  撤回报告\r\n10  确认报告
+  pay_status: {type: Sequelize.STRING(10), allowNull: true, defaultValue: '0'}, // pay_status, 支付状态  0未支付 1已支付
+  status: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '1'}, // status, 删除状态 0 禁用 1 正常
+  urgent: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '0'}, // urgent, 是否急诊 0 否 1是
+  severe: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '0'}, // severe, 重症标识 0 否 1 是
+  film_type: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '2'}, // film_type, 胶片属性:0 未定义  1传统胶片  2电子胶片
+  clin_symp: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // clin_symp, 症状
+  del_datetime: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // del_datetime, 删除时间
+  del_doctor_id: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // del_doctor_id, 删除医师ID
+  del_doctor_name: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // del_doctor_name, 删除医师姓名
+  patient_area: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // patient_area, 病区
+  sex: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // sex, 患者性别
+  age: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // age, 患者年龄
+  birthday: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // birthday, 患者生日
+  exam_sub_class: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_sub_class, 检查子类
+  body_part: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // body_part, 检查部位
+  device_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // device_name, 设备名称
+  application_department: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // application_department, 申请科室
+  application_doctor: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // application_doctor, 申请医生
+  clin_diag: {type: Sequelize.STRING(1000), allowNull: true, defaultValue: null}, // clin_diag, 临床诊断
+  out_patient: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // out_patient, 门诊号
+  ext: {type: Sequelize.JSON,   allowNull: true, defaultValue: null}, // ext,
+  delivery_doctor: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // delivery_doctor, 送诊医生
+  push_api: {type: Sequelize.STRING(255),  allowNull: true, defaultValue: null}, // push_api, 0 推送失败  1推送成功
+  api_message: {type: Sequelize.STRING(500),  allowNull: true, defaultValue: null}, // api_message 失败返回信息
+  flag: {type: Sequelize.INTEGER(11),  allowNull: false, defaultValue: 1}, // flag 标识
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['institution_id', 'flag']}
+  ],
+});
+Exams.sync({ force: false }).then(function() {});
+export default Exams;

+ 50 - 0
src/dao_new/Images.js

@@ -0,0 +1,50 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-22 19:44:50
+ * @FilePath: /202103/code/test/tmp/Images.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const Images = sequelize.define('images', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  series_id: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // series_id, 对应的序列key
+  imageId: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // imageId, 影像ID
+  sopUid: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // sopUid,
+  imageNumber: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: 0}, // imageNumber, 影像号
+  owner: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // owner, 所属人
+  windowWidth: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // windowWidth, 窗宽
+  windoCenter: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // windoCenter, 窗位
+  rows: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // rows, 行
+  columns: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // columns, 队
+  pixeSpacing: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // pixeSpacing, 影像的展示参数
+  imagePosition: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // imagePosition, 影像的展示参数
+  imageOrientation: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // imageOrientation, 影像的展示参数
+  ctime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // ctime, 创建时间
+  utime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // utime, 修改时间
+  url: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // url, 加载地址
+  metadata: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // metadata,
+  size: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // size,
+  hospitalId: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // hospitalId,
+  local_url: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // local_url,
+  remote_url: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // remote_url,
+  status: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: 2}, // status,
+  frame: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: 0}, // frame,
+  cineRate: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: 0}, // cineRate,
+  ext: {type: Sequelize.JSON, allowNull: true, defaultValue: null}, // ext
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['series_id']}
+  ],
+});
+Images.sync({ force: false }).then(function() {});
+export default Images;

+ 43 - 0
src/dao_new/PatientInfos.js

@@ -0,0 +1,43 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-22 19:49:09
+ * @FilePath: /202103/code/test/tmp/PatientInfos.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const PatientInfos = sequelize.define('patient_infos', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  name: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // name, 患者姓名
+  sex: {type: Sequelize.STRING(10), allowNull: true, defaultValue: null}, // sex, 性别
+  card_num: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // card_num, 身份证号
+  phone: {type: Sequelize.STRING(20), allowNull: true, defaultValue: null}, // phone, 手机号
+  ctime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // ctime, 创建时间
+  birthday: {type: Sequelize.STRING(20), allowNull: true, defaultValue: null}, // birthday, 生日
+  age: {type: Sequelize.STRING(10), allowNull: true, defaultValue: null}, // age, 年龄
+  card_type: {type: Sequelize.STRING(30), allowNull: true, defaultValue: null}, // card_type, 证件类型
+  nationality: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // nationality, 国籍
+  nation: {type: Sequelize.STRING(30), allowNull: true, defaultValue: ''}, // nation, 民族
+  marry: {type: Sequelize.STRING(10), allowNull: true, defaultValue: null}, // marry, 婚否
+  professional: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // professional, 职业
+  address: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // address, 联系地址
+  temp_patient_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // temp_patient_id, 检查临时患者id(从dicom影像中解析)
+  status: {type: Sequelize.INTEGER(10), allowNull: false, defaultValue: 1}, // status,
+  institution_id: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // institution_id, 所属医院
+  anamnesis: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // anamnesis, 疾病史
+  family_ill: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // family_ill, 家族史
+  ext: {type: Sequelize.JSON, allowNull: true, defaultValue: null}, // ext,
+  flag: {type: Sequelize.INTEGER(10), allowNull: false, defaultValue: 0}, // flag 标记 1解析 0不知道
+}, {
+  freezeTableName: true,
+  charset: 'utf8'
+});
+PatientInfos.sync({ force: false }).then(function() {});
+export default PatientInfos;

+ 31 - 0
src/dao_new/QualityCause.js

@@ -0,0 +1,31 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-22 20:08:46
+ * @FilePath: /202103/code/test/tmp/QualityCause.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+
+const QualityCause = sequelize.define('quality_cause', {
+  id: {type: Sequelize.INTEGER(11),   allowNull: false, primaryKey: true, autoIncrement: true}, // id,
+  control_id: {type: Sequelize.STRING(100), allowNull: false, defaultValue: ''}, // control_id, 质控表id
+  factor_id: {type: Sequelize.STRING(100), allowNull: false, defaultValue: ''}, // factor_id, 因子ID
+  type: {type: Sequelize.STRING(10), allowNull: false, defaultValue: ''}, // type, 1影像 2报告
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  updatedAt: false,
+  indexes:[
+    {fields : ['control_id']}
+  ],
+});
+QualityCause.sync({ force: false }).then(function() {});
+export default QualityCause;

+ 36 - 0
src/dao_new/QualityControl.js

@@ -0,0 +1,36 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-22 20:07:01
+ * @FilePath: /202103/code/test/tmp/QualityControl.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const QualityControl = sequelize.define('quality_control', {
+  id: {type: Sequelize.STRING(255), allowNull: false, primaryKey: true}, // id,
+  institution_id: {type: Sequelize.STRING(50), allowNull: false}, // institution_id, 医院id
+  report_id: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_id, 报告id
+  pic_quality: {type: Sequelize.INTEGER(2), allowNull: true, defaultValue: null}, // pic_quality, 影像质量打分
+  report_quality: {type: Sequelize.INTEGER(2), allowNull: true, defaultValue: null}, // report_quality, 报告质量打分
+  comment_time: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // comment_time, 评价时间
+  comment_user_id: {type: Sequelize.STRING(50), allowNull: false, defaultValue: ''}, // comment_user_id, 评价人ID
+  comment_user_name: {type: Sequelize.STRING(100), allowNull: false, defaultValue: ''}, // comment_user_name, 评价人名称
+  pic_evaluate: {type: Sequelize.STRING(1000), allowNull: true, defaultValue: null}, // pic_evaluate,
+  report_evaluate: {type: Sequelize.STRING(1000), allowNull: true, defaultValue: null}, // report_evaluate,
+  report_doctor: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_doctor 报告医生id
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['report_id']}
+  ],
+});
+QualityControl.sync({ force: false }).then(function() {});
+export default QualityControl;

+ 48 - 0
src/dao_new/Register.js

@@ -0,0 +1,48 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:06:31
+ * @FilePath: /202103/code/test/tmp/Register.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const Register = sequelize.define('register', {
+  id: {type: Sequelize.STRING(255), allowNull: false, primaryKey: true}, // id,
+  exam_id: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_id, 检查key
+  exam_sub_class: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_sub_class, 检查子类
+  body_part: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // body_part, 检查部位
+  device_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // device_name, 检查设备
+  technician_id: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // technician_id, 检查技师ID
+  technician_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // technician_name, 检查技师姓名
+  technician_datetime: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // technician_datetime, 计划检查时间
+  register_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // register_id, 登记医师ID
+  register_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // register_name, 登记医师姓名
+  register_datetime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // register_datetime, 登记时间
+  illness_desc: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // illness_desc, 患者主诉
+  phys_sign: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // phys_sign, 体征
+  clin_symp: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // clin_symp, 症状
+  anamnesis: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // anamnesis, 疾病史
+  family_ill: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // family_ill, 家族病史
+  application_department: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // application_department, 申请科室
+  clin_diag: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // clin_diag, 初步诊断
+  ext: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // ext, 备注
+  clin_department: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // clin_department, 送诊科室
+  clin_doctors_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // clin_doctors_id, 送诊医生ID
+  clin_doctors_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // clin_doctors_name, 送诊医生姓名
+  clin_datetime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // clin_datetime, 送诊时间
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['exam_id']}
+  ],
+});
+Register.sync({ force: false }).then(function() {});
+export default Register;

+ 70 - 0
src/dao_new/RemoteApplication.js

@@ -0,0 +1,70 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:19:30
+ * @FilePath: /202103/code/test/tmp/RemoteApplication.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const RemoteApplication = sequelize.define('remote_application', {
+  id: {type: Sequelize.STRING(255), allowNull: false, primaryKey: true}, // id,
+  name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // name, 姓名
+  sex: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // sex, 性别
+  age: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // age, 年龄
+  report_result: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_result, 检查结果
+  patient_num: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // patient_num, 病历号
+  accession_num: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // accession_num, 检查号
+  exam_datetime: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_datetime, 检查时间
+  exam_class: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_class, 检查类型
+  exam_project: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_project, 检查项目
+  report_status: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_status, 远程诊断状态\r\n2  保存完善病例资料\r\n3  完善病例资料保存继续\r\n4  选择医院发起申请\r\n5  驳回申请\r\n6  接收申请\r\n7  写报告\r\n8  审核报告\r\n9  最终完成报告\r\n11  撤回报告\r\n10  确认报告
+  req_date_time: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // req_date_time, 邀请时间
+  local_institution_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // local_institution_id, 邀请方医院
+  local_institution_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // local_institution_name, 邀请方医院名称
+  req_doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // req_doctor_id, 邀请方医生id
+  req_doctor_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // req_doctor_name, 邀请方医生姓名
+  remote_institution_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // remote_institution_id, 受邀方医院
+  remote_institution_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // remote_institution_name, 受邀方医院名称
+  remote_doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // remote_doctor_id,
+  remote_doctor_name: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // remote_doctor_name,
+  illness_desc: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // illness_desc, 患者主诉
+  clin_symp: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // clin_symp, 临床症状
+  phys_sign: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // phys_sign, 体征
+  clin_diag: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // clin_diag, 临床诊断
+  anamnesis: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // anamnesis, 既往史
+  family_ill: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // family_ill, 家族史
+  remark: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // remark, 备注
+  exam_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // exam_id, 检查表id
+  is_urgent: {type: Sequelize.STRING(20), allowNull: true, defaultValue: '0'}, // is_urgent, 是否急诊 0 否 1 是
+  status: {type: Sequelize.STRING(20), allowNull: false, defaultValue: '0'}, // status, 删除状态  0 否  1 是
+  application_desc: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // application_desc, 申请描述
+  attachment: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // attachment, 附件
+  remote_department: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // remote_department, 申请科室
+  more: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // more, 补充说明
+  odd_number: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // odd_number, 申请单单号
+  pay_status: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '0'}, // pay_status, 付款状态 0未付款 1已付款
+  birthday: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // birthday, 生日
+  card_num: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // card_num, 身份证号
+  body_part: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // body_part, 检查部位
+  exam_sub_class: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // exam_sub_class, 检查子类
+  study_id: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // study_id,
+  phone: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // phone,
+  sid: {type: Sequelize.BIGINT(20), allowNull: true, defaultValue: null}, // sid, 特殊机构id
+  scid: {type: Sequelize.BIGINT(20), allowNull: true, defaultValue: null}, // scid, 特殊机构关联id
+  hopitalized_no: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // hopitalized_no 住院号
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['exam_id']}
+  ],
+});
+RemoteApplication.sync({ force: false }).then(function() {});
+export default RemoteApplication;

+ 56 - 0
src/dao_new/RemoteOrder.js

@@ -0,0 +1,56 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:19:38
+ * @FilePath: /202103/code/test/tmp/RemoteOrder.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+
+// `id` varchar(32) NOT NULL COMMENT 'id',
+// `hospital_id` varchar(32) DEFAULT NULL COMMENT '医院名',
+// `super_hospital_id` varchar(32) DEFAULT NULL COMMENT '医院地址',
+// `exam_class` varchar(32) DEFAULT NULL COMMENT '检查类型',
+// `doctor_id` varchar(32) DEFAULT NULL COMMENT '本地医生',
+// `application_id` varchar(32) DEFAULT NULL COMMENT '申请单号',
+// `super_doctor_id` varchar(32) DEFAULT NULL COMMENT '远程医生',
+// `remark` text COMMENT '备注',
+// `order_money` int(11) NOT NULL DEFAULT '0' COMMENT '订单费用',
+// `pay_type` int(11) NOT NULL DEFAULT '0' COMMENT '支付类型 患者/医院',
+// `pay_way` int(11) NOT NULL DEFAULT '0' COMMENT '支付方式 微信 支付宝 银联 挂账 等\r\n1 医院\r\n11 微信\r\n12 阿里支付宝\r\n13 银联',
+// `createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+// `updatedAt` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+// `timestamp` int(11) NOT NULL DEFAULT '0' COMMENT '时间戳',
+// `status` int(11) NOT NULL DEFAULT '0' COMMENT '订单状态',
+// `is_urgent` int(11) NOT NULL DEFAULT '0' COMMENT '是否急诊',
+const RemoteOrder = sequelize.define('remote_order', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  hospital_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // hospital_id, 医院名
+  super_hospital_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // super_hospital_id, 医院地址
+  exam_class: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // exam_class, 检查类型
+  doctor_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // doctor_id, 本地医生
+  application_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // application_id, 申请单号
+  super_doctor_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // super_doctor_id, 远程医生
+  remark: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // remark, 备注
+  order_money: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // order_money, 订单费用
+  pay_type: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // pay_type, 支付类型 患者/医院
+  pay_way: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // pay_way, 支付方式 微信 支付宝 银联 挂账 等\r\n1 医院\r\n11 微信\r\n12 阿里支付宝\r\n13 银联
+  timestamp: {type: Sequelize.INTEGER(11),allowNull: false, defaultValue: 0}, // timestamp, 时间戳
+  status: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // status, 订单状态
+  is_urgent: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // is_urgent 是否急诊
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['application_id']}
+  ],
+});
+RemoteOrder.sync({ force: false }).then(function() {});
+export default RemoteOrder;

+ 33 - 0
src/dao_new/RemoteWater.js

@@ -0,0 +1,33 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:22:06
+ * @FilePath: /202103/code/test/tmp/RemoteWater.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const RemoteWater = sequelize.define('remote_water', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  hospital_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // hospital_id, 医院名
+  order_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // order_id, 订单id
+  money: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // money, 金额
+  type: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: 0}, // type, 流水类型 加 减
+  why: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // why, why 患者支付/远程诊断收入/远程诊断付款/远程诊断退款/提现
+  remark: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // remark, 备注
+  timestamp: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // timestamp 时间戳
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['order_id']}
+  ],
+});
+RemoteWater.sync({ force: false }).then(function() {});
+export default RemoteWater;

+ 43 - 0
src/dao_new/Report.js

@@ -0,0 +1,43 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:26:28
+ * @FilePath: /202103/code/test/tmp/Report.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const Report = sequelize.define('report', {
+  id: {type: Sequelize.STRING(50), allowNull: false, primaryKey: true}, // id,
+  exam_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // exam_id, 检查key
+  report_doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // report_doctor_id, 报告医师ID
+  report_doctor_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_doctor_name, 报告医师姓名
+  report_datetime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // report_datetime, 报告时间
+  review_doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // review_doctor_id, 审核医师ID
+  review_doctor_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // review_doctor_name, 审核医师姓名
+  review_datetime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // review_datetime, 审核时间
+  confirm_doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // confirm_doctor_id, 确认医师ID
+  confirm_doctor_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // confirm_doctor_name, 确认医师姓名
+  confirm_datetime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // confirm_datetime, 确认时间
+  description: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // description, 影像所见
+  impression: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // impression, 意见建议
+  diagnose: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // diagnose, 诊断
+  qr_code: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // qr_code, 二维码
+  report_result: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_result, 报告结果  1阴性 2阳性
+  remote_application_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // remote_application_id, 申请单id
+  type: {type: Sequelize.STRING(10), allowNull: false, defaultValue: '1'}, // type, 报告类型 1 本地 2 远程
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['exam_id']}
+  ],
+});
+Report.sync({ force: false }).then(function() {});
+export default Report;

+ 32 - 0
src/dao_new/ReportRecord.js

@@ -0,0 +1,32 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:28:13
+ * @FilePath: /202103/code/test/tmp/ReportRecord.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const ReportRecord = sequelize.define('report_record', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  impression: {type: Sequelize.STRING(2000), allowNull: true, defaultValue: null}, // impression, 检查所见
+  description: {type: Sequelize.STRING(2000), allowNull: true, defaultValue: null}, // description, 意见建议
+  report_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // report_id, 检查表id
+  doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // doctor_id, 医生id
+  type: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // type, 操作类型 1报告 2审核 3确认 4驳回
+  report_result: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '1'}, // report_result, 阴阳性 1阴性  2阳性
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['report_id']}
+  ],
+});
+ReportRecord.sync({ force: false }).then(function() {});
+export default ReportRecord;

+ 32 - 0
src/dao_new/Series.js

@@ -0,0 +1,32 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:37:22
+ * @FilePath: /202103/code/test/tmp/Series.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const Series = sequelize.define('series', {
+  id: {type: Sequelize.STRING(16), allowNull: false, primaryKey: true}, // id,
+  study_id: {type: Sequelize.STRING(32), allowNull: false, defaultValue: ''}, // study_id,
+  seriesuid: {type: Sequelize.STRING(100), allowNull: false, defaultValue: ''}, // seriesuid,
+  seriesNum: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // seriesNum,
+  modality: {type: Sequelize.STRING(10), allowNull: false, defaultValue: ''}, // modality, 检查类型
+  seriesDescription: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // seriesDescription,
+  ext: {type: Sequelize.STRING(1024), allowNull: true, defaultValue: null}, // ext,
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['study_id']}
+  ],
+});
+Series.sync({ force: false }).then(function() {});
+export default Series;

+ 40 - 0
src/dao_new/Studies.js

@@ -0,0 +1,40 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:37:43
+ * @FilePath: /202103/code/test/tmp/Studies.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const Studies = sequelize.define('studies', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  studyuid: {type: Sequelize.STRING(200), allowNull: false, defaultValue: ''}, // studyuid,
+  patient_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // patient_id, 患者id
+  studyid: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // studyid,
+  accession_num: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // accession_num, 科室检查号
+  studydate: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // studydate,
+  modality: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // modality,
+  status: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: null}, // status,
+  patient_age: {type: Sequelize.STRING(20), allowNull: true, defaultValue: null}, // patient_age,
+  institution_name: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // institution_name, 机构名称
+  institution_id: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // institution_id,
+  ext: {type: Sequelize.JSON, allowNull: true, defaultValue: null}, // ext,
+  exam_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // exam_id,
+  weight: {type: Sequelize.STRING(20), allowNull: true, defaultValue: null}, // weight,
+  pregnancy: {type: Sequelize.STRING(100), allowNull: true, defaultValue: ''}, // pregnancy,
+  partExamined: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // partExamined,
+  studyDescribe: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // studyDescribe,
+  flag: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // flag 是否请求成功 0默认 1请求成功  2 请求中 3 第一次失败 4第2次失败 9失败
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+});
+Studies.sync({ force: false }).then(function() {});
+export default Studies;

+ 30 - 0
src/dao_new/db/sequelize.js

@@ -0,0 +1,30 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 18:46:15
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 13:38:30
+ * @FilePath: /202103/code/sql_merge/src/dao_new/db/sequelize.js
+ */
+import Sequelize from 'sequelize'
+import config from '../../../config'
+const DB = config['new_db_config']
+
+export default new Sequelize(DB.database, DB.username, DB.password, {
+  host: DB.host,
+  port: DB.port,
+  dialect: DB.db_type,
+
+  dialectOptions: {
+    charset: 'utf8mb4',
+    // collate: 'utf8mb4_unicode_520_ci',
+    bigNumberStrings: true,
+    supportBigNumbers: true
+  },
+
+  pool: {
+    max: 50,
+    min: 10,
+    idle: 10000
+  },
+  timezone: '+08:00' //修改时区为东八区
+})

+ 32 - 0
src/dao_new/index.js

@@ -0,0 +1,32 @@
+import ApplicationProgressLog from './ApplicationProgressLog'
+import Bbs from './Bbs'
+import Exams from './Exams'
+import Images from './Images'
+import PatientInfos from './PatientInfos'
+import QualityCause from './QualityCause'
+import QualityControl from './QualityControl'
+import Register from './Register'
+import RemoteApplication from './RemoteApplication'
+import RemoteOrder from './RemoteOrder'
+import RemoteWater from './RemoteWater'
+import Report from './Report'
+import ReportRecord from './ReportRecord'
+import Series from './Series'
+import Studies from './Studies'
+export {
+  ApplicationProgressLog,
+  Bbs,
+  Exams,
+  Images,
+  PatientInfos,
+  QualityCause,
+  QualityControl,
+  Register,
+  RemoteApplication,
+  RemoteOrder,
+  RemoteWater,
+  Report,
+  ReportRecord,
+  Series,
+  Studies
+}

+ 32 - 0
src/dao_old/ApplicationProgressLog.js

@@ -0,0 +1,32 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 11:15:15
+ * @FilePath: /202103/code/test/tmp/ApplicationProgressLog.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const ApplicationProgressLog = sequelize.define('application_progress_log', {
+  id: {type: Sequelize.STRING(50),   allowNull: false, primaryKey: true}, // id,
+  operator_id: {type: Sequelize.STRING(50),   allowNull: true, defaultValue: null}, // operator_id, 操作人id
+  operator_name: {type: Sequelize.STRING(255),   allowNull: true, defaultValue: ''}, // operator_name, 操作人姓名
+  current_step: {type: Sequelize.STRING(100),   allowNull: false, defaultValue: ''}, // current_step, 当前操作步骤\r\n1、待支付\r\n2、已支付发起申请\r\n3、已接受\r\n4、已撤回\r\n5、已驳回\r\n6、已写\r\n7、已审核\r\n8、远程确认\r\n9、本地完成\r\n10、取消订单\r\n11、已退款
+  remark: {type: Sequelize.STRING(2000),   allowNull: true}, // remark,
+  application_id: {type: Sequelize.STRING(50),   allowNull: false, defaultValue: ''}, // application_id 申请单id
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['application_id']}
+  ],
+  updatedAt: false
+});
+ApplicationProgressLog.sync({ force: false }).then(function() {});
+export default ApplicationProgressLog;

+ 33 - 0
src/dao_old/Bbs.js

@@ -0,0 +1,33 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-22 19:27:20
+ * @FilePath: /202103/code/test/tmp/Bbs.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+
+const Bbs = sequelize.define('bbs', {
+  id: {type: Sequelize.STRING(50),   allowNull: false, primaryKey: true}, // id,
+  initiator: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // initiator, 发起人
+  reply: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // reply, 回复人
+  remote_application_id: {type: Sequelize.STRING(50),  allowNull: true, defaultValue: null}, // remote_application_id, 申请单id
+  content: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // content, 内容
+  attachment: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // attachment, 附件
+  type: {type: Sequelize.STRING(10), allowNull: true, defaultValue: null}, // type BBS类型\r\n1 发起申请\r\n2 接收申请\r\n3 驳回申请\r\n4 撤回申请\r\n5 完成申请\r\n99 bbs对话
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['remote_application_id']}
+  ],
+});
+Bbs.sync({ force: false }).then(function() {});
+export default Bbs;

+ 71 - 0
src/dao_old/Exams.js

@@ -0,0 +1,71 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 14:10:12
+ * @FilePath: /202103/code/sql_merge/src/dao_old/Exams.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+
+
+const Exams = sequelize.define('exams', {
+  id: {type: Sequelize.STRING(255), allowNull: false, primaryKey: true}, // id,
+  institution_id: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // institution_id, 医院id
+  name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // name, 患者姓名
+  phone: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // phone, 患者手机号
+  card_num: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // card_num, 患者身份证
+  patient_num: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // patient_num, 病历号
+  patient_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // patient_id, 患者key
+  accession_num: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // accession_num, 检查号
+  hopitalized_no: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // hopitalized_no, 住院号
+  bed_no: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // bed_no, 病床号
+  studyid: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // studyid, 检查id
+  studyuid: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // studyuid, studyuid
+  study_id: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // study_id, 检查key
+  exam_class: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_class, 检查类别
+  exam_project: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_project, 检查项目
+  exam_datetime: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // exam_datetime, 检查时间
+  exam_status: {type: Sequelize.INTEGER(10), allowNull: true, defaultValue: 1}, // exam_status, 检查状态\r\n1  登记\r\n2  登记完成\r\n3  影像到达\r\n7  写报告\r\n8  审核报告\r\n9  确认报告
+  report_result: {type: Sequelize.STRING(10), allowNull: true, defaultValue: null}, // report_result, 检查结果  1阴性 2阳性
+  report_status: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // report_status, 远程诊断状态\r\n2  保存完善病例资料\r\n3  完善病例资料保存继续\r\n4  选择医院发起申请\r\n5  驳回申请\r\n6  接收申请\r\n7  写报告\r\n8  审核报告\r\n9  最终完成报告\r\n11  撤回报告\r\n10  确认报告
+  pay_status: {type: Sequelize.STRING(10), allowNull: true, defaultValue: '0'}, // pay_status, 支付状态  0未支付 1已支付
+  status: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '1'}, // status, 删除状态 0 禁用 1 正常
+  urgent: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '0'}, // urgent, 是否急诊 0 否 1是
+  severe: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '0'}, // severe, 重症标识 0 否 1 是
+  film_type: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '2'}, // film_type, 胶片属性:0 未定义  1传统胶片  2电子胶片
+  clin_symp: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // clin_symp, 症状
+  del_datetime: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // del_datetime, 删除时间
+  del_doctor_id: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // del_doctor_id, 删除医师ID
+  del_doctor_name: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // del_doctor_name, 删除医师姓名
+  patient_area: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // patient_area, 病区
+  sex: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // sex, 患者性别
+  age: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // age, 患者年龄
+  birthday: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // birthday, 患者生日
+  exam_sub_class: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_sub_class, 检查子类
+  body_part: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // body_part, 检查部位
+  device_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // device_name, 设备名称
+  application_department: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // application_department, 申请科室
+  application_doctor: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // application_doctor, 申请医生
+  clin_diag: {type: Sequelize.STRING(1000), allowNull: true, defaultValue: null}, // clin_diag, 临床诊断
+  out_patient: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // out_patient, 门诊号
+  ext: {type: Sequelize.JSON,   allowNull: true, defaultValue: null}, // ext,
+  delivery_doctor: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // delivery_doctor, 送诊医生
+  push_api: {type: Sequelize.STRING(255),  allowNull: true, defaultValue: null}, // push_api, 0 推送失败  1推送成功
+  api_message: {type: Sequelize.STRING(500),  allowNull: true, defaultValue: null}, // api_message 失败返回信息
+  flag: {type: Sequelize.INTEGER(11),  allowNull: false, defaultValue: 1}, // flag 标识
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['institution_id', 'flag']}
+  ],
+});
+Exams.sync({ force: false }).then(function() {});
+export default Exams;

+ 50 - 0
src/dao_old/Images.js

@@ -0,0 +1,50 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-22 19:44:50
+ * @FilePath: /202103/code/test/tmp/Images.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const Images = sequelize.define('images', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  series_id: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // series_id, 对应的序列key
+  imageId: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // imageId, 影像ID
+  sopUid: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // sopUid,
+  imageNumber: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: 0}, // imageNumber, 影像号
+  owner: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // owner, 所属人
+  windowWidth: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // windowWidth, 窗宽
+  windoCenter: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // windoCenter, 窗位
+  rows: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // rows, 行
+  columns: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // columns, 队
+  pixeSpacing: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // pixeSpacing, 影像的展示参数
+  imagePosition: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // imagePosition, 影像的展示参数
+  imageOrientation: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // imageOrientation, 影像的展示参数
+  ctime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // ctime, 创建时间
+  utime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // utime, 修改时间
+  url: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // url, 加载地址
+  metadata: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // metadata,
+  size: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // size,
+  hospitalId: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // hospitalId,
+  local_url: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // local_url,
+  remote_url: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // remote_url,
+  status: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: 2}, // status,
+  frame: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: 0}, // frame,
+  cineRate: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: 0}, // cineRate,
+  ext: {type: Sequelize.JSON, allowNull: true, defaultValue: null}, // ext
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['series_id']}
+  ],
+});
+Images.sync({ force: false }).then(function() {});
+export default Images;

+ 43 - 0
src/dao_old/PatientInfos.js

@@ -0,0 +1,43 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-22 19:49:09
+ * @FilePath: /202103/code/test/tmp/PatientInfos.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const PatientInfos = sequelize.define('patient_infos', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  name: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // name, 患者姓名
+  sex: {type: Sequelize.STRING(10), allowNull: true, defaultValue: null}, // sex, 性别
+  card_num: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // card_num, 身份证号
+  phone: {type: Sequelize.STRING(20), allowNull: true, defaultValue: null}, // phone, 手机号
+  ctime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // ctime, 创建时间
+  birthday: {type: Sequelize.STRING(20), allowNull: true, defaultValue: null}, // birthday, 生日
+  age: {type: Sequelize.STRING(10), allowNull: true, defaultValue: null}, // age, 年龄
+  card_type: {type: Sequelize.STRING(30), allowNull: true, defaultValue: null}, // card_type, 证件类型
+  nationality: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // nationality, 国籍
+  nation: {type: Sequelize.STRING(30), allowNull: true, defaultValue: ''}, // nation, 民族
+  marry: {type: Sequelize.STRING(10), allowNull: true, defaultValue: null}, // marry, 婚否
+  professional: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // professional, 职业
+  address: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // address, 联系地址
+  temp_patient_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // temp_patient_id, 检查临时患者id(从dicom影像中解析)
+  status: {type: Sequelize.INTEGER(10), allowNull: false, defaultValue: 1}, // status,
+  institution_id: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // institution_id, 所属医院
+  anamnesis: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // anamnesis, 疾病史
+  family_ill: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // family_ill, 家族史
+  ext: {type: Sequelize.JSON, allowNull: true, defaultValue: null}, // ext,
+  flag: {type: Sequelize.INTEGER(10), allowNull: false, defaultValue: 0}, // flag 标记 1解析 0不知道
+}, {
+  freezeTableName: true,
+  charset: 'utf8'
+});
+PatientInfos.sync({ force: false }).then(function() {});
+export default PatientInfos;

+ 31 - 0
src/dao_old/QualityCause.js

@@ -0,0 +1,31 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-22 20:08:46
+ * @FilePath: /202103/code/test/tmp/QualityCause.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+
+const QualityCause = sequelize.define('quality_cause', {
+  id: {type: Sequelize.INTEGER(11),   allowNull: false, primaryKey: true, autoIncrement: true}, // id,
+  control_id: {type: Sequelize.STRING(100), allowNull: false, defaultValue: ''}, // control_id, 质控表id
+  factor_id: {type: Sequelize.STRING(100), allowNull: false, defaultValue: ''}, // factor_id, 因子ID
+  type: {type: Sequelize.STRING(10), allowNull: false, defaultValue: ''}, // type, 1影像 2报告
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  updatedAt: false,
+  indexes:[
+    {fields : ['control_id']}
+  ],
+});
+QualityCause.sync({ force: false }).then(function() {});
+export default QualityCause;

+ 36 - 0
src/dao_old/QualityControl.js

@@ -0,0 +1,36 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-22 20:07:01
+ * @FilePath: /202103/code/test/tmp/QualityControl.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const QualityControl = sequelize.define('quality_control', {
+  id: {type: Sequelize.STRING(255), allowNull: false, primaryKey: true}, // id,
+  institution_id: {type: Sequelize.STRING(50), allowNull: false}, // institution_id, 医院id
+  report_id: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_id, 报告id
+  pic_quality: {type: Sequelize.INTEGER(2), allowNull: true, defaultValue: null}, // pic_quality, 影像质量打分
+  report_quality: {type: Sequelize.INTEGER(2), allowNull: true, defaultValue: null}, // report_quality, 报告质量打分
+  comment_time: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // comment_time, 评价时间
+  comment_user_id: {type: Sequelize.STRING(50), allowNull: false, defaultValue: ''}, // comment_user_id, 评价人ID
+  comment_user_name: {type: Sequelize.STRING(100), allowNull: false, defaultValue: ''}, // comment_user_name, 评价人名称
+  pic_evaluate: {type: Sequelize.STRING(1000), allowNull: true, defaultValue: null}, // pic_evaluate,
+  report_evaluate: {type: Sequelize.STRING(1000), allowNull: true, defaultValue: null}, // report_evaluate,
+  report_doctor: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_doctor 报告医生id
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['report_id']}
+  ],
+});
+QualityControl.sync({ force: false }).then(function() {});
+export default QualityControl;

+ 48 - 0
src/dao_old/Register.js

@@ -0,0 +1,48 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:06:31
+ * @FilePath: /202103/code/test/tmp/Register.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const Register = sequelize.define('register', {
+  id: {type: Sequelize.STRING(255), allowNull: false, primaryKey: true}, // id,
+  exam_id: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_id, 检查key
+  exam_sub_class: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_sub_class, 检查子类
+  body_part: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // body_part, 检查部位
+  device_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // device_name, 检查设备
+  technician_id: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // technician_id, 检查技师ID
+  technician_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // technician_name, 检查技师姓名
+  technician_datetime: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // technician_datetime, 计划检查时间
+  register_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // register_id, 登记医师ID
+  register_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // register_name, 登记医师姓名
+  register_datetime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // register_datetime, 登记时间
+  illness_desc: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // illness_desc, 患者主诉
+  phys_sign: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // phys_sign, 体征
+  clin_symp: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // clin_symp, 症状
+  anamnesis: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // anamnesis, 疾病史
+  family_ill: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // family_ill, 家族病史
+  application_department: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // application_department, 申请科室
+  clin_diag: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // clin_diag, 初步诊断
+  ext: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // ext, 备注
+  clin_department: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // clin_department, 送诊科室
+  clin_doctors_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // clin_doctors_id, 送诊医生ID
+  clin_doctors_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // clin_doctors_name, 送诊医生姓名
+  clin_datetime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // clin_datetime, 送诊时间
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['exam_id']}
+  ],
+});
+Register.sync({ force: false }).then(function() {});
+export default Register;

+ 70 - 0
src/dao_old/RemoteApplication.js

@@ -0,0 +1,70 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:19:30
+ * @FilePath: /202103/code/test/tmp/RemoteApplication.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const RemoteApplication = sequelize.define('remote_application', {
+  id: {type: Sequelize.STRING(255), allowNull: false, primaryKey: true}, // id,
+  name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // name, 姓名
+  sex: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // sex, 性别
+  age: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // age, 年龄
+  report_result: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_result, 检查结果
+  patient_num: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // patient_num, 病历号
+  accession_num: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // accession_num, 检查号
+  exam_datetime: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_datetime, 检查时间
+  exam_class: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_class, 检查类型
+  exam_project: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // exam_project, 检查项目
+  report_status: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_status, 远程诊断状态\r\n2  保存完善病例资料\r\n3  完善病例资料保存继续\r\n4  选择医院发起申请\r\n5  驳回申请\r\n6  接收申请\r\n7  写报告\r\n8  审核报告\r\n9  最终完成报告\r\n11  撤回报告\r\n10  确认报告
+  req_date_time: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // req_date_time, 邀请时间
+  local_institution_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // local_institution_id, 邀请方医院
+  local_institution_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // local_institution_name, 邀请方医院名称
+  req_doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // req_doctor_id, 邀请方医生id
+  req_doctor_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // req_doctor_name, 邀请方医生姓名
+  remote_institution_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // remote_institution_id, 受邀方医院
+  remote_institution_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // remote_institution_name, 受邀方医院名称
+  remote_doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // remote_doctor_id,
+  remote_doctor_name: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // remote_doctor_name,
+  illness_desc: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // illness_desc, 患者主诉
+  clin_symp: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // clin_symp, 临床症状
+  phys_sign: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // phys_sign, 体征
+  clin_diag: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // clin_diag, 临床诊断
+  anamnesis: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // anamnesis, 既往史
+  family_ill: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // family_ill, 家族史
+  remark: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // remark, 备注
+  exam_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // exam_id, 检查表id
+  is_urgent: {type: Sequelize.STRING(20), allowNull: true, defaultValue: '0'}, // is_urgent, 是否急诊 0 否 1 是
+  status: {type: Sequelize.STRING(20), allowNull: false, defaultValue: '0'}, // status, 删除状态  0 否  1 是
+  application_desc: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // application_desc, 申请描述
+  attachment: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // attachment, 附件
+  remote_department: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // remote_department, 申请科室
+  more: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // more, 补充说明
+  odd_number: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // odd_number, 申请单单号
+  pay_status: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '0'}, // pay_status, 付款状态 0未付款 1已付款
+  birthday: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // birthday, 生日
+  card_num: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // card_num, 身份证号
+  body_part: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // body_part, 检查部位
+  exam_sub_class: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // exam_sub_class, 检查子类
+  study_id: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // study_id,
+  phone: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // phone,
+  sid: {type: Sequelize.BIGINT(20), allowNull: true, defaultValue: null}, // sid, 特殊机构id
+  scid: {type: Sequelize.BIGINT(20), allowNull: true, defaultValue: null}, // scid, 特殊机构关联id
+  hopitalized_no: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // hopitalized_no 住院号
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['exam_id']}
+  ],
+});
+RemoteApplication.sync({ force: false }).then(function() {});
+export default RemoteApplication;

+ 56 - 0
src/dao_old/RemoteOrder.js

@@ -0,0 +1,56 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:19:38
+ * @FilePath: /202103/code/test/tmp/RemoteOrder.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+
+// `id` varchar(32) NOT NULL COMMENT 'id',
+// `hospital_id` varchar(32) DEFAULT NULL COMMENT '医院名',
+// `super_hospital_id` varchar(32) DEFAULT NULL COMMENT '医院地址',
+// `exam_class` varchar(32) DEFAULT NULL COMMENT '检查类型',
+// `doctor_id` varchar(32) DEFAULT NULL COMMENT '本地医生',
+// `application_id` varchar(32) DEFAULT NULL COMMENT '申请单号',
+// `super_doctor_id` varchar(32) DEFAULT NULL COMMENT '远程医生',
+// `remark` text COMMENT '备注',
+// `order_money` int(11) NOT NULL DEFAULT '0' COMMENT '订单费用',
+// `pay_type` int(11) NOT NULL DEFAULT '0' COMMENT '支付类型 患者/医院',
+// `pay_way` int(11) NOT NULL DEFAULT '0' COMMENT '支付方式 微信 支付宝 银联 挂账 等\r\n1 医院\r\n11 微信\r\n12 阿里支付宝\r\n13 银联',
+// `createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+// `updatedAt` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+// `timestamp` int(11) NOT NULL DEFAULT '0' COMMENT '时间戳',
+// `status` int(11) NOT NULL DEFAULT '0' COMMENT '订单状态',
+// `is_urgent` int(11) NOT NULL DEFAULT '0' COMMENT '是否急诊',
+const RemoteOrder = sequelize.define('remote_order', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  hospital_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // hospital_id, 医院名
+  super_hospital_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // super_hospital_id, 医院地址
+  exam_class: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // exam_class, 检查类型
+  doctor_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // doctor_id, 本地医生
+  application_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // application_id, 申请单号
+  super_doctor_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // super_doctor_id, 远程医生
+  remark: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // remark, 备注
+  order_money: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // order_money, 订单费用
+  pay_type: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // pay_type, 支付类型 患者/医院
+  pay_way: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // pay_way, 支付方式 微信 支付宝 银联 挂账 等\r\n1 医院\r\n11 微信\r\n12 阿里支付宝\r\n13 银联
+  timestamp: {type: Sequelize.INTEGER(11),allowNull: false, defaultValue: 0}, // timestamp, 时间戳
+  status: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // status, 订单状态
+  is_urgent: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // is_urgent 是否急诊
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['application_id']}
+  ],
+});
+RemoteOrder.sync({ force: false }).then(function() {});
+export default RemoteOrder;

+ 33 - 0
src/dao_old/RemoteWater.js

@@ -0,0 +1,33 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:22:06
+ * @FilePath: /202103/code/test/tmp/RemoteWater.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const RemoteWater = sequelize.define('remote_water', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  hospital_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // hospital_id, 医院名
+  order_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // order_id, 订单id
+  money: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // money, 金额
+  type: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: 0}, // type, 流水类型 加 减
+  why: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // why, why 患者支付/远程诊断收入/远程诊断付款/远程诊断退款/提现
+  remark: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // remark, 备注
+  timestamp: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // timestamp 时间戳
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['order_id']}
+  ],
+});
+RemoteWater.sync({ force: false }).then(function() {});
+export default RemoteWater;

+ 43 - 0
src/dao_old/Report.js

@@ -0,0 +1,43 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:26:28
+ * @FilePath: /202103/code/test/tmp/Report.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const Report = sequelize.define('report', {
+  id: {type: Sequelize.STRING(50), allowNull: false, primaryKey: true}, // id,
+  exam_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // exam_id, 检查key
+  report_doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // report_doctor_id, 报告医师ID
+  report_doctor_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_doctor_name, 报告医师姓名
+  report_datetime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // report_datetime, 报告时间
+  review_doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // review_doctor_id, 审核医师ID
+  review_doctor_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // review_doctor_name, 审核医师姓名
+  review_datetime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // review_datetime, 审核时间
+  confirm_doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // confirm_doctor_id, 确认医师ID
+  confirm_doctor_name: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // confirm_doctor_name, 确认医师姓名
+  confirm_datetime: {type: Sequelize.DATE, allowNull: true, defaultValue: null}, // confirm_datetime, 确认时间
+  description: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // description, 影像所见
+  impression: {type: Sequelize.TEXT, allowNull: true, defaultValue: null}, // impression, 意见建议
+  diagnose: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // diagnose, 诊断
+  qr_code: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // qr_code, 二维码
+  report_result: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // report_result, 报告结果  1阴性 2阳性
+  remote_application_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // remote_application_id, 申请单id
+  type: {type: Sequelize.STRING(10), allowNull: false, defaultValue: '1'}, // type, 报告类型 1 本地 2 远程
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['exam_id']}
+  ],
+});
+Report.sync({ force: false }).then(function() {});
+export default Report;

+ 32 - 0
src/dao_old/ReportRecord.js

@@ -0,0 +1,32 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:28:13
+ * @FilePath: /202103/code/test/tmp/ReportRecord.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const ReportRecord = sequelize.define('report_record', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  impression: {type: Sequelize.STRING(2000), allowNull: true, defaultValue: null}, // impression, 检查所见
+  description: {type: Sequelize.STRING(2000), allowNull: true, defaultValue: null}, // description, 意见建议
+  report_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // report_id, 检查表id
+  doctor_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // doctor_id, 医生id
+  type: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // type, 操作类型 1报告 2审核 3确认 4驳回
+  report_result: {type: Sequelize.STRING(255), allowNull: true, defaultValue: '1'}, // report_result, 阴阳性 1阴性  2阳性
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['report_id']}
+  ],
+});
+ReportRecord.sync({ force: false }).then(function() {});
+export default ReportRecord;

+ 32 - 0
src/dao_old/Series.js

@@ -0,0 +1,32 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:37:22
+ * @FilePath: /202103/code/test/tmp/Series.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const Series = sequelize.define('series', {
+  id: {type: Sequelize.STRING(16), allowNull: false, primaryKey: true}, // id,
+  study_id: {type: Sequelize.STRING(32), allowNull: false, defaultValue: ''}, // study_id,
+  seriesuid: {type: Sequelize.STRING(100), allowNull: false, defaultValue: ''}, // seriesuid,
+  seriesNum: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // seriesNum,
+  modality: {type: Sequelize.STRING(10), allowNull: false, defaultValue: ''}, // modality, 检查类型
+  seriesDescription: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // seriesDescription,
+  ext: {type: Sequelize.STRING(1024), allowNull: true, defaultValue: null}, // ext,
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+  indexes:[
+    {fields : ['study_id']}
+  ],
+});
+Series.sync({ force: false }).then(function() {});
+export default Series;

+ 40 - 0
src/dao_old/Studies.js

@@ -0,0 +1,40 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 19:10:00
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 10:37:43
+ * @FilePath: /202103/code/test/tmp/Studies.js
+ */
+
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+/**
+* 患者信息
+*/
+// primaryKey: true
+// defaultValue: null
+const Studies = sequelize.define('studies', {
+  id: {type: Sequelize.STRING(32), allowNull: false, primaryKey: true}, // id,
+  studyuid: {type: Sequelize.STRING(200), allowNull: false, defaultValue: ''}, // studyuid,
+  patient_id: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // patient_id, 患者id
+  studyid: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // studyid,
+  accession_num: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // accession_num, 科室检查号
+  studydate: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // studydate,
+  modality: {type: Sequelize.STRING(255), allowNull: true, defaultValue: null}, // modality,
+  status: {type: Sequelize.INTEGER(11), allowNull: true, defaultValue: null}, // status,
+  patient_age: {type: Sequelize.STRING(20), allowNull: true, defaultValue: null}, // patient_age,
+  institution_name: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // institution_name, 机构名称
+  institution_id: {type: Sequelize.STRING(200), allowNull: true, defaultValue: null}, // institution_id,
+  ext: {type: Sequelize.JSON, allowNull: true, defaultValue: null}, // ext,
+  exam_id: {type: Sequelize.STRING(32), allowNull: true, defaultValue: null}, // exam_id,
+  weight: {type: Sequelize.STRING(20), allowNull: true, defaultValue: null}, // weight,
+  pregnancy: {type: Sequelize.STRING(100), allowNull: true, defaultValue: ''}, // pregnancy,
+  partExamined: {type: Sequelize.STRING(50), allowNull: true, defaultValue: null}, // partExamined,
+  studyDescribe: {type: Sequelize.STRING(100), allowNull: true, defaultValue: null}, // studyDescribe,
+  flag: {type: Sequelize.INTEGER(11), allowNull: false, defaultValue: 0}, // flag 是否请求成功 0默认 1请求成功  2 请求中 3 第一次失败 4第2次失败 9失败
+}, {
+  freezeTableName: true,
+  charset: 'utf8',
+});
+Studies.sync({ force: false }).then(function() {});
+export default Studies;

+ 30 - 0
src/dao_old/db/sequelize.js

@@ -0,0 +1,30 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-22 18:46:15
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 13:44:17
+ * @FilePath: /202103/code/sql_merge/src/dao_old/db/sequelize.js
+ */
+import Sequelize from 'sequelize'
+import config from '../../../config'
+const DB = config['old_db_config']
+
+export default new Sequelize(DB.database, DB.username, DB.password, {
+  host: DB.host,
+  port: DB.port,
+  dialect: DB.db_type,
+
+  dialectOptions: {
+    charset: 'utf8mb4',
+    // collate: 'utf8mb4_unicode_520_ci',
+    bigNumberStrings: true,
+    supportBigNumbers: true
+  },
+
+  pool: {
+    max: 50,
+    min: 10,
+    idle: 10000
+  },
+  timezone: '+08:00' //修改时区为东八区
+})

+ 32 - 0
src/dao_old/index.js

@@ -0,0 +1,32 @@
+import ApplicationProgressLog from './ApplicationProgressLog'
+import Bbs from './Bbs'
+import Exams from './Exams'
+import Images from './Images'
+import PatientInfos from './PatientInfos'
+import QualityCause from './QualityCause'
+import QualityControl from './QualityControl'
+import Register from './Register'
+import RemoteApplication from './RemoteApplication'
+import RemoteOrder from './RemoteOrder'
+import RemoteWater from './RemoteWater'
+import Report from './Report'
+import ReportRecord from './ReportRecord'
+import Series from './Series'
+import Studies from './Studies'
+export {
+  ApplicationProgressLog,
+  Bbs,
+  Exams,
+  Images,
+  PatientInfos,
+  QualityCause,
+  QualityControl,
+  Register,
+  RemoteApplication,
+  RemoteOrder,
+  RemoteWater,
+  Report,
+  ReportRecord,
+  Series,
+  Studies
+}

+ 11 - 0
src/modules/api/controller.js

@@ -0,0 +1,11 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-23 11:56:31
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 13:48:50
+ * @FilePath: /202103/code/sql_merge/src/modules/api/controller.js
+ */
+import {moveSingle} from '../../service/move'
+export async function move(ctx) {
+  await moveSingle('73090004')
+}

+ 17 - 0
src/modules/api/router.js

@@ -0,0 +1,17 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-02-26 17:17:47
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 11:59:01
+ * @FilePath: /202103/code/sql_merge/src/modules/api/router.js
+ */
+import * as api from './controller'
+
+export const baseUrl = '/api'
+
+export default [{
+    method: 'POST',
+    route: '/move',
+    handlers: [api.move]
+  }
+]

+ 31 - 0
src/modules/index.js

@@ -0,0 +1,31 @@
+import glob   from 'glob'
+import Router from 'koa-router'
+
+//挂载路由
+exports = module.exports = function initModules (app) {
+  glob(`${__dirname}/*`, {ignore: '**/index.js' }, (err, matches) => {
+    if (err) {
+      throw err
+    }
+
+    matches.forEach((mod) => {
+      const router = require(`${mod}/router`)
+
+      const routes   = router.default
+      const baseUrl  = router.baseUrl
+
+      const instance = new Router({prefix: baseUrl})
+
+      routes.forEach((config) => {
+        const {method = '', route = '', handlers = []} = config
+        const lastHandler = handlers.pop()
+
+        instance[method.toLowerCase()](route, ...handlers, async function(ctx){
+          return await lastHandler(ctx)
+        })
+
+        app.use(instance.routes()).use(instance.allowedMethods())
+      })
+    })
+  })
+}

+ 16 - 0
src/service/common.js

@@ -0,0 +1,16 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-23 16:43:11
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 16:49:39
+ * @FilePath: /202103/code/sql_merge/src/service/common.js
+ */
+export function fixNumber(number, fix, length) {
+  if(typeof number === 'number') {
+    number += ''
+  }
+  if(typeof number !== 'string') {
+    return number
+  }
+  return number.padStart(length, fix)
+}

+ 40 - 0
src/service/log.js

@@ -0,0 +1,40 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-23 16:25:59
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 17:42:27
+ * @FilePath: /202103/code/sql_merge/src/service/log.js
+ */
+const fs = require('fs')
+const path = require('path');
+const rootPath = path.join(__dirname, '..', '..', 'logs')
+import {getNowDay, getNowTime} from './time'
+export async function logSum(institution_id, count) {
+  const dirPath = path.join(rootPath, 'sum')
+  checkPath(dirPath)
+  const filePath = path.join(dirPath, getNowDay() + '.log')
+  const time = getNowTime()
+  const obj = {
+    time: time, institution_id, count,
+  }
+  fs.appendFileSync(filePath, JSON.stringify(obj) + '\r\n')
+}
+export async function logSingle(name) {
+  checkPath(rootPath)
+  const filePath = path.join(rootPath, name + '.log')
+  let count = 0
+  if(fs.existsSync(filePath)) {
+    let obj = JSON.parse(fs.readFileSync(filePath)) || {}
+    count = obj['count'] || 0
+  }
+  count = parseInt(count) + 1
+  const time = getNowTime()
+  fs.writeFileSync(filePath, JSON.stringify({time, count}))
+}
+
+const checkPath = filePath => {
+  if(fs.existsSync(filePath)) {
+    return true
+  }
+  return fs.mkdirSync(filePath, { recursive: true })
+}

+ 152 - 0
src/service/move.js

@@ -0,0 +1,152 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-23 12:00:09
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 17:42:37
+ * @FilePath: /202103/code/sql_merge/src/service/move.js
+ */
+
+import {limit} from '../../config'
+import {logSum, logSingle} from './log'
+import {RemoteApplication as OldRemoteApplication, ApplicationProgressLog as OldApplicationProgressLog, Bbs as OldBbs, RemoteOrder as OldRemoteOrder, RemoteWater as OldRemoteWater, Register as OldRegister, Exams as OldExams, PatientInfos as OldPatientInfos, Studies as OldStudies, Series as OldSeries, Images as OldImages, Report as OldReport, ReportRecord as OldReportRecord, QualityControl as OldQualityControl, QualityCause as OldQualityCause} from '../dao_old'
+import {RemoteApplication as NewRemoteApplication, ApplicationProgressLog as NewApplicationProgressLog, Bbs as NewBbs, RemoteOrder as NewRemoteOrder, RemoteWater as NewRemoteWater, Register as NewRegister, Exams as NewExams, PatientInfos as NewPatientInfos, Studies as NewStudies, Series as NewSeries, Images as NewImages, Report as NewReport, ReportRecord as NewReportRecord, QualityControl as NewQualityControl, QualityCause as NewQualityCause} from '../dao_new'
+
+export async function moveSingle(institution_id) {
+  let count = limit, sum = 0
+  while(count === limit) {
+    count = await moveExams(institution_id)
+    sum += count
+  }
+  logSum(institution_id, sum)
+  return
+}
+
+const moveExams = async (institution_id) => {
+  // offset: 5, limit: 5
+  let exmas = await OldExams.findAll({where: {institution_id, flag: 0}, limit})
+  for(let i = 0; i < exmas.length; i++) {
+    await moveExam(exmas[i])
+  }
+  return exmas.length
+}
+
+const moveExam = async (exam) => {
+  return await fixCommon(NewExams, OldExams, {id: exam.id}, fixExam)
+}
+
+const fixExam = async(exam) => {
+  // 同步PACS
+  await fixPacs(exam.study_id, exam.patient_id)
+  // 同步报告
+  await fixReports(exam.id)
+  // 同步远程诊断
+  await fixRemotes(exam.id)
+  // 同步登记
+  await fixRegisters(exam.id)
+  // 更新检查标识
+  return await updateExamFlag(exam)
+}
+
+const fixCommon = async (NewClass, OldClass, where, cb) => {
+  let newObj = await NewClass.findOne({where})
+  if(!newObj) {
+    const old = await OldClass.findOne({where})
+    newObj = await copy(NewClass, old)
+  }
+  if(!cb || typeof cb !== 'function') {
+    return newObj
+  }
+  return await cb(newObj)
+}
+
+const fixCommons = async (NewClass, OldClass, where, cb) => {
+  let olds = await OldClass.findAll({where})
+  if(!(olds && olds.length)) {
+    return false
+  }
+  for(let i = 0; i < olds.length; i++) {
+    await fixCommon(NewClass, OldClass, {id: olds[i].id}, cb)
+  }
+  return olds
+}
+
+const fixReports = async exam_id => {
+  await fixCommons(NewReport, OldReport, {exam_id}, fixReportChild)
+}
+const fixReportChild = async report => {
+  // 同步报告记录
+  await fixReportRecords(report.id)
+  // 同步质控
+  await fixQualityControls(report.id)
+  return report
+}
+
+const fixReportRecords = async report_id => {
+  // 同步报告记录
+  await fixCommons(NewReportRecord, OldReportRecord, {report_id})
+}
+
+const fixQualityControls = async report_id => {
+  // 同步质控
+  await fixCommons(NewQualityControl, OldQualityControl, {report_id}, fixQualityControlChild)
+}
+
+const fixQualityControlChild = async qualityControl => {
+  // 同步质控评价因子
+  await fixCommons(NewQualityCause, OldQualityCause, {control_id: qualityControl.id})
+}
+
+const fixRemotes = async exam_id => {
+  // 同步远程诊断申请
+  await fixCommons(NewRemoteApplication, OldRemoteApplication, {exam_id}, fixRemoteChild)
+}
+
+const fixRemoteChild = async remoteApplication => {
+  // 同步远程诊断申请流程日志
+  await fixCommons(NewApplicationProgressLog, OldApplicationProgressLog, {application_id: remoteApplication.id})
+  // 同步BBS
+  await fixCommons(NewBbs, OldBbs, {remote_application_id: remoteApplication.id})
+  // 同步远程诊断订单
+  await fixCommons(NewRemoteOrder, OldRemoteOrder, {application_id: remoteApplication.id}, fixRemoteOrderChild)
+}
+
+const fixRemoteOrderChild = async remoteOrder => {
+  // 同步远程诊断订单流水
+  await fixCommons(NewRemoteWater, OldRemoteWater, {order_id: remoteOrder.id})
+}
+
+const fixRegisters = async exam_id => {
+  // 同步登记
+  await fixCommons(NewRegister, OldRegister, {exam_id})
+}
+
+const fixPacs = async (study_id, patient_id) => {
+  // 同步患者
+  await fixCommon(NewPatientInfos, OldPatientInfos, {id: patient_id})
+  // 同步检查
+  await fixCommon(NewStudies, OldStudies, {id: study_id})
+  // 同步系列
+  await fixCommons(NewSeries, OldSeries, {study_id}, fixSerieChild)
+}
+
+const fixSerieChild = async serie => {
+  // 同步image
+  await fixCommons(NewImages, OldImages, {series_id: serie.id})
+}
+
+const updateExamFlag = async exam => {
+  exam.flag = 1;
+  await exam.save()
+  const newExam = await NewExams.findOne({where: {id: exam.id}})
+  newExam.flag = 1;
+  await newExam.save()
+  return true
+}
+
+const copy = async (obj, old) => {
+  if(!(old && obj)) {
+    return false
+  }
+  logSingle(obj['tableName'])
+  return await obj.create(old['dataValues'])
+}

+ 27 - 0
src/service/time.js

@@ -0,0 +1,27 @@
+/*
+ * @Author: fuyu
+ * @Date: 2021-03-23 16:42:13
+ * @LastEditors: fuyu
+ * @LastEditTime: 2021-03-23 17:25:20
+ * @FilePath: /202103/code/sql_merge/src/service/time.js
+ */
+import {fixNumber} from './common'
+export function getNowDay() {
+  const date = new Date()
+  const year = date.getFullYear()
+  const month = date.getMonth() + 1
+  const day = date.getDate()
+  return fixNumber(year, 0, 4) + '-' + fixNumber(month, 0, 2) + '-' + fixNumber(day, 0, 2)
+}
+
+export function getNowTime() {
+  const date = new Date()
+  const year = date.getFullYear()
+  const month = date.getMonth() + 1
+  const day = date.getDate()
+  const hours = date.getHours()
+  const minutes = date.getMinutes()
+  const seconds = date.getSeconds()
+  return fixNumber(year, 0, 4) + '-' + fixNumber(month, 0, 2) + '-' + fixNumber(day, 0, 2) + ' ' + fixNumber(hours, 0, 2) + ':' + fixNumber(minutes, 0, 2) + ':' + fixNumber(seconds, 0, 2)
+}
+