|
@@ -0,0 +1,286 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.diagbot.dto.IndicationDTO;
|
|
|
+import com.diagbot.dto.PushDTO;
|
|
|
+import com.diagbot.dto.PushPlanDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.entity.SysUser;
|
|
|
+import com.diagbot.entity.TranDatadockingLog;
|
|
|
+import com.diagbot.entity.TranHospitalRelation;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.StatusEnum;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.CdssLogUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.vo.*;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+/*
|
|
|
+ * @Description:对外对接业务处理类
|
|
|
+ * @Author:liuqq
|
|
|
+ * @time: 2020/11/04 14:51
|
|
|
+ **/
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class DataPageDockFacade {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MrFacade mrFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PushFacade pushFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DataDockingLogFacade dataDockingLogFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TranHospitalRelationFacade tranHospitalRelationFacade;
|
|
|
+
|
|
|
+ @Value("${data-page.url}")
|
|
|
+ private String dataPageUrl;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private KlConceptStaticFacade KlConceptStaticFacade;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description:静态知识开单合理性
|
|
|
+ * @Author:liuqq
|
|
|
+ * @time: ${DATE} ${TIME}
|
|
|
+ **/
|
|
|
+ public RespDTO<String> getStaticKnowledge(HisStaticKnowledgeVO hisStaticKnowledgeVO){
|
|
|
+ String url="";
|
|
|
+ //基层子医院业务逻辑
|
|
|
+ if(StringUtil.isNotEmpty(hisStaticKnowledgeVO.getHospitalCode()) && StringUtil.isNotEmpty(hisStaticKnowledgeVO.getHospitalName())){
|
|
|
+ //查找基层医院
|
|
|
+ Long hospitalId=getHospitalRelation(hisStaticKnowledgeVO.getHospitalCode(),hisStaticKnowledgeVO.getHospitalName());
|
|
|
+ if(hospitalId!=null){
|
|
|
+ hisStaticKnowledgeVO.setHospitalId(hospitalId);
|
|
|
+ }else{
|
|
|
+ return RespDTO.onError("子医院信息异常");
|
|
|
+ }
|
|
|
+ }else if(hisStaticKnowledgeVO.getHospitalId()==null){
|
|
|
+ return RespDTO.onError("请输入医院id");
|
|
|
+ }
|
|
|
+ //初始日志记录信息
|
|
|
+ hisStaticKnowledgeVO.setSubHospitalCode(hisStaticKnowledgeVO.getHospitalCode());
|
|
|
+ hisStaticKnowledgeVO.setSubHospitalName(hisStaticKnowledgeVO.getHospitalName());
|
|
|
+ //hisStaticKnowledgeVO.setSceneName();
|
|
|
+ //判断是否有静态知识
|
|
|
+ StaticKnowledgeHISVO staticKnowledgeHISVO=new StaticKnowledgeHISVO();
|
|
|
+ BeanUtils.copyProperties(hisStaticKnowledgeVO,staticKnowledgeHISVO);
|
|
|
+ Boolean flag=KlConceptStaticFacade.isExistForHIS(staticKnowledgeHISVO);
|
|
|
+ //如果有返回静态知识url地址
|
|
|
+ if(flag){
|
|
|
+ url=dataPageUrl+"/informationOut.html?hospitalId="+hisStaticKnowledgeVO.getHospitalId()
|
|
|
+ +"&type="+hisStaticKnowledgeVO.getType()
|
|
|
+ +"&hisName="+hisStaticKnowledgeVO.getHisName();
|
|
|
+ if(StringUtil.isNotEmpty(hisStaticKnowledgeVO.getHisDetailName())){
|
|
|
+ url+="&hisDetailName="+hisStaticKnowledgeVO.getHisDetailName();
|
|
|
+ }
|
|
|
+ return RespDTO.onSuc(url);
|
|
|
+ }else{
|
|
|
+ return RespDTO.onError("无静态知识");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description:页面推送模式
|
|
|
+ * @Author:liuqq
|
|
|
+ * @time: ${DATE} ${TIME}
|
|
|
+ **/
|
|
|
+ public RespDTO<String> getDataService(DataPageDockVO dataPageDockVO) {
|
|
|
+ if(StringUtil.isNotEmpty(dataPageDockVO.getHospitalCode()) && StringUtil.isNotEmpty(dataPageDockVO.getHospitalName())){
|
|
|
+ //基层子医院业务逻辑
|
|
|
+ Long hospitalId=getHospitalRelation(dataPageDockVO.getHospitalCode(),dataPageDockVO.getHospitalName());
|
|
|
+ if(hospitalId!=null){
|
|
|
+ dataPageDockVO.setHospitalId(hospitalId);
|
|
|
+ }else{
|
|
|
+ return RespDTO.onError("子医院信息异常");
|
|
|
+ }
|
|
|
+ }if(dataPageDockVO.getHospitalId()==null){
|
|
|
+ return RespDTO.onError("请输入医院id");
|
|
|
+ }else if("".equals(dataPageDockVO.getShowType())){
|
|
|
+ return RespDTO.onError("请输入展示类型,横版:ver,或竖版hor");
|
|
|
+ }else if("".equals(dataPageDockVO.getPlanCode())){
|
|
|
+ return RespDTO.onError("请输入方案编码");
|
|
|
+ }
|
|
|
+ //初始日志记录信息
|
|
|
+ dataPageDockVO.setSubHospitalCode(dataPageDockVO.getHospitalCode());
|
|
|
+ dataPageDockVO.setSubHospitalName(dataPageDockVO.getHospitalName());
|
|
|
+ dataPageDockVO.setSceneName(dataPageDockVO.getPlanCode());
|
|
|
+
|
|
|
+ String url="";
|
|
|
+ String pushMrId="";
|
|
|
+ PushJoinVO pushJoinVO = new PushJoinVO();
|
|
|
+ BeanUtil.copyProperties(dataPageDockVO, pushJoinVO);
|
|
|
+ // 将基本参数保存到redis
|
|
|
+ String mrId = mrFacade.createMr(pushJoinVO);
|
|
|
+ //开单合理性推理时,验证下是否有推送,无推送时,不给url,code为“-1”
|
|
|
+ if(dataPageDockVO.getPlanCode().equals("order_rational") || dataPageDockVO.getPlanCode().equals("reference_pacs") || dataPageDockVO.getPlanCode().equals("reference_lis")){
|
|
|
+ IndicationPushVO indicationPushVO=new IndicationPushVO();
|
|
|
+ //初始化开单合理性入参
|
|
|
+ BeanUtil.copyProperties(dataPageDockVO,indicationPushVO);
|
|
|
+ //ruleType(1:危急值提醒,2:开单合理项,3:高危药品、手术,4:其他提醒)
|
|
|
+ indicationPushVO.setRuleType("2,3,4");
|
|
|
+ //日志中增加入参,将开单合理性参数进行拼接记录
|
|
|
+ //CdssLogUtil.addBizReq(indicationPushVO);
|
|
|
+ //调用开单合理性接口
|
|
|
+ IndicationDTO indicationDTO = pushFacade.indicationPush(indicationPushVO);
|
|
|
+ if (indicationDTO != null) {
|
|
|
+ if (ListUtil.isNotEmpty(indicationDTO.getBillMsgList()) || ListUtil.isNotEmpty(indicationDTO.getHighRiskList())
|
|
|
+ || ListUtil.isNotEmpty(indicationDTO.getCriticalValList()) || ListUtil.isNotEmpty(indicationDTO.getOtherList()))
|
|
|
+ {
|
|
|
+ pushMrId= mrFacade.createIndicationMr(indicationDTO);
|
|
|
+ }else{
|
|
|
+ return RespDTO.onError("无开单合理性提醒!");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return RespDTO.onError("无开单合理性提醒!");
|
|
|
+ }
|
|
|
+ //将开单合理性结果进行拼接记录
|
|
|
+ //CdssLogUtil.addBizResp(indicationPushVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ if("hor".equals(dataPageDockVO.getShowType())){
|
|
|
+ url=dataPageUrl+"/cdssHorizontal.html?pushMrId="+pushMrId+"&mrId="+mrId+"&hospitalId="+dataPageDockVO.getHospitalId()+"&planCode="+dataPageDockVO.getPlanCode();
|
|
|
+ }else{
|
|
|
+ url=dataPageUrl+"/cdss.html?pushMrId="+pushMrId+"&mrId="+mrId+"&hospitalId="+dataPageDockVO.getHospitalId()+"&planCode="+dataPageDockVO.getPlanCode();
|
|
|
+ }
|
|
|
+ return RespDTO.onSuc(url);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description:病历推理
|
|
|
+ * @Author:liuqq
|
|
|
+ * @time: ${DATE} ${TIME}
|
|
|
+ **/
|
|
|
+ public RespDTO getEnginePush(DataEngineVO dataEngineVO) {
|
|
|
+ //基层子医院业务逻辑
|
|
|
+ if(StringUtil.isNotEmpty(dataEngineVO.getHospitalCode()) && StringUtil.isNotEmpty(dataEngineVO.getHospitalName())){
|
|
|
+ //查找基层医院
|
|
|
+ Long hospitalId=getHospitalRelation(dataEngineVO.getHospitalCode(),dataEngineVO.getHospitalName());
|
|
|
+ if(hospitalId!=null){
|
|
|
+ dataEngineVO.setHospitalId(hospitalId);
|
|
|
+ }else{
|
|
|
+ return RespDTO.onError("子医院信息异常");
|
|
|
+ }
|
|
|
+ }else if(dataEngineVO.getHospitalId()==null){
|
|
|
+ return RespDTO.onError("请输入医院id");
|
|
|
+ }else if("".equals(dataEngineVO.getPlanCode())){
|
|
|
+ return RespDTO.onError("请输入方案编码");
|
|
|
+ }
|
|
|
+ //初始日志记录信息
|
|
|
+ dataEngineVO.setSubHospitalCode(dataEngineVO.getHospitalCode());
|
|
|
+ dataEngineVO.setSubHospitalName(dataEngineVO.getHospitalName());
|
|
|
+ dataEngineVO.setSceneName(dataEngineVO.getPlanCode());
|
|
|
+ //dataEngineVO.setFeatureType("1,4,5,6,7,8,9,10");//推理类型
|
|
|
+
|
|
|
+ PushVO pushVO = new PushVO();
|
|
|
+ BeanUtil.copyProperties(dataEngineVO, pushVO);
|
|
|
+ //增加处理后的入参
|
|
|
+ CdssLogUtil.addBizReq(pushVO);
|
|
|
+ PushDTO pushDTO=pushFacade.push(pushVO);
|
|
|
+ pushDTO.setDebug(null);
|
|
|
+ return RespDTO.onSuc(pushDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 开单合理性及检查、检查报告检阅
|
|
|
+ * @Author:liuqq
|
|
|
+ * @time: ${DATE} ${TIME}
|
|
|
+ **/
|
|
|
+ public RespDTO getEngineIndicationPush(DataEngineVO dataEngineVO) {
|
|
|
+ //基层子医院业务逻辑
|
|
|
+ if(StringUtil.isNotEmpty(dataEngineVO.getHospitalCode()) && StringUtil.isNotEmpty(dataEngineVO.getHospitalName())){
|
|
|
+ //查找基层医院
|
|
|
+ Long hospitalId=getHospitalRelation(dataEngineVO.getHospitalCode(),dataEngineVO.getHospitalName());
|
|
|
+ if(hospitalId!=null){
|
|
|
+ dataEngineVO.setHospitalId(hospitalId);
|
|
|
+ }else{
|
|
|
+ return RespDTO.onError("子医院信息异常");
|
|
|
+ }
|
|
|
+ }else if(dataEngineVO.getHospitalId()==null){
|
|
|
+ return RespDTO.onError("请输入医院id");
|
|
|
+ }else if("".equals(dataEngineVO.getPlanCode())){
|
|
|
+ return RespDTO.onError("请输入方案编码");
|
|
|
+ }
|
|
|
+ //初始日志记录信息
|
|
|
+ dataEngineVO.setSubHospitalCode(dataEngineVO.getHospitalCode());
|
|
|
+ dataEngineVO.setSubHospitalName(dataEngineVO.getHospitalName());
|
|
|
+ dataEngineVO.setSceneName(dataEngineVO.getPlanCode());
|
|
|
+ //dataEngineVO.setFeatureType("1,4,5,6,7,8,9,10");//推理类型
|
|
|
+ //dataEngineVO.setRuleType("2,3,4");//推理类型(1:危急值提醒,2:开单合理项,3:高危药品、手术,4:其他提醒)
|
|
|
+
|
|
|
+ IndicationPushVO indicationPushVO=new IndicationPushVO();
|
|
|
+ BeanUtil.copyProperties(dataEngineVO, indicationPushVO);
|
|
|
+
|
|
|
+ //增加处理后的入参
|
|
|
+ CdssLogUtil.addBizReq(indicationPushVO);
|
|
|
+ IndicationDTO indicationDTO=pushFacade.indicationPush(indicationPushVO);
|
|
|
+ indicationDTO.setDebug(null);
|
|
|
+
|
|
|
+ if (indicationDTO != null) {
|
|
|
+ if (ListUtil.isNotEmpty(indicationDTO.getHighRiskList())
|
|
|
+ || ListUtil.isNotEmpty(indicationDTO.getCriticalValList()) || ListUtil.isNotEmpty(indicationDTO.getOtherList()))
|
|
|
+ {
|
|
|
+ return RespDTO.onSuc(indicationDTO);
|
|
|
+ }else{
|
|
|
+ return RespDTO.onError("无开单合理性提醒!");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return RespDTO.onError("无开单合理性提醒!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public PushPlanDTO getOperationPlanPush(DataEngineVO dataEngineVO){
|
|
|
+ PushPlanVO pushPlanVO=new PushPlanVO();
|
|
|
+ BeanUtil.copyProperties(dataEngineVO, pushPlanVO);
|
|
|
+
|
|
|
+ PushPlanDTO pushPlanDTO=pushFacade.pushPlan(pushPlanVO);
|
|
|
+ pushPlanDTO.setDebug(null);
|
|
|
+ try{
|
|
|
+ TranDatadockingLog tranDatadockingLog=new TranDatadockingLog();
|
|
|
+ tranDatadockingLog.setHospitalId(dataEngineVO.getHospitalId());
|
|
|
+ tranDatadockingLog.setParamIn(JSON.toJSONString(dataEngineVO));
|
|
|
+ tranDatadockingLog.setParamOut(JSON.toJSONString(pushPlanDTO));
|
|
|
+ tranDatadockingLog.setRemark("数据引擎模式,"+dataEngineVO.getPlanCode());
|
|
|
+
|
|
|
+ tranDatadockingLog.setTransTime(new Date());
|
|
|
+
|
|
|
+ dataDockingLogFacade.save(tranDatadockingLog);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("数据引擎模式,增加日志异常",e.getMessage());
|
|
|
+ }
|
|
|
+ return pushPlanDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Long getHospitalRelation(String hospitalCode,String hospitalName){
|
|
|
+ Long hospitalId=null;
|
|
|
+ try{
|
|
|
+ TranHospitalRelation tranHospitalRelation=new TranHospitalRelation();
|
|
|
+ QueryWrapper<TranHospitalRelation> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("code", hospitalCode)
|
|
|
+ .eq("name", hospitalName)
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ tranHospitalRelation=tranHospitalRelationFacade.getOne(queryWrapper);
|
|
|
+ if(tranHospitalRelation!=null){
|
|
|
+ hospitalId=tranHospitalRelation.getHospitalId();
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("子医院信息获取异常======",e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return hospitalId;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|