|
@@ -2,38 +2,25 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
-import com.diagbot.dto.AlgorithmDTO;
|
|
|
|
-import com.diagbot.dto.AnalyzeDTO;
|
|
|
|
-import com.diagbot.dto.QcResultDTO;
|
|
|
|
-import com.diagbot.entity.BehospitalInfo;
|
|
|
|
-import com.diagbot.entity.MedCheckInfo;
|
|
|
|
-import com.diagbot.entity.MedQcresultCases;
|
|
|
|
-import com.diagbot.entity.QcresultDetail;
|
|
|
|
-import com.diagbot.entity.QcresultInfo;
|
|
|
|
|
|
+import com.diagbot.dto.*;
|
|
|
|
+import com.diagbot.entity.*;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
|
+import com.diagbot.enums.ModeIdEnum;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.service.impl.MedQcresultCasesServiceImpl;
|
|
import com.diagbot.service.impl.MedQcresultCasesServiceImpl;
|
|
|
|
+import com.diagbot.service.impl.QcRuleWarnServiceImpl;
|
|
import com.diagbot.service.impl.QcresultDetailServiceImpl;
|
|
import com.diagbot.service.impl.QcresultDetailServiceImpl;
|
|
import com.diagbot.service.impl.QcresultInfoServiceImpl;
|
|
import com.diagbot.service.impl.QcresultInfoServiceImpl;
|
|
-import com.diagbot.util.BeanUtil;
|
|
|
|
-import com.diagbot.util.DateUtil;
|
|
|
|
-import com.diagbot.util.ListUtil;
|
|
|
|
-import com.diagbot.util.StringUtil;
|
|
|
|
-import com.diagbot.util.SysUserUtils;
|
|
|
|
-import com.diagbot.vo.AlgorithmVO;
|
|
|
|
-import com.diagbot.vo.AnalyzeVO;
|
|
|
|
-import com.diagbot.vo.GetDetailVO;
|
|
|
|
-import com.diagbot.vo.MedQcresultCasesVO;
|
|
|
|
-import com.diagbot.vo.QcResultAlgVO;
|
|
|
|
-import com.diagbot.vo.QcresultVO;
|
|
|
|
|
|
+import com.diagbot.util.*;
|
|
|
|
+import com.diagbot.vo.*;
|
|
|
|
+import net.sf.jsqlparser.expression.LongValue;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description:
|
|
* @Description:
|
|
@@ -46,15 +33,175 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
|
|
@Qualifier("qcresultDetailServiceImpl")
|
|
@Qualifier("qcresultDetailServiceImpl")
|
|
private QcresultDetailServiceImpl qcresultDetailServiceImpl;
|
|
private QcresultDetailServiceImpl qcresultDetailServiceImpl;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ @Qualifier("qcRuleWarnServiceImpl")
|
|
|
|
+ private QcRuleWarnServiceImpl qcRuleWarnServiceImpl;
|
|
|
|
+ @Autowired
|
|
private AlgorithmFacade algorithmFacade;
|
|
private AlgorithmFacade algorithmFacade;
|
|
@Autowired
|
|
@Autowired
|
|
private BehospitalInfoFacade behospitalInfoFacade;
|
|
private BehospitalInfoFacade behospitalInfoFacade;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private ReadProperties readProperties;
|
|
|
|
+ @Autowired
|
|
|
|
+ private QcCasesEntryFacade qcCasesEntryFacade;
|
|
|
|
+ @Autowired
|
|
private MedCheckInfoFacade medCheckInfoFacade;
|
|
private MedCheckInfoFacade medCheckInfoFacade;
|
|
@Autowired
|
|
@Autowired
|
|
@Qualifier("medQcresultCasesServiceImpl")
|
|
@Qualifier("medQcresultCasesServiceImpl")
|
|
private MedQcresultCasesServiceImpl medQcresultCasesService;
|
|
private MedQcresultCasesServiceImpl medQcresultCasesService;
|
|
|
|
|
|
|
|
+ private TZDBConn tzDBConn = new TZDBConn();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 发送规则信息到医生工作站
|
|
|
|
+ *
|
|
|
|
+ * @param qcRuleWarnVO
|
|
|
|
+ * @return Boolean
|
|
|
|
+ */
|
|
|
|
+ public Boolean sendRuleWarn(QcRuleWarnVO qcRuleWarnVO) {
|
|
|
|
+ //入参验证
|
|
|
|
+ if (StringUtil.isBlank(qcRuleWarnVO.getBehospitalCode())) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "病历id不能为空!");
|
|
|
|
+ }
|
|
|
|
+ if (null == qcRuleWarnVO.getMsg()) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "操作条目不能为空!");
|
|
|
|
+ }
|
|
|
|
+ Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
|
|
|
|
+ Date now = DateUtil.now();
|
|
|
|
+ BehospitalInfo behospitalInfo
|
|
|
|
+ = behospitalInfoFacade.getOne(
|
|
|
|
+ new QueryWrapper<BehospitalInfo>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
|
+ .eq("behospital_code", qcRuleWarnVO.getBehospitalCode()));
|
|
|
|
+ if (null == behospitalInfo) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该医院下该病历号不存在!");
|
|
|
|
+ }
|
|
|
|
+ String doctorId = behospitalInfo.getDoctorId();
|
|
|
|
+ if (StringUtil.isBlank(doctorId) || doctorId.equals("-")) {
|
|
|
|
+ doctorId = "0";
|
|
|
|
+ }
|
|
|
|
+ int userId = Integer.parseInt(doctorId);
|
|
|
|
+ QcresultDetail qcresultDetail
|
|
|
|
+ = qcresultDetailServiceImpl.getOne(
|
|
|
|
+ new QueryWrapper<QcresultDetail>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("hospital_id", hospitalId)
|
|
|
|
+ .eq("behospital_code", qcRuleWarnVO.getBehospitalCode())
|
|
|
|
+ .eq("msg", qcRuleWarnVO.getMsg()));
|
|
|
|
+ if (null == qcresultDetail) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "未找到该规则!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ QcCasesEntry qcCasesEntry = qcCasesEntryFacade.getOne(new QueryWrapper<QcCasesEntry>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("id", qcresultDetail.getCasesEntryId()));
|
|
|
|
+
|
|
|
|
+ //规则提醒页面模式
|
|
|
|
+ String url = readProperties.getRuleWarnQcUrl() + "?behospitalCode=" + qcRuleWarnVO.getBehospitalCode();
|
|
|
|
+ QcRuleWarn qcRuleWarn = new QcRuleWarn();
|
|
|
|
+ qcRuleWarn.setHospitalId(qcresultDetail.getHospitalId());
|
|
|
|
+ qcRuleWarn.setQcresultInfoId(qcresultDetail.getQcresultInfoId());
|
|
|
|
+ qcRuleWarn.setBehospitalCode(qcresultDetail.getBehospitalCode());
|
|
|
|
+ qcRuleWarn.setFileCode(behospitalInfo.getFileCode());
|
|
|
|
+ qcRuleWarn.setName(behospitalInfo.getName());
|
|
|
|
+ qcRuleWarn.setUserId(userId);
|
|
|
|
+ qcRuleWarn.setWardName(behospitalInfo.getWardName());//病区
|
|
|
|
+ qcRuleWarn.setDeptName(behospitalInfo.getBehDeptName());//科室
|
|
|
|
+ qcRuleWarn.setDoctorName(behospitalInfo.getDoctorName());//主治医生
|
|
|
|
+ qcRuleWarn.setBehospitalDate(behospitalInfo.getBehospitalDate());//入院时间
|
|
|
|
+ qcRuleWarn.setLeaveHospitalDate(behospitalInfo.getLeaveHospitalDate());//出院时间
|
|
|
|
+ qcRuleWarn.setCasesId(qcresultDetail.getCasesId());
|
|
|
|
+ qcRuleWarn.setModelName(ModeIdEnum.getName((qcCasesEntry.getModeId()).intValue()));
|
|
|
|
+ qcRuleWarn.setCasesScore(qcresultDetail.getCasesScore());
|
|
|
|
+ qcRuleWarn.setCasesEntryId(qcresultDetail.getCasesEntryId());
|
|
|
|
+ qcRuleWarn.setScore(qcresultDetail.getScore());
|
|
|
|
+ qcRuleWarn.setMsg(qcresultDetail.getMsg());
|
|
|
|
+ qcRuleWarn.setInfo(qcresultDetail.getInfo());
|
|
|
|
+ qcRuleWarn.setUrl(url);
|
|
|
|
+ qcRuleWarn.setIsReject(qcresultDetail.getIsReject());
|
|
|
|
+ qcRuleWarn.setIsDeleted(IsDeleteEnum.N.getKey());
|
|
|
|
+ qcRuleWarn.setGmtCreate(now);
|
|
|
|
+ qcRuleWarn.setCreator(userId + "");
|
|
|
|
+ boolean flag = qcRuleWarnServiceImpl.save(qcRuleWarn);
|
|
|
|
+
|
|
|
|
+ if (flag) {
|
|
|
|
+// qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
|
|
|
|
+// .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+// .eq("hospital_id", hospitalId)
|
|
|
|
+// .eq("behospital_code", qcRuleWarnVO.getBehospitalCode())
|
|
|
|
+// .eq("cases_entry_id", qcresultDetail.getCasesEntryId())
|
|
|
|
+// .set("grade_type", 2)
|
|
|
|
+// .set("opt_type", 2)
|
|
|
|
+// .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
|
+// .set("modifier", userId.toString())
|
|
|
|
+// .set("gmt_modified", now));
|
|
|
|
+ String sql = "INSERT INTO JKCDSS.JKCDSS_RULE_WARN (ID, USER_ID, BEHOSPITAL_CODE, STATE, URL, GMT_CREATE, GMT_MODIFIED, CREATOR, MODIFIER, REMARK) " +
|
|
|
|
+ "VALUES (" + new Date().getTime() + ", " + userId + ", '" + qcRuleWarnVO.getBehospitalCode() + "', 0, '" + url + "', SYSDATE, SYSDATE, 'LT', 'LT', NULL)";
|
|
|
|
+ System.out.println("插入sql语句为--------------------------:" + sql);
|
|
|
|
+ tzDBConn.setRule(sql);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return flag;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 医生工作站查看规则条目
|
|
|
|
+ *
|
|
|
|
+ * @param behospitalCodeVO
|
|
|
|
+ * @return QcRuleWarnDTO
|
|
|
|
+ */
|
|
|
|
+ public QcRuleWarnDTO checkRule(RecordContentVO behospitalCodeVO) {
|
|
|
|
+ QcRuleWarnDTO qcRuleWarnDTO = new QcRuleWarnDTO();
|
|
|
|
+ // 获取规则条目信息
|
|
|
|
+ List<QcRuleWarn> qcRuleWarns
|
|
|
|
+ = qcRuleWarnServiceImpl.list(
|
|
|
|
+ new QueryWrapper<QcRuleWarn>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("hospital_id", "14")
|
|
|
|
+ .eq("behospital_code", behospitalCodeVO.getBehospitalCode()));
|
|
|
|
+ if (qcRuleWarns.size() == 0) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "病历不存在错误信息!");
|
|
|
|
+ }
|
|
|
|
+ qcRuleWarnDTO.setFileCode(qcRuleWarns.get(0).getFileCode());
|
|
|
|
+ qcRuleWarnDTO.setName(qcRuleWarns.get(0).getName());
|
|
|
|
+ qcRuleWarnDTO.setWardName(qcRuleWarns.get(0).getWardName());//病区
|
|
|
|
+ qcRuleWarnDTO.setDeptName(qcRuleWarns.get(0).getDeptName());//科室
|
|
|
|
+ qcRuleWarnDTO.setDoctorName(qcRuleWarns.get(0).getDoctorName());//主治医生
|
|
|
|
+ qcRuleWarnDTO.setSendDate(qcRuleWarns.get(0).getGmtCreate());//发送时间
|
|
|
|
+ qcRuleWarnDTO.setBehospitalDate(qcRuleWarns.get(0).getBehospitalDate());//入院时间
|
|
|
|
+ qcRuleWarnDTO.setLeaveHospitalDate(qcRuleWarns.get(0).getLeaveHospitalDate());//出院时间
|
|
|
|
+ BigDecimal dBigDecimal = new BigDecimal(0);//扣分
|
|
|
|
+ BigDecimal resPr = new BigDecimal(100);
|
|
|
|
+ String level = null;
|
|
|
|
+ List<RuleMsgDTO> msgDTOList = new ArrayList<>();
|
|
|
|
+ for (QcRuleWarn qcRuleWarn : qcRuleWarns) {
|
|
|
|
+ dBigDecimal = dBigDecimal.add(qcRuleWarn.getScore());
|
|
|
|
+ RuleMsgDTO msgDTO = new RuleMsgDTO();
|
|
|
|
+ msgDTO.setModelName(qcRuleWarn.getModelName());
|
|
|
|
+ msgDTO.setMsg(qcRuleWarn.getMsg());
|
|
|
|
+ msgDTO.setInfo(qcRuleWarn.getInfo());
|
|
|
|
+ msgDTO.setScore(qcRuleWarn.getScore());
|
|
|
|
+ msgDTOList.add(msgDTO);
|
|
|
|
+ }
|
|
|
|
+ if (dBigDecimal.compareTo(new BigDecimal(10)) < 1) {
|
|
|
|
+ level = "甲";
|
|
|
|
+ } else if (dBigDecimal.compareTo(new BigDecimal(20)) < 1) {
|
|
|
|
+ level = "乙";
|
|
|
|
+ } else {
|
|
|
|
+ level = "丙";
|
|
|
|
+ }
|
|
|
|
+ qcRuleWarnDTO.setScoreRes(resPr.subtract(dBigDecimal));// 得分
|
|
|
|
+ qcRuleWarnDTO.setLevel(level);// 等级
|
|
|
|
+ qcRuleWarnDTO.setNum(Long.valueOf(qcRuleWarns.size()));// 缺陷总数
|
|
|
|
+ qcRuleWarnDTO.setNumScore(dBigDecimal);// 缺陷总扣分
|
|
|
|
+ qcRuleWarnDTO.setMsgDTOList(msgDTOList);
|
|
|
|
+
|
|
|
|
+ return qcRuleWarnDTO;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 修改评分结果信息
|
|
* 修改评分结果信息
|
|
*
|
|
*
|
|
@@ -426,3 +573,5 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|