|
@@ -1,12 +1,15 @@
|
|
|
package com.diagbot.facade.data;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
+import java.util.*;
|
|
|
+import java.util.concurrent.BlockingQueue;
|
|
|
+import java.util.concurrent.LinkedBlockingQueue;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.diagbot.entity.*;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.facade.MedTaskQueueFacade;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -14,17 +17,6 @@ import org.springframework.stereotype.Component;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.diagbot.dto.AnalyzeRunDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
-import com.diagbot.entity.BehospitalInfo;
|
|
|
-import com.diagbot.entity.DoctorAdvice;
|
|
|
-import com.diagbot.entity.HomeDiagnoseInfo;
|
|
|
-import com.diagbot.entity.HomeOperationInfo;
|
|
|
-import com.diagbot.entity.MedCrisisInfo;
|
|
|
-import com.diagbot.entity.MedLisInfo;
|
|
|
-import com.diagbot.entity.MedLisResult;
|
|
|
-import com.diagbot.entity.MedPacsInfo;
|
|
|
-import com.diagbot.entity.MedPacsResult;
|
|
|
-import com.diagbot.entity.StrInformedConsent;
|
|
|
-import com.diagbot.entity.StrTalkInform;
|
|
|
import com.diagbot.enums.ModeIdEnum;
|
|
|
import com.diagbot.enums.TableNameEnum;
|
|
|
import com.diagbot.facade.BehospitalInfoFacade;
|
|
@@ -114,7 +106,7 @@ public class StructuralDataFacade {
|
|
|
@Autowired
|
|
|
private AStrConsultationRecordFacade aStrConsultationRecordFacade;
|
|
|
@Autowired
|
|
|
- private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
|
|
|
+ private AMedAbnormalInfoFacade aMedAbnormalInfoFacade = new AMedAbnormalInfoFacade();
|
|
|
@Autowired
|
|
|
private ReadProperties readProperties;
|
|
|
@Autowired
|
|
@@ -143,14 +135,18 @@ public class StructuralDataFacade {
|
|
|
private MedLisInfoFacade medLisInfoFacade;
|
|
|
@Autowired
|
|
|
private MedPacsInfoFacade medPacsInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private MedTaskQueueFacade medTaskQueueFacade;
|
|
|
|
|
|
private FJTZDBConnHarp fjtzdbConnHarp = new FJTZDBConnHarp();
|
|
|
+ private BlockingQueue<StructuralDataFacade> taskQueue = new LinkedBlockingQueue<>();
|
|
|
+ private BlockingQueue<StructuralDataFacade> taskQueueAnalyzeApi = new LinkedBlockingQueue<>();
|
|
|
|
|
|
-
|
|
|
- public RespDTO<Map<String, Object>> sendStructuralData(StructuralDataVo structuralDataVos) {
|
|
|
+ public RespDTO<Map<String, Object>> sendStructuralData(StructuralDataVo structuralDataVos, AMedAbnormalInfoFacade aMedAbnormalInfoFacade, BehospitalInfoFacade behospitalInfoFacade) {
|
|
|
|
|
|
if (structuralDataVos != null) {
|
|
|
if (StringUtils.isEmpty(structuralDataVos.getBehospitalCode())) {
|
|
|
+ System.out.println("任务完成++++++++++++++++++++");
|
|
|
return RespDTO.onError("请输入病历号!");
|
|
|
} else if (null == structuralDataVos.getHospitalId()) {
|
|
|
return RespDTO.onError("请输入医院编码!");
|
|
@@ -184,7 +180,8 @@ public class StructuralDataFacade {
|
|
|
} else {
|
|
|
execute(structuralDataVos);
|
|
|
}
|
|
|
-
|
|
|
+ // 是否质控标识,为0则不进行质控评分
|
|
|
+// if(structuralDataVos.getIsQcScore() == 1){
|
|
|
long time2 = System.currentTimeMillis();
|
|
|
System.out.println("装载数据所耗时为-----" + (time2 - time1));
|
|
|
|
|
@@ -197,19 +194,91 @@ public class StructuralDataFacade {
|
|
|
}
|
|
|
|
|
|
//返回评分结构体
|
|
|
- RespDTO<Map<String, Object>> msg = mrIng(structuralDataVos);
|
|
|
+ RespDTO<Map<String, Object>> msg = mrIng(structuralDataVos, aMedAbnormalInfoFacade, behospitalInfoFacade);
|
|
|
long time3 = System.currentTimeMillis();
|
|
|
System.out.println("评分所耗时为--------" + (time3 - time2));
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("sendStructuralData总耗时", structuralDataVos.getBehospitalCode(), ""+(time3-time1), JSON.toJSONString(structuralDataVos), "sendStructuralData耗时");
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("装载数据所耗时为", structuralDataVos.getBehospitalCode(), ""+(time3-time1), JSON.toJSONString(structuralDataVos), "装载数据所耗时为");
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("sendStructuralData总耗时", structuralDataVos.getBehospitalCode(), "" + (time3 - time1), JSON.toJSONString(structuralDataVos), "sendStructuralData耗时");
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("装载数据所耗时为", structuralDataVos.getBehospitalCode(), "" + (time3 - time1), JSON.toJSONString(structuralDataVos), "装载数据所耗时为");
|
|
|
return msg;
|
|
|
+// }
|
|
|
+// return RespDTO.onSuc(null);
|
|
|
} else {
|
|
|
return RespDTO.onError("未接收到数据!");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- public RespDTO<Map<String, Object>> sendStructuralDataTest(StructuralDataVo structuralDataVos,HashSet<String> modeIds) {
|
|
|
+ public void startAsyncProcessing(StructuralDataVo structuralDataVos) {
|
|
|
+ Thread workerThread = new Thread(() -> {
|
|
|
+ while (true) {
|
|
|
+ try {
|
|
|
+ StructuralDataFacade take = taskQueue.take();
|
|
|
+ if (take != null) {
|
|
|
+ take.sendStructuralData(structuralDataVos, aMedAbnormalInfoFacade, behospitalInfoFacade);
|
|
|
+ if (structuralDataVos.getWorkId() != null) {
|
|
|
+ UpdateWrapper<MedTaskQueue> medTaskQueueUpdate = new UpdateWrapper<>();
|
|
|
+ medTaskQueueUpdate.eq("hospital_id", structuralDataVos.getHospitalId()).eq("work_id", structuralDataVos.getWorkId()).set("is_execute", IsDeleteEnum.Y.getKey()).set("gmt_modified", new Date());
|
|
|
+ medTaskQueueFacade.update(medTaskQueueUpdate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ workerThread.start();
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean addToQueue(StructuralDataVo structuralDataVos) {
|
|
|
+ //判断modeName是否在
|
|
|
+ List<String> modeList = Arrays.asList("入院记录", "首次病程录", "死亡病例讨论记录", "上级医师查房记录", "出院小结", "住院病案首页", "会诊记录"
|
|
|
+ , "一般手术记录", "术前讨论、术前小结", "手术知情同意书", "术后首次病程及谈话记录", "疑难病例讨论记录", "手术安全核查表"
|
|
|
+ , "抢救记录", "死亡记录", "病危通知书", "转入记录", "转出记录", "阶段小结", "病重通知书", "会诊结果单");
|
|
|
+
|
|
|
+ if (modeList.contains(structuralDataVos.getModeName())) {
|
|
|
+ //如果任务列表中存在该病历,则返回
|
|
|
+ int count = medTaskQueueFacade.count(new QueryWrapper<MedTaskQueue>()
|
|
|
+ .eq("behospital_code", structuralDataVos.getBehospitalCode())
|
|
|
+ .eq("hospital_id", structuralDataVos.getHospitalId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("is_analyze", "1")
|
|
|
+ .eq("is_execute", IsDeleteEnum.N.getKey())
|
|
|
+ );
|
|
|
+ System.out.println("单文书质控查询到数量为+++++++++++++++++++++++++++++:" + count);
|
|
|
+ if (count > 0) {
|
|
|
+ log.info("该病历信息已存在于任务队列中。。。。");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ StructuralDataFacade task = new StructuralDataFacade(aMedAbnormalInfoFacade, behospitalInfoFacade);
|
|
|
+ long timestamp = System.currentTimeMillis(); //当前时间戳
|
|
|
+ //加入任务
|
|
|
+ if (taskQueue.offer(task)) {
|
|
|
+ MedTaskQueue medTaskQueue = new MedTaskQueue();
|
|
|
+ if (StringUtil.isBlank(structuralDataVos.getWorkId())) {
|
|
|
+ medTaskQueue.setWorkId(String.valueOf(timestamp));
|
|
|
+ structuralDataVos.setWorkId(String.valueOf(timestamp));
|
|
|
+ } else {
|
|
|
+ medTaskQueue.setWorkId(structuralDataVos.getWorkId());
|
|
|
+ }
|
|
|
+ medTaskQueue.setHospitalId(structuralDataVos.getHospitalId());
|
|
|
+ medTaskQueue.setBehospitalCode(structuralDataVos.getBehospitalCode());
|
|
|
+ medTaskQueue.setPatientId(structuralDataVos.getPatientId());
|
|
|
+ medTaskQueue.setIsAnalyze("1");
|
|
|
+ medTaskQueue.setModeName(structuralDataVos.getModeName());
|
|
|
+ medTaskQueue.setParamIn(JSON.toJSONString(structuralDataVos));
|
|
|
+ medTaskQueue.setGmtCreate(new Date());
|
|
|
+ medTaskQueueFacade.save(medTaskQueue);
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public RespDTO<Map<String, Object>> sendStructuralDataTest(StructuralDataVo structuralDataVos, HashSet<String> modeIds) {
|
|
|
|
|
|
if (structuralDataVos != null) {
|
|
|
if (StringUtils.isEmpty(structuralDataVos.getBehospitalCode())) {
|
|
@@ -222,14 +291,14 @@ public class StructuralDataFacade {
|
|
|
//装载数据
|
|
|
long time1 = System.currentTimeMillis();
|
|
|
if (!structuralDataVos.getModeName().isEmpty()) {
|
|
|
- structuralDataVos = isModeIdTest(structuralDataVos,modeIds);
|
|
|
+ structuralDataVos = isModeIdTest(structuralDataVos, modeIds);
|
|
|
if (structuralDataVos.getModeId().equals("0")) {
|
|
|
String recId = structuralDataVos.getRecId();
|
|
|
String[] modeList = {"23", "31", "32"};
|
|
|
for (String modeId : modeList) {
|
|
|
structuralDataVos.setModeId(modeId);
|
|
|
structuralDataVos.setRecId(recId + "-" + structuralDataVos.getModeId());
|
|
|
- // execute(structuralDataVos);
|
|
|
+ // execute(structuralDataVos);
|
|
|
}
|
|
|
} else if (structuralDataVos.getModeId().equals("34")) {
|
|
|
String recId = structuralDataVos.getRecId();
|
|
@@ -241,10 +310,10 @@ public class StructuralDataFacade {
|
|
|
}
|
|
|
} else {
|
|
|
structuralDataVos.setRecId(structuralDataVos.getRecId() + "-" + structuralDataVos.getModeId());
|
|
|
- // execute(structuralDataVos);
|
|
|
+ // execute(structuralDataVos);
|
|
|
}
|
|
|
} else {
|
|
|
- // execute(structuralDataVos);
|
|
|
+ // execute(structuralDataVos);
|
|
|
}
|
|
|
|
|
|
long time2 = System.currentTimeMillis();
|
|
@@ -259,11 +328,11 @@ public class StructuralDataFacade {
|
|
|
}
|
|
|
|
|
|
//返回评分结构体
|
|
|
- // RespDTO<Map<String, Object>> msg = mrIng(structuralDataVos);
|
|
|
+ // RespDTO<Map<String, Object>> msg = mrIng(structuralDataVos);
|
|
|
long time3 = System.currentTimeMillis();
|
|
|
System.out.println("评分所耗时为--------" + (time3 - time2));
|
|
|
- // aMedAbnormalInfoFacade.saveAbnormalInfo("sendStructuralData总耗时", structuralDataVos.getBehospitalCode(), ""+(time3-time1), JSON.toJSONString(structuralDataVos), "sendStructuralData耗时");
|
|
|
- // aMedAbnormalInfoFacade.saveAbnormalInfo("装载数据所耗时为", structuralDataVos.getBehospitalCode(), ""+(time2-time1), JSON.toJSONString(structuralDataVos), "装载数据所耗时为");
|
|
|
+ // aMedAbnormalInfoFacade.saveAbnormalInfo("sendStructuralData总耗时", structuralDataVos.getBehospitalCode(), ""+(time3-time1), JSON.toJSONString(structuralDataVos), "sendStructuralData耗时");
|
|
|
+ // aMedAbnormalInfoFacade.saveAbnormalInfo("装载数据所耗时为", structuralDataVos.getBehospitalCode(), ""+(time2-time1), JSON.toJSONString(structuralDataVos), "装载数据所耗时为");
|
|
|
|
|
|
return RespDTO.onSuc("111");
|
|
|
} else {
|
|
@@ -271,6 +340,7 @@ public class StructuralDataFacade {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 判断所属模板再保存
|
|
|
*
|
|
@@ -531,7 +601,7 @@ public class StructuralDataFacade {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- private RespDTO<Map<String, Object>> mrIng(StructuralDataVo structuralDataVos) {
|
|
|
+ private RespDTO<Map<String, Object>> mrIng(StructuralDataVo structuralDataVos, AMedAbnormalInfoFacade aMedAbnormalInfoFacade, BehospitalInfoFacade behospitalInfoFacade) {
|
|
|
String behospitalCode = structuralDataVos.getBehospitalCode();
|
|
|
Long hospitalId = structuralDataVos.getHospitalId();
|
|
|
Long modeId = Long.valueOf(structuralDataVos.getModeId());
|
|
@@ -540,40 +610,42 @@ public class StructuralDataFacade {
|
|
|
structuralDataVos.setModeId("63");
|
|
|
execute(structuralDataVos);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
- if(structuralDataVos.getDockModeType().equals("0")) {
|
|
|
+ if (structuralDataVos.getDockModeType().equals("0")) {
|
|
|
map.put("records", Arrays.asList(structuralDataVos));
|
|
|
-
|
|
|
+
|
|
|
AnalyzeRunVO vo = new AnalyzeRunVO();
|
|
|
- vo.setBehospitalCode(structuralDataVos.getBehospitalCode());
|
|
|
- vo.setHospitalId(structuralDataVos.getHospitalId());
|
|
|
+ vo.setBehospitalCode(structuralDataVos.getBehospitalCode());
|
|
|
+ vo.setHospitalId(structuralDataVos.getHospitalId());
|
|
|
+ vo.setIsQcScore(structuralDataVos.getIsQcScore());
|
|
|
+ vo.setPatientId(structuralDataVos.getPatientId());
|
|
|
new Thread() {
|
|
|
- public void run() {
|
|
|
- System.gc();
|
|
|
- behospitalInfoFacade.analyzeApi(vo);
|
|
|
- }
|
|
|
- }.start();
|
|
|
-
|
|
|
+ public void run() {
|
|
|
+ System.gc();
|
|
|
+ behospitalInfoFacade.analyzeApi(vo, aMedAbnormalInfoFacade, behospitalInfoFacade);
|
|
|
+ }
|
|
|
+ }.start();
|
|
|
+
|
|
|
return RespDTO.onSuc(map);
|
|
|
- }else if (structuralDataVos.getDockModeType().equals("1")) {
|
|
|
+ } else if (structuralDataVos.getDockModeType().equals("1")) {
|
|
|
//页面模式
|
|
|
String url = readProperties.getProcessQcUrl() + "?behospitalCode=" + behospitalCode + "&hospitalId=" + hospitalId + "&modeId=" + modeId;
|
|
|
map.put("url", url);
|
|
|
return RespDTO.onSuc(map);
|
|
|
- }else if(structuralDataVos.getDockModeType().equals("2")) {
|
|
|
- AnalyzeRunVO analyzeRunVO = new AnalyzeRunVO();
|
|
|
- analyzeRunVO.setBehospitalCode(behospitalCode);
|
|
|
- analyzeRunVO.setHospitalId(hospitalId);
|
|
|
- analyzeRunVO.setModeId(modeId);
|
|
|
- AnalyzeRunDTO analyzeRunDTO = behospitalInfoFacade.analyzeRun(analyzeRunVO);
|
|
|
- if (analyzeRunDTO.getMsgDTOList().size() > 0) {
|
|
|
- map.put("analyze", analyzeRunDTO.getMsgDTOList());
|
|
|
- }
|
|
|
- //接口引擎模式
|
|
|
- return RespDTO.onSuc(map);
|
|
|
+ } else if (structuralDataVos.getDockModeType().equals("2")) {
|
|
|
+ AnalyzeRunVO analyzeRunVO = new AnalyzeRunVO();
|
|
|
+ analyzeRunVO.setBehospitalCode(behospitalCode);
|
|
|
+ analyzeRunVO.setHospitalId(hospitalId);
|
|
|
+ analyzeRunVO.setModeId(modeId);
|
|
|
+ AnalyzeRunDTO analyzeRunDTO = behospitalInfoFacade.analyzeRun(analyzeRunVO);
|
|
|
+ if (analyzeRunDTO.getMsgDTOList().size() > 0) {
|
|
|
+ map.put("analyze", analyzeRunDTO.getMsgDTOList());
|
|
|
+ }
|
|
|
+ //接口引擎模式
|
|
|
+ return RespDTO.onSuc(map);
|
|
|
} else {
|
|
|
- //页面模式
|
|
|
+ //页面模式
|
|
|
String url = readProperties.getProcessQcUrl() + "?behospitalCode=" + behospitalCode + "&hospitalId=" + hospitalId + "&modeId=" + modeId;
|
|
|
AnalyzeRunVO analyzeRunVO = new AnalyzeRunVO();
|
|
|
analyzeRunVO.setBehospitalCode(behospitalCode);
|
|
@@ -588,7 +660,6 @@ public class StructuralDataFacade {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* 根据传来的信息编辑视图的sql语句
|
|
@@ -663,7 +734,7 @@ public class StructuralDataFacade {
|
|
|
return structuralDataVo;
|
|
|
}
|
|
|
|
|
|
- public StructuralDataVo isModeIdTest(StructuralDataVo structuralDataVo,HashSet<String> modeIds) {
|
|
|
+ public StructuralDataVo isModeIdTest(StructuralDataVo structuralDataVo, HashSet<String> modeIds) {
|
|
|
String modeName = structuralDataVo.getModeName();
|
|
|
String modeId = "0";
|
|
|
if (modeName.equals("入院记录")) {
|
|
@@ -717,9 +788,110 @@ public class StructuralDataFacade {
|
|
|
}
|
|
|
structuralDataVo.setModeId(modeId);
|
|
|
modeIds.add(modeId);
|
|
|
- // aMedAbnormalInfoFacade.saveAbnormalInfo("his入参", structuralDataVo.getRecId(), JSON.toJSONString(structuralDataVo), "", "");
|
|
|
+ // aMedAbnormalInfoFacade.saveAbnormalInfo("his入参", structuralDataVo.getRecId(), JSON.toJSONString(structuralDataVo), "", "");
|
|
|
return structuralDataVo;
|
|
|
}
|
|
|
|
|
|
+ public RespDTO<Boolean> sendAnalyzers(AnalyzeRunVO analyzeRunVO, AMedAbnormalInfoFacade aMedAbnormalInfoFacade, BehospitalInfoFacade behospitalInfoFacade) {
|
|
|
+
|
|
|
+ if (analyzeRunVO != null) {
|
|
|
+ if (StringUtils.isEmpty(analyzeRunVO.getBehospitalCode())) {
|
|
|
+ return RespDTO.onError("请输入病历号!");
|
|
|
+ } else if (null == analyzeRunVO.getHospitalId()) {
|
|
|
+ return RespDTO.onError("请输入医院编码!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //返回评分结构体
|
|
|
+ behospitalInfoFacade.analyzeApi(analyzeRunVO, aMedAbnormalInfoFacade, behospitalInfoFacade);
|
|
|
+ return RespDTO.onSuc(true);
|
|
|
+ } else {
|
|
|
+ return RespDTO.onSuc(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public void startAsyncProcessingAnalyzeApi(AnalyzeRunVO analyzeRunVO) {
|
|
|
+ Thread workerThread = new Thread(() -> {
|
|
|
+ while (true) {
|
|
|
+ try {
|
|
|
+ StructuralDataFacade take = taskQueueAnalyzeApi.take();
|
|
|
+ if (take != null) {
|
|
|
+ take.sendAnalyzers(analyzeRunVO, aMedAbnormalInfoFacade, behospitalInfoFacade);
|
|
|
+ if (analyzeRunVO.getWorkId() != null) {
|
|
|
+ UpdateWrapper<MedTaskQueue> medTaskQueueUpdate = new UpdateWrapper<>();
|
|
|
+ medTaskQueueUpdate.eq("hospital_id", analyzeRunVO.getHospitalId()).eq("work_id", analyzeRunVO.getWorkId()).set("is_execute", IsDeleteEnum.Y.getKey()).set("gmt_modified", new Date());
|
|
|
+ medTaskQueueFacade.update(medTaskQueueUpdate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ workerThread.start();
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean addToQueueAnalyzeApi(AnalyzeRunVO analyzeRunVO) {
|
|
|
+// BehospitalInfoFacade task = new BehospitalInfoFacade(qcCasesEntryFacade, qcServiceClient, sysDictionaryFacade, medicalRecordFacade, strConsultationApplyFacade, strConsultationResultFacade, strConsultationNoteFacade,
|
|
|
+// strConsultationRecordFacade, strAdmissionNoteFacade, strBloodResultFacade, strBloodTransfusionFacade, strCrisisNoteFacade, strDeathDiscussionFacade, strDeathNoteFacade,
|
|
|
+// strDifficultCaseFacade, strFirstRecordFacade, strIllCriticallyFacade, strIllSeriouslFacade, strLeaveHospitalFacade, strOperativeFirstRecordFacade, strOperativeNoteFacade,
|
|
|
+// strPeriodConclusionFacade, strPreoperativeDiscussionFacade, strRescueNoteFacade, strTransferInNoteFacade, strTransferOutNoteFacade, strWardRecordFacade, doctorAdviceFacade,
|
|
|
+// medCrisisInfoFacade,strInvasiveOperativeNoteFacade, homePageFacade,medTransferRecordFacade,homeDiagnoseInfoFacade,homeOperationInfoFacade,basHospitalInfoFacade);
|
|
|
+ //如果任务列表中存在该病历,则返回
|
|
|
+ int count = medTaskQueueFacade.count(new QueryWrapper<MedTaskQueue>()
|
|
|
+ .eq("behospital_code", analyzeRunVO.getBehospitalCode())
|
|
|
+ .eq("hospital_id", analyzeRunVO.getHospitalId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("is_analyze", "2")
|
|
|
+ .eq("is_execute", IsDeleteEnum.N.getKey())
|
|
|
+ );
|
|
|
+ System.out.println("AnalyzeApi查询到数量为+++++++++++++++++++++++++++++:" + count);
|
|
|
+ if (count > 0) {
|
|
|
+ log.info("该病历信息已存在于任务队列中。。。。");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ StructuralDataFacade task = new StructuralDataFacade(aMedAbnormalInfoFacade, behospitalInfoFacade);
|
|
|
+ long timestamp = System.currentTimeMillis(); //当前时间戳
|
|
|
+ //加入任务
|
|
|
+ if (taskQueueAnalyzeApi.offer(task)) {
|
|
|
+ MedTaskQueue medTaskQueue = new MedTaskQueue();
|
|
|
+ if (StringUtil.isBlank(analyzeRunVO.getWorkId())) {
|
|
|
+ medTaskQueue.setWorkId(String.valueOf(timestamp));
|
|
|
+ analyzeRunVO.setWorkId(String.valueOf(timestamp));
|
|
|
+ } else {
|
|
|
+ medTaskQueue.setWorkId(analyzeRunVO.getWorkId());
|
|
|
+ }
|
|
|
+ medTaskQueue.setHospitalId(analyzeRunVO.getHospitalId());
|
|
|
+ medTaskQueue.setBehospitalCode(analyzeRunVO.getBehospitalCode());
|
|
|
+ medTaskQueue.setPatientId(analyzeRunVO.getPatientId());
|
|
|
+ medTaskQueue.setIsAnalyze("2");
|
|
|
+ medTaskQueue.setParamIn(JSON.toJSONString(analyzeRunVO));
|
|
|
+ medTaskQueue.setGmtCreate(new Date());
|
|
|
+ medTaskQueueFacade.save(medTaskQueue);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public StructuralDataFacade(AMedAbnormalInfoFacade aMedAbnormalInfoFacade, BehospitalInfoFacade behospitalInfoFacade) {
|
|
|
+ this.aMedAbnormalInfoFacade = aMedAbnormalInfoFacade;
|
|
|
+ this.behospitalInfoFacade = behospitalInfoFacade;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean sendTest(AnalyzeRunVO analyzeRunVO) {
|
|
|
+ //返回评分结构体
|
|
|
+ behospitalInfoFacade.analyzeApi(analyzeRunVO, aMedAbnormalInfoFacade, behospitalInfoFacade);
|
|
|
+
|
|
|
+ MedTaskQueue medTaskQueue = new MedTaskQueue();
|
|
|
+ medTaskQueue.setWorkId(analyzeRunVO.getWorkId());
|
|
|
+ medTaskQueue.setHospitalId(analyzeRunVO.getHospitalId());
|
|
|
+ medTaskQueue.setParamIn("测试接口返回:" + JSON.toJSONString(analyzeRunVO));
|
|
|
+ medTaskQueue.setGmtCreate(new Date());
|
|
|
+ medTaskQueueFacade.save(medTaskQueue);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
}
|