|
@@ -1,380 +1,83 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import java.util.*;
|
|
|
-
|
|
|
-import com.diagbot.entity.*;
|
|
|
-import com.diagbot.service.impl.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.diagbot.util.TZDBConn;
|
|
|
-import com.google.common.collect.Lists;
|
|
|
-
|
|
|
@Component
|
|
|
public class DataFacade {
|
|
|
-
|
|
|
@Autowired
|
|
|
- @Qualifier("homePageServiceImpl")
|
|
|
- private HomePageServiceImpl homePageServiceImpl;
|
|
|
+ private ABasDeptInfoFacade aBasDeptInfoFacade;
|
|
|
|
|
|
@Autowired
|
|
|
- @Qualifier("behospitalInfoServiceImpl")
|
|
|
- private BehospitalInfoServiceImpl behospitalInfoServiceImpl;
|
|
|
+ private ABasDoctorInfoFacade aBasDoctorInfoFacade;
|
|
|
|
|
|
@Autowired
|
|
|
- @Qualifier("doctorAdviceServiceImpl")
|
|
|
- private DoctorAdviceServiceImpl doctorAdviceServiceImpl;
|
|
|
+ private AHomePageFacade aHomePageFacade;
|
|
|
|
|
|
@Autowired
|
|
|
- @Qualifier("medicalRecordServiceImpl")
|
|
|
- private MedicalRecordServiceImpl medicalRecordServiceImpl;
|
|
|
+ private AHomeDiagnoseInfoFacade aHomeDiagnoseInfoFacade;
|
|
|
|
|
|
@Autowired
|
|
|
- @Qualifier("medicalRecordContentServiceImpl")
|
|
|
- private MedicalRecordContentServiceImpl medicalRecordContentServiceImpl;
|
|
|
+ private AHomeOperationInfoFacade aHomeOperationInfoFacade;
|
|
|
|
|
|
@Autowired
|
|
|
- @Qualifier("medRecordTypeServiceImpl")
|
|
|
- private MedRecordTypeServiceImpl medRecordTypeServiceImpl;
|
|
|
+ private AMedRecordTypeFacade aMedRecordTypeFacade;
|
|
|
|
|
|
@Autowired
|
|
|
- @Qualifier("homeDiagnoseInfoServiceImpl")
|
|
|
- private HomeDiagnoseInfoServiceImpl homeDiagnoseInfoServiceImpl;
|
|
|
+ private AMedicalRecordFacade aMedicalRecordFacade;
|
|
|
|
|
|
@Autowired
|
|
|
- @Qualifier("homeOperationInfoServiceImpl")
|
|
|
- private HomeOperationInfoServiceImpl homeOperationInfoServiceImpl;
|
|
|
+ private AMedicalRecordContentFacade aMedicalRecordContentFacade;
|
|
|
|
|
|
@Autowired
|
|
|
- @Qualifier("basDeptInfoServiceImpl")
|
|
|
- private BasDeptInfoServiceImpl basDeptInfoServiceImpl;
|
|
|
+ private ABehospitalInfoFacade aBehospitalInfoFacade;
|
|
|
|
|
|
@Autowired
|
|
|
- @Qualifier("basDoctorInfoServiceImpl")
|
|
|
- private BasDoctorInfoServiceImpl basDoctorInfoServiceImpl;
|
|
|
+ private ADoctorAdviceFacade aDoctorAdviceFacade;
|
|
|
|
|
|
- @Autowired
|
|
|
- @Qualifier("qcModelHospitalServiceImpl")
|
|
|
- private QcModelHospitalServiceImpl qcModelHospitalServiceImpl;
|
|
|
|
|
|
- @Autowired
|
|
|
- @Qualifier("qcTypeServiceImpl")
|
|
|
- private QcTypeServiceImpl qcTypeServiceImpl;
|
|
|
-
|
|
|
- private TZDBConn tzDBConn = new TZDBConn();
|
|
|
-
|
|
|
- /**
|
|
|
- * 同步前一天科室的信息
|
|
|
- */
|
|
|
- public void executeDept() {
|
|
|
- List<BasDeptInfo> basDeptInfoList = tzDBConn.getDeptInfo();
|
|
|
- List<BasDeptInfo> add = Lists.newLinkedList();
|
|
|
- List<BasDeptInfo> updateE = Lists.newLinkedList();
|
|
|
- basDeptInfoList.stream().forEach(s -> {
|
|
|
- QueryWrapper<BasDeptInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("dept_id", s.getDeptId());
|
|
|
- BasDeptInfo basDeptInfo = basDeptInfoServiceImpl.getOne(queryWrapper);
|
|
|
- if (basDeptInfo != null) {
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- add.add(s);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- if (add != null && add.size() != 0) {
|
|
|
- basDeptInfoServiceImpl.saveBatch(add);
|
|
|
- }
|
|
|
- if (updateE != null && updateE.size() != 0) {
|
|
|
- basDeptInfoServiceImpl.updateBatchById(updateE);
|
|
|
- }
|
|
|
- }
|
|
|
+ public void executeView(){
|
|
|
+ aBasDeptInfoFacade.executeDeptPast();//科室信息
|
|
|
|
|
|
- /**
|
|
|
- * 同步前一天医生信息
|
|
|
- */
|
|
|
- public void executeDoctor() {
|
|
|
- List<BasDoctorInfo> basDeptInfoList = tzDBConn.getBasDoctorInfo();
|
|
|
- List<BasDoctorInfo> add = Lists.newLinkedList();
|
|
|
- List<BasDoctorInfo> updateE = Lists.newLinkedList();
|
|
|
- basDeptInfoList.stream().forEach(s -> {
|
|
|
- QueryWrapper<BasDoctorInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("doctor_id", s.getDeptId());
|
|
|
- BasDoctorInfo basDoctorInfo = basDoctorInfoServiceImpl.getOne(queryWrapper);
|
|
|
- if (basDoctorInfo != null) {
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- add.add(s);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- if (add != null && add.size() != 0) {
|
|
|
- basDoctorInfoServiceImpl.saveBatch(basDeptInfoList);
|
|
|
- }
|
|
|
- if (updateE != null && updateE.size() != 0) {
|
|
|
- updateE.forEach((e) -> {
|
|
|
- //e.setGmtModified(new Date());
|
|
|
- });
|
|
|
- basDoctorInfoServiceImpl.updateBatchById(updateE);
|
|
|
- }
|
|
|
- }
|
|
|
+ aBasDoctorInfoFacade.executeDoctorPast();//医生信息
|
|
|
|
|
|
- /**
|
|
|
- * 同步前一天的入院记录
|
|
|
- */
|
|
|
- public void executeBehospital() {
|
|
|
- List<BehospitalInfo> behospitalInfoList = tzDBConn.getBehospitalInfo();
|
|
|
- List<BehospitalInfo> add = Lists.newLinkedList();
|
|
|
- List<BehospitalInfo> updateE = Lists.newLinkedList();
|
|
|
- behospitalInfoList.stream().forEach(s -> {
|
|
|
- QueryWrapper<MedicalRecord> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("behospital_code", s.getBehospitalCode());
|
|
|
- wrapper.eq("hospital_id", Long.valueOf("3"));
|
|
|
- wrapper.eq("mode_id", Long.valueOf("1"));
|
|
|
- MedicalRecord medicalRecord = medicalRecordServiceImpl.getOne(wrapper);
|
|
|
- if(medicalRecord!=null){
|
|
|
- QueryWrapper<QcType> qWrapper =new QueryWrapper<>();
|
|
|
- qWrapper.eq("name",medicalRecord.getRecTitle());
|
|
|
- QcType qcType=qcTypeServiceImpl.getOne(qWrapper);
|
|
|
- if(qcType!=null){
|
|
|
- s.setQcTypeId(qcType.getId());
|
|
|
- }else{
|
|
|
- s.setQcTypeId(Long.valueOf("0"));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- QueryWrapper<BehospitalInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("behospital_code", s.getBehospitalCode());
|
|
|
- queryWrapper.eq("hospital_id", Long.valueOf("3"));
|
|
|
- BehospitalInfo behospitalInfo = behospitalInfoServiceImpl.getOne(queryWrapper);
|
|
|
- if (behospitalInfo != null) {
|
|
|
- s.setGmtModified(new Date());
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- s.setGmtCreate(new Date());
|
|
|
- add.add(s);
|
|
|
- }
|
|
|
- });
|
|
|
- if (add != null && add.size() != 0) {
|
|
|
- behospitalInfoServiceImpl.saveBatch(add);
|
|
|
- }
|
|
|
- if (updateE != null && updateE.size() != 0) {
|
|
|
- behospitalInfoServiceImpl.updateBatchById(updateE);
|
|
|
- }
|
|
|
- }
|
|
|
+ aHomePageFacade.executeHomePagePast();//病案首页
|
|
|
|
|
|
- /**
|
|
|
- * 同步前一天的入院病人医嘱信息
|
|
|
- */
|
|
|
- public void executeDoctorAdvice() {
|
|
|
- List<DoctorAdvice> doctorAdviceList = tzDBConn.getDoctorAdvice();
|
|
|
- List<DoctorAdvice> add = Lists.newLinkedList();
|
|
|
- List<DoctorAdvice> updateE = Lists.newLinkedList();
|
|
|
- if (doctorAdviceList != null && doctorAdviceList.size() > 0) {
|
|
|
- doctorAdviceList.stream().forEach(s -> {
|
|
|
- QueryWrapper<DoctorAdvice> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("doctor_advice_id", s.getDoctorAdviceId());
|
|
|
- DoctorAdvice doctorAdvice = doctorAdviceServiceImpl.getOne(queryWrapper);
|
|
|
- if (doctorAdvice != null) {
|
|
|
- s.setGmtModified(new Date());
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- s.setGmtCreate(new Date());
|
|
|
- add.add(s);
|
|
|
- }
|
|
|
- });
|
|
|
- if (add != null && add.size() > 0) {
|
|
|
- doctorAdviceServiceImpl.saveBatch(add);
|
|
|
- }
|
|
|
- if (updateE != null && updateE.size() > 0) {
|
|
|
- doctorAdviceServiceImpl.updateBatchById(updateE);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ aHomeDiagnoseInfoFacade.executeHomeDiagnosePast();//病案首页诊断
|
|
|
|
|
|
- /**
|
|
|
- * 同步前一天变更的模板类型
|
|
|
- */
|
|
|
- public void executeMRType() {
|
|
|
- List<MedRecordType> medRecordTypeList = tzDBConn.getMedicalRecordType();
|
|
|
- List<MedRecordType> add = Lists.newLinkedList();
|
|
|
- List<MedRecordType> updateE = Lists.newLinkedList();
|
|
|
- if (medRecordTypeList != null && medRecordTypeList.size() != 0) {
|
|
|
- medRecordTypeList.stream().forEach(s -> {
|
|
|
- QueryWrapper<MedRecordType> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("type_id", s.getTypeId());
|
|
|
- MedRecordType mrType = medRecordTypeServiceImpl.getOne(queryWrapper);
|
|
|
- if (mrType != null) {
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- add.add(s);
|
|
|
- }
|
|
|
- });
|
|
|
- if (add != null && add.size() != 0) {
|
|
|
- medRecordTypeServiceImpl.saveBatch(add);
|
|
|
- }
|
|
|
- if (updateE != null && updateE.size() != 0) {
|
|
|
- //updateE.forEach((e)->{e.setGmtModified(new Date());});
|
|
|
- medRecordTypeServiceImpl.updateBatchById(updateE);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ aHomeOperationInfoFacade.executeHomeOperationPast();//病案首页手术
|
|
|
|
|
|
- /**
|
|
|
- * 同步前一天的病历记录
|
|
|
- */
|
|
|
- public void executeMrRecord() {
|
|
|
- List<MedicalRecord> medicalRecordList = tzDBConn.getMedicalRecord();
|
|
|
- List<MedicalRecord> add = Lists.newLinkedList();
|
|
|
- List<MedicalRecord> updateE = Lists.newLinkedList();
|
|
|
- if (medicalRecordList != null && medicalRecordList.size() > 0) {
|
|
|
- medicalRecordList.stream().forEach(s -> {
|
|
|
- //初始化mode_id
|
|
|
- QueryWrapper<QcModelHospital> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("hospital_id", Long.valueOf("3"));
|
|
|
- wrapper.eq("hospital_model_name",s.getRecTitle());
|
|
|
- QcModelHospital mode=qcModelHospitalServiceImpl.getOne(wrapper);
|
|
|
- if(mode!=null){
|
|
|
- s.setModeId(mode.getStandModelId());
|
|
|
- }else{
|
|
|
- s.setModeId(Long.valueOf("0"));
|
|
|
- }
|
|
|
-
|
|
|
- //新增或修改
|
|
|
- QueryWrapper<MedicalRecord> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("rec_id", s.getRecId());
|
|
|
- MedicalRecord medicalRecord = medicalRecordServiceImpl.getOne(queryWrapper);
|
|
|
- if (medicalRecord != null) {
|
|
|
- s.setGmtModified(new Date());
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- s.setGmtCreate(new Date());
|
|
|
- add.add(s);
|
|
|
- }
|
|
|
- });
|
|
|
- if (add != null && add.size() > 0) {
|
|
|
- medicalRecordServiceImpl.saveBatch(add);
|
|
|
- }
|
|
|
- if (updateE != null && updateE.size() > 0) {
|
|
|
- medicalRecordServiceImpl.updateBatchById(updateE);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ aMedRecordTypeFacade.executeMRTypePast();//模板类型
|
|
|
|
|
|
- /**
|
|
|
- * 同步前一天的病历详细记录
|
|
|
- */
|
|
|
- public void executeMrRecordContent() {
|
|
|
- List<MedicalRecordContent> mrContentList = tzDBConn.getMedicalRecordContent();
|
|
|
- List<MedicalRecordContent> add = Lists.newLinkedList();
|
|
|
- List<MedicalRecordContent> updateE = Lists.newLinkedList();
|
|
|
- if (mrContentList != null && mrContentList.size() > 0) {
|
|
|
- mrContentList.stream().forEach(s -> {
|
|
|
- QueryWrapper<MedicalRecordContent> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("rec_id", s.getRecId());
|
|
|
- MedicalRecordContent mrContent = medicalRecordContentServiceImpl.getOne(queryWrapper);
|
|
|
- if (mrContent != null) {
|
|
|
- s.setGmtModified(new Date());
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- s.setGmtCreate(new Date());
|
|
|
- add.add(s);
|
|
|
- }
|
|
|
- });
|
|
|
- if (add != null && add.size() > 0) {
|
|
|
- medicalRecordContentServiceImpl.saveBatch(add);
|
|
|
- }
|
|
|
- if (updateE != null && updateE.size() > 0) {
|
|
|
- medicalRecordContentServiceImpl.updateBatchById(updateE);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ aMedicalRecordFacade.executeMrRecordPast();//病历
|
|
|
|
|
|
- /**
|
|
|
- * 同步前一天病案首页
|
|
|
- */
|
|
|
- public void executeHomePage() {
|
|
|
- List<HomePage> homePageList = tzDBConn.getHomePage();
|
|
|
- List<HomePage> add = Lists.newLinkedList();
|
|
|
- List<HomePage> updateE = Lists.newLinkedList();
|
|
|
- if (homePageList != null && homePageList.size() > 0) {
|
|
|
- homePageList.stream().forEach(s -> {
|
|
|
- QueryWrapper<HomePage> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("home_page_id", s.getHomePageId());
|
|
|
- HomePage homePage = homePageServiceImpl.getOne(queryWrapper);
|
|
|
- if (homePage != null) {
|
|
|
- s.setGmtModified(new Date());
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- s.setGmtCreate(new Date());
|
|
|
- add.add(s);
|
|
|
- }
|
|
|
- });
|
|
|
- if (add != null && add.size() > 0) {
|
|
|
- homePageServiceImpl.saveBatch(add);
|
|
|
- }
|
|
|
- if (updateE != null && updateE.size() > 0) {
|
|
|
- homePageServiceImpl.updateBatchById(updateE);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ aMedicalRecordContentFacade.executeMrRecordContentPast();//病历内容
|
|
|
+
|
|
|
+ aBehospitalInfoFacade.executeBehospitalPast();//住院信息
|
|
|
|
|
|
- public void executeHomeOperation() {
|
|
|
- List<HomeOperationInfo> homeOperationList = tzDBConn.getHomeOperation();
|
|
|
- List<HomeOperationInfo> add = Lists.newLinkedList();
|
|
|
- List<HomeOperationInfo> updateE = Lists.newLinkedList();
|
|
|
- if (homeOperationList != null && homeOperationList.size() > 0) {
|
|
|
- homeOperationList.stream().forEach(s -> {
|
|
|
- if(s.getHomePageId()!=null && !"".equals(s.getOperationOrderNo())) {
|
|
|
- QueryWrapper<HomeOperationInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("home_page_id", s.getHomePageId());
|
|
|
- queryWrapper.eq("operation_order_no", s.getOperationOrderNo());
|
|
|
- HomeOperationInfo operationInfo = homeOperationInfoServiceImpl.getOne(queryWrapper);
|
|
|
- if (operationInfo != null) {
|
|
|
- s.setGmtModified(new Date());
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- s.setGmtCreate(new Date());
|
|
|
- add.add(s);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- if (add != null && add.size() > 0) {
|
|
|
- homeOperationInfoServiceImpl.saveBatch(add);
|
|
|
- }
|
|
|
- if (updateE != null && updateE.size() > 0) {
|
|
|
- homeOperationInfoServiceImpl.updateBatchById(updateE);
|
|
|
- }
|
|
|
- }
|
|
|
+ aDoctorAdviceFacade.executeDoctorAdvicePast();//住院医嘱信息
|
|
|
}
|
|
|
|
|
|
- public void executeHomeDiagnose() {
|
|
|
- List<HomeDiagnoseInfo> homeDiagnoseList = tzDBConn.getHomeDiagnose();
|
|
|
- List<HomeDiagnoseInfo> add = Lists.newLinkedList();
|
|
|
- List<HomeDiagnoseInfo> updateE = Lists.newLinkedList();
|
|
|
- if (homeDiagnoseList != null && homeDiagnoseList.size() > 0) {
|
|
|
- homeDiagnoseList.stream().forEach(s -> {
|
|
|
- if(s.getHomePageId()!=null && !"".equals(s.getDiagnoseOrderNo())){
|
|
|
- QueryWrapper<HomeDiagnoseInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("home_page_id", s.getHomePageId());
|
|
|
- queryWrapper.eq("diagnose_order_no", s.getDiagnoseOrderNo());
|
|
|
- HomeDiagnoseInfo diagnoseInfo = homeDiagnoseInfoServiceImpl.getOne(queryWrapper);
|
|
|
- if (diagnoseInfo != null) {
|
|
|
- s.setGmtModified(new Date());
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- s.setGmtCreate(new Date());
|
|
|
- add.add(s);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- if (add != null) {
|
|
|
- homeDiagnoseInfoServiceImpl.saveBatch(add);
|
|
|
- }
|
|
|
- if (updateE != null) {
|
|
|
- homeDiagnoseInfoServiceImpl.updateBatchById(updateE);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ public void executePort(){
|
|
|
+ aBasDeptInfoFacade.executeDeptPort();//科室信息
|
|
|
+
|
|
|
+ aBasDoctorInfoFacade.executeDoctorPort();//医生信息
|
|
|
+
|
|
|
+ aHomePageFacade.executeHomePagePort();//病案首页
|
|
|
+
|
|
|
+ aHomeDiagnoseInfoFacade.executeHomeDiagnosePort();//病案首页诊断
|
|
|
+
|
|
|
+ aHomeOperationInfoFacade.executeHomeOperationPort();//病案首页手术
|
|
|
+
|
|
|
+ aMedRecordTypeFacade.executeMRTypePort();//模板类型
|
|
|
+
|
|
|
+ aMedicalRecordFacade.executeMrRecordPort();//病历
|
|
|
+
|
|
|
+ aMedicalRecordContentFacade.executeMrRecordContentPort();//病历内容
|
|
|
+
|
|
|
+ aBehospitalInfoFacade.executeBehospitalPort();//住院信息
|
|
|
+
|
|
|
+ aDoctorAdviceFacade.executeDoctorAdvicePort();//住院医嘱信息
|
|
|
}
|
|
|
}
|