|
@@ -2,8 +2,8 @@
|
|
|
* @Author: fuyu
|
|
|
* @Date: 2021-03-23 12:00:09
|
|
|
* @LastEditors: fuyu
|
|
|
- * @LastEditTime: 2021-03-26 10:54:02
|
|
|
- * @FilePath: /202103/code/sql_merge/src/service/move.js
|
|
|
+ * @LastEditTime: 2021-03-28 22:25:22
|
|
|
+ * @FilePath: /sql_merge/src/service/move.js
|
|
|
*/
|
|
|
|
|
|
import config from '../../config'
|
|
@@ -16,7 +16,16 @@ 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 {Institution, 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'
|
|
|
import {getInt} from './common'
|
|
|
-export async function moveAll(institution_id) {
|
|
|
+
|
|
|
+export async function moveAll() {
|
|
|
+ const res = await Institution.findAll({attributes: ['id']})
|
|
|
+ const ids = res.map(item => item['id'])
|
|
|
+ await moveSingle(ids)
|
|
|
+ await moveSinglePacs(ids, 0)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+export async function moveReport(institution_id) {
|
|
|
if(institution_id) {
|
|
|
await moveSingle(institution_id)
|
|
|
return
|
|
@@ -44,7 +53,7 @@ const moveSinglePacs = async (institution_id, offset = 0) => {
|
|
|
count = await moveExamsPacs(institution_id, offset)
|
|
|
sum += count
|
|
|
}
|
|
|
- logSum('pacs-' + institution_id, sum)
|
|
|
+ logSum(institution_id, sum, 'pacs-')
|
|
|
}
|
|
|
|
|
|
const moveExamsPacs = async (institution_id, offset) => {
|
|
@@ -186,6 +195,10 @@ const updateExamFlag = async (exam, flag) => {
|
|
|
old.flag = flag;
|
|
|
await old.save()
|
|
|
const newExam = await NewExams.findOne({where: {id: exam.id}})
|
|
|
+ if(!newExam) {
|
|
|
+ console.log('id')
|
|
|
+ return
|
|
|
+ }
|
|
|
newExam.flag = flag;
|
|
|
await newExam.save()
|
|
|
return true
|