|
@@ -7,6 +7,7 @@ import com.diagbot.client.AuthServiceClient;
|
|
import com.diagbot.client.QcServiceClient;
|
|
import com.diagbot.client.QcServiceClient;
|
|
import com.diagbot.dto.AlgorithmDTO;
|
|
import com.diagbot.dto.AlgorithmDTO;
|
|
import com.diagbot.dto.AnalyzeDTO;
|
|
import com.diagbot.dto.AnalyzeDTO;
|
|
|
|
+import com.diagbot.dto.AnalyzeRunDTO;
|
|
import com.diagbot.dto.BehosDTO;
|
|
import com.diagbot.dto.BehosDTO;
|
|
import com.diagbot.dto.BehospitalInfoDTO;
|
|
import com.diagbot.dto.BehospitalInfoDTO;
|
|
import com.diagbot.dto.MsgApiDTO;
|
|
import com.diagbot.dto.MsgApiDTO;
|
|
@@ -38,6 +39,8 @@ import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.SysUserUtils;
|
|
import com.diagbot.util.SysUserUtils;
|
|
import com.diagbot.vo.AlgorithmVO;
|
|
import com.diagbot.vo.AlgorithmVO;
|
|
import com.diagbot.vo.AnalyzeApiVO;
|
|
import com.diagbot.vo.AnalyzeApiVO;
|
|
|
|
+import com.diagbot.vo.AnalyzeCodeVO;
|
|
|
|
+import com.diagbot.vo.AnalyzeRunVO;
|
|
import com.diagbot.vo.AnalyzeVO;
|
|
import com.diagbot.vo.AnalyzeVO;
|
|
import com.diagbot.vo.BehospitalPageVO;
|
|
import com.diagbot.vo.BehospitalPageVO;
|
|
import com.diagbot.vo.GetDetailVO;
|
|
import com.diagbot.vo.GetDetailVO;
|
|
@@ -100,6 +103,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
Boolean encryptFlag;
|
|
Boolean encryptFlag;
|
|
@Autowired
|
|
@Autowired
|
|
QcQuestionFacade qcQuestionFacade;
|
|
QcQuestionFacade qcQuestionFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ QcModelHospitalFacade qcModelHospitalFacade;
|
|
|
|
|
|
public IPage<BehospitalInfoDTO> pageFac(BehospitalPageVO behospitalPageVO) {
|
|
public IPage<BehospitalInfoDTO> pageFac(BehospitalPageVO behospitalPageVO) {
|
|
//入参验证
|
|
//入参验证
|
|
@@ -192,7 +197,12 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 评分-终末质控
|
|
|
|
+ *
|
|
|
|
+ * @param analyzeVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
public AnalyzeDTO analyze(AnalyzeVO analyzeVO) {
|
|
public AnalyzeDTO analyze(AnalyzeVO analyzeVO) {
|
|
Long hospitalId = analyzeVO.getHospitalId();
|
|
Long hospitalId = analyzeVO.getHospitalId();
|
|
if (!analyzeVO.getIsTask()) {
|
|
if (!analyzeVO.getIsTask()) {
|
|
@@ -203,7 +213,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
// 获取质控条目
|
|
// 获取质控条目
|
|
List<QcCasesEntryDTO> qcCasesEntryDTOList = qcCasesEntryFacade.getQcCasesEntry(analyzeVO);
|
|
List<QcCasesEntryDTO> qcCasesEntryDTOList = qcCasesEntryFacade.getQcCasesEntry(analyzeVO);
|
|
if(ListUtil.isEmpty(qcCasesEntryDTOList)){
|
|
if(ListUtil.isEmpty(qcCasesEntryDTOList)){
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历找不到质控条目!");
|
|
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历无关联的质控条目!");
|
|
}
|
|
}
|
|
|
|
|
|
// 获取病历所有数据
|
|
// 获取病历所有数据
|
|
@@ -297,6 +307,10 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
Arrays.asList("术后首次病程及谈话记录", "手术记录",
|
|
Arrays.asList("术后首次病程及谈话记录", "手术记录",
|
|
"术前讨论、术前小结", "手术知情同意书", "手术安全核查表"));
|
|
"术前讨论、术前小结", "手术知情同意书", "手术安全核查表"));
|
|
|
|
|
|
|
|
+ // 转科
|
|
|
|
+ addDataWithKey("转科", recMap, medrecVoList,
|
|
|
|
+ Arrays.asList("转入记录", "转出记录"));
|
|
|
|
+
|
|
// 医嘱
|
|
// 医嘱
|
|
if (ListUtil.isNotEmpty(doctorAdviceList)) {
|
|
if (ListUtil.isNotEmpty(doctorAdviceList)) {
|
|
addDataWithKeyConvert("医嘱信息", doctorAdviceList, medrecVoList,
|
|
addDataWithKeyConvert("医嘱信息", doctorAdviceList, medrecVoList,
|
|
@@ -330,9 +344,13 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
codeToInfoMap.put(key, mapInfo.get("info"));
|
|
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赋值
|
|
// 对info赋值
|
|
for(QcResultAlgVO bean : qcResultAlgVOList) {
|
|
for(QcResultAlgVO bean : qcResultAlgVOList) {
|
|
@@ -773,4 +791,201 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 评分-运行质控
|
|
|
|
+ *
|
|
|
|
+ * @param analyzeRunVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ 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.setHospitalId(String.valueOf(hospitalId));
|
|
|
|
+ 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("术后首次病程及谈话记录", "手术记录",
|
|
|
|
+ "术前讨论、术前小结", "手术知情同意书", "手术安全核查表"));
|
|
|
|
+
|
|
|
|
+ // 转科
|
|
|
|
+ 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());
|
|
|
|
+
|
|
|
|
+ // 返回缺陷提示信息
|
|
|
|
+ List<MsgDTO> msgDTOList = new ArrayList<>();
|
|
|
|
+ if (ListUtil.isNotEmpty(codeList)) {
|
|
|
|
+ AnalyzeCodeVO analyzeCodeVO = new AnalyzeCodeVO();
|
|
|
|
+ analyzeCodeVO.setCodeList(codeList);
|
|
|
|
+ analyzeCodeVO.setHospitalId(hospitalId);
|
|
|
|
+ analyzeCodeVO.setModeId(analyzeRunVO.getModeId());
|
|
|
|
+
|
|
|
|
+ // 获取缺陷条目信息
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //返回参数组装
|
|
|
|
+ AnalyzeRunDTO analyzeRunDTO = new AnalyzeRunDTO();
|
|
|
|
+ // analyzeRunDTO.setScoreRes(algorithmDTO.getScore());
|
|
|
|
+ // analyzeRunDTO.setLevel(algorithmDTO.getLevel());
|
|
|
|
+ analyzeRunDTO.setMsgDTOList(msgDTOList);
|
|
|
|
+ return analyzeRunDTO;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|