fuyu 5 gadi atpakaļ
vecāks
revīzija
700db89222

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
server/common/report.json


+ 5 - 1
server/src/dao/index.js

@@ -3,10 +3,14 @@ import Study from './study'
 import Series from './series'
 import Image from './images'
 import Exam from './exam'
+import Remote_application from './remote_application';
+import Report from './report';
 export {
   Patient,
   Study,
   Series,
   Image,
-  Exam
+  Exam,
+  Remote_application,
+  Report
 }

+ 18 - 0
server/src/dao/remote_application.js

@@ -0,0 +1,18 @@
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+
+const Remote_application = sequelize.define('remote_application', {
+  id: { type: Sequelize.STRING(32), allowNull: false, primaryKey: true, comment: ''},
+  local_institution_id: { type: Sequelize.STRING(100), allowNull: true, primaryKey: false, comment: '发起申请医院'},
+  exam_id: { type: Sequelize.STRING(32), allowNull: true, primaryKey: false, comment: '检查表id'},
+  sid: { type: Sequelize.INTEGER(32), allowNull: true, primaryKey: false, comment: 'sid'},
+},{
+  freezeTableName: true,
+  charset: 'utf8',
+  createdAt: 'createdAt',
+  updatedAt: false,
+});
+
+Remote_application.sync({ force: false }).then(function() {});
+
+export default Remote_application;

+ 20 - 0
server/src/dao/report.js

@@ -0,0 +1,20 @@
+const Sequelize = require('sequelize');
+import sequelize from './db/sequelize';
+
+const Report = sequelize.define('report', {
+  id: { type: Sequelize.STRING(32), allowNull: false, primaryKey: true, comment: '报告id'},
+  report_datetime: { type: Sequelize.DATE, allowNull: true, primaryKey: false, comment: '报告时间'},
+  description: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '检查所见'},
+  impression: { type: Sequelize.TEXT, allowNull: true, primaryKey: false, comment: '意见建议'},
+  exam_id: { type: Sequelize.STRING(255), allowNull: true, primaryKey: false, comment: '检查表id'},
+  type: { type: Sequelize.STRING(10), allowNull: true, primaryKey: false, defaultValue: '1', comment: '报告类型'},
+},{
+  freezeTableName: true,
+  charset: 'utf8',
+  createdAt: 'createdAt',
+  updatedAt: false,
+});
+
+Report.sync({ force: false }).then(function() {});
+
+export default Report;

+ 73 - 0
server/src/modules/fy/controller.js

@@ -0,0 +1,73 @@
+import {Remote_application, Exam, Report, Patient, Study, Series, Image} from '../../dao';
+import Sequelize from 'sequelize';
+const fs = require('fs');
+export async function fy(ctx) {
+  const remotes = await Remote_application.findAll({
+    where: {
+      sid: 1,
+      remote_institution_id: {
+       [Sequelize.Op.ne] : 'b5bed8f973852c22'
+      },
+      remote_doctor_id: {
+        [Sequelize.Op.ne] : ''
+      }
+    }
+  })
+  const reports = []
+  for(let i = 0; i < remotes.length; i++) {
+    let report = await getReport(remotes[i]);
+    if(report.description) {
+      reports.push(report);
+    }
+  }
+  console.log(reports)
+  fs.writeFileSync('/Users/fuyu/zskk_code/zskkDicomParse/server/common/report.json', JSON.stringify(reports));
+}
+
+async function getReport(remote) {
+  let exam_id = remote.exam_id;
+  const exam = await Exam.findOne({where:{id: exam_id}})
+  const report = await Report.findOne({where: {exam_id, type:'2'}})
+  
+  const patient = await Patient.findOne({where: {id: exam.patient_id}})
+  const series = await getSeries(exam.study_id)
+  const r = {
+    description: report.description,
+    impression: report.impression,
+    study_uid: exam.study_uid,
+    exam_datetime: exam.exam_datetime,
+    exam_class: exam.exam_class,
+    sex: patient.sex,
+    birthday: patient.birthday,
+    age: patient.age,
+    series
+  }
+  return r;
+}
+
+async function getSeries(study_id) {
+  const series = await Series.findAll({where: {study_id}});
+  const s = [];
+  for(let i = 0; i < series.length; i++) {
+    let serie = await getSerie(series[i]);
+    s.push(serie);
+  }
+  return s;
+}
+
+async function getSerie(serie) {
+  let images = [];
+  let image = await Image.findAll({where: {series_id: serie.id}})
+  for(let i = 0; i < image.length; i++) {
+    images.push({
+      image_id: image[i].image_id,
+      image_number: image[i].image_number,
+      url: image[i].url.replace('dicomweb', 'http')
+    })
+  }
+  return {
+    seriesuid: serie.seriesuid,
+    series_num: serie.series_num,
+    images
+  }
+}

+ 11 - 0
server/src/modules/fy/router.js

@@ -0,0 +1,11 @@
+import * as fy from './controller'
+
+export const baseUrl = '/fy'
+
+export default [
+  {
+    method: 'POST',
+    route : '/',
+    handlers: [fy.fy]
+  }
+]

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels