|
@@ -7,6 +7,7 @@ import com.diagbot.client.AuthServiceClient;
|
|
|
import com.diagbot.client.QcServiceClient;
|
|
|
import com.diagbot.dto.AlgorithmDTO;
|
|
|
import com.diagbot.dto.AnalyzeDTO;
|
|
|
+import com.diagbot.dto.AnalyzeRunDTO;
|
|
|
import com.diagbot.dto.BehosDTO;
|
|
|
import com.diagbot.dto.BehospitalInfoDTO;
|
|
|
import com.diagbot.dto.MsgApiDTO;
|
|
@@ -24,6 +25,7 @@ import com.diagbot.entity.DoctorAdvice;
|
|
|
import com.diagbot.entity.HomeDiagnoseInfo;
|
|
|
import com.diagbot.entity.HomeOperationInfo;
|
|
|
import com.diagbot.entity.HomePage;
|
|
|
+import com.diagbot.entity.QcModelHospital;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
@@ -38,6 +40,8 @@ import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.util.SysUserUtils;
|
|
|
import com.diagbot.vo.AlgorithmVO;
|
|
|
import com.diagbot.vo.AnalyzeApiVO;
|
|
|
+import com.diagbot.vo.AnalyzeCodeVO;
|
|
|
+import com.diagbot.vo.AnalyzeRunVO;
|
|
|
import com.diagbot.vo.AnalyzeVO;
|
|
|
import com.diagbot.vo.BehospitalPageVO;
|
|
|
import com.diagbot.vo.GetDetailVO;
|
|
@@ -100,6 +104,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
Boolean encryptFlag;
|
|
|
@Autowired
|
|
|
QcQuestionFacade qcQuestionFacade;
|
|
|
+ @Autowired
|
|
|
+ QcModelHospitalFacade qcModelHospitalFacade;
|
|
|
|
|
|
public IPage<BehospitalInfoDTO> pageFac(BehospitalPageVO behospitalPageVO) {
|
|
|
//入参验证
|
|
@@ -329,9 +335,13 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
codeToInfoMap.put(key, mapInfo.get("info"));
|
|
|
}
|
|
|
}
|
|
|
- qcResultAlgQueryVO.setCodeList(codeList);
|
|
|
- qcResultAlgQueryVO.setHospitalId(hospitalId);
|
|
|
- List<QcResultAlgVO> qcResultAlgVOList = qcCasesEntryFacade.getQcResultAlgVO(qcResultAlgQueryVO);
|
|
|
+ // 判断code是否为空
|
|
|
+ List<QcResultAlgVO> qcResultAlgVOList = new ArrayList<>();
|
|
|
+ if (ListUtil.isNotEmpty(codeList)) {
|
|
|
+ qcResultAlgQueryVO.setCodeList(codeList);
|
|
|
+ qcResultAlgQueryVO.setHospitalId(hospitalId);
|
|
|
+ qcResultAlgVOList = qcCasesEntryFacade.getQcResultAlgVO(qcResultAlgQueryVO);
|
|
|
+ }
|
|
|
|
|
|
// 对info赋值
|
|
|
for(QcResultAlgVO bean : qcResultAlgVOList) {
|
|
@@ -772,4 +782,203 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ public AnalyzeRunDTO analyzeRun(AnalyzeRunVO analyzeRunVO) {
|
|
|
+ AnalyzeVO analyzeVO = new AnalyzeVO();
|
|
|
+ BeanUtil.copyProperties(analyzeRunVO, analyzeVO);
|
|
|
+ Long hospitalId = analyzeVO.getHospitalId();
|
|
|
+
|
|
|
+ // 获取质控条目
|
|
|
+ List<QcCasesEntryDTO> qcCasesEntryDTOList = qcCasesEntryFacade.getQcCasesEntry(analyzeVO);
|
|
|
+ if(ListUtil.isEmpty(qcCasesEntryDTOList)){
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历找不到质控条目!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取病历所有数据
|
|
|
+ Map<String, Map<String, String>> dicMap = sysDictionaryFacade.getDictionaryWithKey(); // 获取字典信息
|
|
|
+ // 获取文书信息
|
|
|
+ RecordContentVO recordContentVO = new RecordContentVO();
|
|
|
+ BeanUtil.copyProperties(analyzeVO, recordContentVO);
|
|
|
+ List<RecordContentDTO> recordContentDTOList = medicalRecordFacade.getRecordContentFac(recordContentVO);
|
|
|
+ String recTitle = "";
|
|
|
+ // 解密数据
|
|
|
+ if (encryptFlag) {
|
|
|
+ try {
|
|
|
+ EncrypDES encrypDES = new EncrypDES();
|
|
|
+ for (RecordContentDTO recordContentDTO : recordContentDTOList) {
|
|
|
+ recTitle = recordContentDTO.getRecTitle();
|
|
|
+ recordContentDTO.setXmlText(encrypDES.decryptor(recordContentDTO.getXmlText()));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "解密错误!病历号=【" + analyzeVO.getBehospitalCode() + "】,医院文书名称=【" + recTitle + "】");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, List<RecordContentDTO>> recMap = EntityUtil.makeEntityListMap(recordContentDTOList, "standModelName");
|
|
|
+
|
|
|
+ // 获取医嘱
|
|
|
+ List<DoctorAdvice> doctorAdviceList = doctorAdviceFacade.list(new QueryWrapper<DoctorAdvice>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("behospital_code", analyzeVO.getBehospitalCode())
|
|
|
+ );
|
|
|
+
|
|
|
+ // 获取病案首页
|
|
|
+ HomePage homePage = homePageFacade.getOne(new QueryWrapper<HomePage>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("behospital_code", analyzeVO.getBehospitalCode()), false
|
|
|
+ );
|
|
|
+
|
|
|
+ List<HomeDiagnoseInfo> homePageList = new ArrayList<>();
|
|
|
+ List<HomeOperationInfo> homeOperationInfoList = new ArrayList<>();
|
|
|
+ if (homePage != null) {
|
|
|
+ // 获取首页出院诊断、病理诊断
|
|
|
+ homePageList = homeDiagnoseInfoFacade.list(new QueryWrapper<HomeDiagnoseInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("home_page_id", homePage.getHomePageId())
|
|
|
+ );
|
|
|
+
|
|
|
+ // 获取首页手术信息
|
|
|
+ homeOperationInfoList = homeOperationInfoFacade.list(new QueryWrapper<HomeOperationInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
+ .eq("home_page_id", homePage.getHomePageId())
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 拼接数据
|
|
|
+ String hosCode = basHospitalInfoFacade.getHosCode(hospitalId);
|
|
|
+ QueryVo queryVo = new QueryVo();
|
|
|
+ queryVo.setCid(hosCode); // 设置医院编码
|
|
|
+ queryVo.setInputCatalogueMap(getInputCatalogueMap(qcCasesEntryDTOList)); // 设置质控条目编码
|
|
|
+ List<MedrecVo> medrecVoList = new ArrayList<>(); // 设置内容
|
|
|
+
|
|
|
+ addData("入院记录", recMap, medrecVoList);
|
|
|
+ addData("病危通知书", recMap, medrecVoList);
|
|
|
+ addData("阶段小结", recMap, medrecVoList);
|
|
|
+ addData("抢救记录", recMap, medrecVoList);
|
|
|
+ addData("查房记录", recMap, medrecVoList);
|
|
|
+ addData("首次病程录", recMap, medrecVoList);
|
|
|
+ addData("输血/血制品病程记录", recMap, medrecVoList);
|
|
|
+ addData("输血后效果评价", recMap, medrecVoList);
|
|
|
+ addData("死亡病例讨论记录", recMap, medrecVoList);
|
|
|
+ addData("死亡记录", recMap, medrecVoList);
|
|
|
+ addData("危急值记录", recMap, medrecVoList);
|
|
|
+ addData("出院小结", recMap, medrecVoList);
|
|
|
+ addData("疑难病例讨论记录", recMap, medrecVoList);
|
|
|
+ addData("输血后效果评价", recMap, medrecVoList);
|
|
|
+ addData("病理检验送检单", recMap, medrecVoList);
|
|
|
+
|
|
|
+ addDataWithInnerKey("知情同意书", recMap, medrecVoList);
|
|
|
+ addDataWithInnerKey("谈话告知书", recMap, medrecVoList);
|
|
|
+
|
|
|
+ // 会诊记录
|
|
|
+ addDataWithKey("会诊", recMap, medrecVoList,
|
|
|
+ Arrays.asList("会诊记录", "会诊结果单", "会诊申请单"));
|
|
|
+
|
|
|
+ // 手术
|
|
|
+ addDataWithKey("手术", recMap, medrecVoList,
|
|
|
+ Arrays.asList("术后首次病程及谈话记录", "手术记录",
|
|
|
+ "术前讨论、术前小结", "手术知情同意书", "手术安全核查表"));
|
|
|
+
|
|
|
+ // 医嘱
|
|
|
+ if (ListUtil.isNotEmpty(doctorAdviceList)) {
|
|
|
+ addDataWithKeyConvert("医嘱信息", doctorAdviceList, medrecVoList,
|
|
|
+ dicMap.get("1"), Arrays.asList("daStartDate", "daStopDate"));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 病案首页
|
|
|
+ if (homePage != null) {
|
|
|
+ addDataWithFirstPage("病案首页", homePage, medrecVoList, dicMap,
|
|
|
+ homePageList, homeOperationInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ queryVo.setMedrec(medrecVoList);
|
|
|
+
|
|
|
+ // 调用质控接口
|
|
|
+ Response<OutputInfo> response = qcServiceClient.extract(queryVo);
|
|
|
+ if (response == null || response.getData() == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, "远程质控接口没有返回数据!");
|
|
|
+ }
|
|
|
+ OutputInfo outputInfo = response.getData();
|
|
|
+ //根据质控结果获取质控条目
|
|
|
+ QcResultAlgQueryVO qcResultAlgQueryVO = new QcResultAlgQueryVO();
|
|
|
+ List<String> codeList = new ArrayList<>();
|
|
|
+ // code和info的映射map
|
|
|
+ Map<String, String> codeToInfoMap = new LinkedHashMap<>();
|
|
|
+ Map<String, Map<String, String>> codeMap = outputInfo.getResult();
|
|
|
+ for (String key : codeMap.keySet()) {
|
|
|
+ codeList.add(key);
|
|
|
+ Map<String, String> mapInfo = codeMap.get(key);
|
|
|
+ if (mapInfo != null && StringUtil.isNotBlank(mapInfo.get("info"))) {
|
|
|
+ codeToInfoMap.put(key, mapInfo.get("info"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<QcResultAlgVO> qcResultAlgVOList = new ArrayList<>();
|
|
|
+ if (ListUtil.isNotEmpty(codeList)) {
|
|
|
+ qcResultAlgQueryVO.setCodeList(codeList);
|
|
|
+ qcResultAlgQueryVO.setHospitalId(hospitalId);
|
|
|
+ qcResultAlgVOList = qcCasesEntryFacade.getQcResultAlgVO(qcResultAlgQueryVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 评分
|
|
|
+ AlgorithmVO algorithmVO = new AlgorithmVO();
|
|
|
+ algorithmVO.setType(0);
|
|
|
+ algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
|
|
|
+ AlgorithmDTO algorithmDTO = algorithmFacade.getAlgorithmRes(algorithmVO);
|
|
|
+
|
|
|
+ //保存
|
|
|
+ // Map<String, Object> pageMap = outputInfo.getPageData();
|
|
|
+ // String pageData = JSON.toJSONString(pageMap);
|
|
|
+ // 获取菜单信息
|
|
|
+ // List<QcModeDTO> qcModeDTOList = qcModeFacade.getMenu(pageMap);
|
|
|
+ // String menuData = JSON.toJSONString(qcModeDTOList);
|
|
|
+
|
|
|
+ // 运行质控不保存评分结果信息
|
|
|
+ // Date date = qcresultInfoFacade.saveQcResult(algorithmDTO, algorithmVO, analyzeVO, pageData, menuData, analyzeVO.getIsTask());
|
|
|
+
|
|
|
+ // 返回缺陷提示信息
|
|
|
+ Map<String, List<MsgDTO>> msgMap = new LinkedHashMap<>();
|
|
|
+ String selectMode = "";
|
|
|
+ if (ListUtil.isNotEmpty(codeList)) {
|
|
|
+ AnalyzeCodeVO analyzeCodeVO = new AnalyzeCodeVO();
|
|
|
+ analyzeCodeVO.setCodeList(codeList);
|
|
|
+ analyzeCodeVO.setHospitalId(hospitalId);
|
|
|
+ Map<String, QcModelHospital> qcModelHospitalMap = qcModelHospitalFacade.getHospitalModel();
|
|
|
+ if (qcModelHospitalMap.containsKey(hospitalId + "##" + analyzeRunVO.getHosModelname())) {
|
|
|
+ QcModelHospital qcModelHospital = qcModelHospitalMap.get(hospitalId + "##" + analyzeRunVO.getHosModelname());
|
|
|
+ if (qcModelHospital != null) {
|
|
|
+ selectMode = qcModelHospital.getStandModelName();
|
|
|
+ // 1:筛选相应的模块内容,其他值:获取全部
|
|
|
+ if (1 == analyzeRunVO.getFlag()) {
|
|
|
+ analyzeCodeVO.setModeId(qcModelHospital.getStandModelId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取缺陷条目信息
|
|
|
+ List<MsgDTO> msgDTOList = getMsgByEntryCode(analyzeCodeVO);
|
|
|
+ // 设置info信息
|
|
|
+ if (codeToInfoMap != null && !codeToInfoMap.isEmpty()) {
|
|
|
+ for (MsgDTO msgDTO : msgDTOList) {
|
|
|
+ String info = codeToInfoMap.get(msgDTO.getCode());
|
|
|
+ if (StringUtil.isNotBlank(info)) {
|
|
|
+ msgDTO.setInfo(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ msgMap = EntityUtil.makeEntityListMap(msgDTOList, "modelName");
|
|
|
+ }
|
|
|
+
|
|
|
+ //返回参数组装
|
|
|
+ AnalyzeRunDTO analyzeRunDTO = new AnalyzeRunDTO();
|
|
|
+ analyzeRunDTO.setScoreRes(algorithmDTO.getScore());
|
|
|
+ analyzeRunDTO.setLevel(algorithmDTO.getLevel());
|
|
|
+ analyzeRunDTO.setMsgMap(msgMap);
|
|
|
+ analyzeRunDTO.setSelectMode(selectMode);
|
|
|
+ return analyzeRunDTO;
|
|
|
+ }
|
|
|
+
|
|
|
}
|