|  | @@ -3,6 +3,7 @@ package thyyxxk.webserver.service.medicalinsurance;
 | 
	
		
			
				|  |  |  import cn.hutool.core.bean.BeanUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.core.bean.copier.CopyOptions;
 | 
	
		
			
				|  |  |  import cn.hutool.core.collection.CollUtil;
 | 
	
		
			
				|  |  | +import cn.hutool.core.util.IdcardUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.core.util.NumberUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.core.util.RandomUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.core.util.ReflectUtil;
 | 
	
	
		
			
				|  | @@ -207,6 +208,33 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |          return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错的:【%s】 ", errMsg));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @description: 给责任护士医保码 和名称  补偿机制
 | 
	
		
			
				|  |  | +     * @author: lihong
 | 
	
		
			
				|  |  | +     * @date: 2023/3/22 15:22
 | 
	
		
			
				|  |  | +     * @param: patNo
 | 
	
		
			
				|  |  | +     * @param: times
 | 
	
		
			
				|  |  | +     * @return: java.lang.String[]
 | 
	
		
			
				|  |  | +     **/
 | 
	
		
			
				|  |  | +    private void setRespNurs(SetlinfoUpld setlinfoUpld,String patNo,Integer times){
 | 
	
		
			
				|  |  | +        List<String> respNursCodeList = dao.getRespNursCode(patNo, times);
 | 
	
		
			
				|  |  | +        if (CollUtil.isNotEmpty(respNursCodeList)) {
 | 
	
		
			
				|  |  | +            for (int i = 0; i < respNursCodeList.size(); i++) {
 | 
	
		
			
				|  |  | +                String ybCode = getYbCode(respNursCodeList.get(i));
 | 
	
		
			
				|  |  | +                if (i == (respNursCodeList.size() - 1) && StringUtil.notBlank(ybCode)) {
 | 
	
		
			
				|  |  | +                    setlinfoUpld.setRespNursCode(ybCode);
 | 
	
		
			
				|  |  | +                    setlinfoUpld.setRespNursName(redisLikeService.getEmployeeName(respNursCodeList.get(i)));
 | 
	
		
			
				|  |  | +                    return ;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (StringUtil.notBlank(ybCode) && ybCode.startsWith("N")) {
 | 
	
		
			
				|  |  | +                    setlinfoUpld.setRespNursCode(ybCode);
 | 
	
		
			
				|  |  | +                    setlinfoUpld.setRespNursName(redisLikeService.getEmployeeName(respNursCodeList.get(i)));
 | 
	
		
			
				|  |  | +                    return ;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public void dealDrgGroup(String patNo, Integer times,Integer ledgerSn, SetlinfoUpld setlinfo) {
 | 
	
		
			
				|  |  |          SiLog siLog = null;
 | 
	
	
		
			
				|  | @@ -372,6 +400,9 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |          SetlinfoUpld setlinfoUpld = dao.setlinfo1(patNo, times, ledgerSn);
 | 
	
		
			
				|  |  |          dealSetlinfoUpld(patNo, times, setlinfoUpld);
 | 
	
		
			
				|  |  |          EntityCopy.Copy(dao.setlinfo2(patNo, times), setlinfoUpld);
 | 
	
		
			
				|  |  | +        if(StringUtil.isBlank(setlinfoUpld.getRespNursCode())){
 | 
	
		
			
				|  |  | +            setRespNurs(setlinfoUpld,patNo,times);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          EntityCopy.Copy(dao.setlinfo3(String.format("inpatient_no ='%s'", patNo)), setlinfoUpld);
 | 
	
		
			
				|  |  |          EntityCopy.Copy(dao.setlinfo4(patNo, times), setlinfoUpld);
 | 
	
		
			
				|  |  |          EntityCopy.Copy(dao.setlinfo5(patNo, times, ledgerSn), setlinfoUpld);
 | 
	
	
		
			
				|  | @@ -494,8 +525,23 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              if (StringUtil.isBlank(setlinfoUpld.getEmpTel())) {
 | 
	
		
			
				|  |  |                  setlinfoUpld.setEmpTel(setlinfoUpld.getConerTel());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            if(StringUtil.isBlank(setlinfoUpld.getPoscode())){
 | 
	
		
			
				|  |  | +                setlinfoUpld.setPoscode("410000");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        //性别
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            setlinfoUpld.setGend(IdcardUtil.getGenderByIdCard(setlinfoUpld.getCertno()) == 1 ? "1" : "2");
 | 
	
		
			
				|  |  | +        }catch (Exception e){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //再31天再住院目的
 | 
	
		
			
				|  |  | +        if("-".equals(setlinfoUpld.getDaysRinpPup31())){
 | 
	
		
			
				|  |  | +            setlinfoUpld.setDaysRinpPup31("");
 | 
	
		
			
				|  |  | +            setlinfoUpld.setDaysRinpFlag31("1");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          // 呼吸机使用时长
 | 
	
		
			
				|  |  |          Integer ventUsedDura = dao.ventilatorUseTime(patNo, times);
 | 
	
		
			
				|  |  |          if (ventUsedDura != null) {
 | 
	
	
		
			
				|  | @@ -552,11 +598,11 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public void dealSetlinfoUpld(String patNo, Integer times, SetlinfoUpld setlinfoUpld) {
 | 
	
		
			
				|  |  |          // 患者基本信息 先判断签收表是否有数据
 | 
	
		
			
				|  |  | -        Integer existCaseFrontsheetMain = dao.existCaseFrontsheetMain(patNo, times);
 | 
	
		
			
				|  |  | -        if(existCaseFrontsheetMain ==null){
 | 
	
		
			
				|  |  | +        //Integer existCaseFrontsheetMain = dao.existCaseFrontsheetMain(patNo, times);
 | 
	
		
			
				|  |  | +        //if(existCaseFrontsheetMain ==null){
 | 
	
		
			
				|  |  |          //    这里使用病案首页数据
 | 
	
		
			
				|  |  |              covertCaseFrontsheetMain2SetlinfoUpld(setlinfoUpld,patNo,times);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        //}
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -583,7 +629,7 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              setlinfoUpld.setEmpName(caseFrontsheetMain.getUnitName());
 | 
	
		
			
				|  |  |              setlinfoUpld.setEmpAddr(caseFrontsheetMain.getUnitPlace());
 | 
	
		
			
				|  |  |              setlinfoUpld.setEmpTel(caseFrontsheetMain.getUnitPhone());
 | 
	
		
			
				|  |  | -            setlinfoUpld.setPoscode(caseFrontsheetMain.getAddrZipCode());
 | 
	
		
			
				|  |  | +            setlinfoUpld.setPoscode("310".equals(caseFrontsheetMain.getInsutype()) && StringUtil.isBlank(caseFrontsheetMain.getUnitZipCode()) ? "410000" : caseFrontsheetMain.getUnitZipCode());
 | 
	
		
			
				|  |  |              setlinfoUpld.setNaty(redisLikeService.getWjwNation(caseFrontsheetMain.getNation()));
 | 
	
		
			
				|  |  |              setlinfoUpld.setConerName(caseFrontsheetMain.getContactName());
 | 
	
		
			
				|  |  |              setlinfoUpld.setBrdy(DateUtil.formatDatetime(caseFrontsheetMain.getBirthDate(),"yyyy-MM-dd"));
 | 
	
	
		
			
				|  | @@ -1637,6 +1683,7 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          log.info("手术信息:{}", JSON.toJSONString(param.getBatjBa4()));
 | 
	
		
			
				|  |  | +        SetlinfoUpld setlinfoUpld = dao.setlinfo5(param.getInpatientNo(), param.getAdmissTimes(), param.getLedgerSn());
 | 
	
		
			
				|  |  |          for (BatjBa4 item : param.getBatjBa4()) {
 | 
	
		
			
				|  |  |              if (item.getSsxh() == null || item.getSsxh() <= 0) {
 | 
	
		
			
				|  |  |                  return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术排序不能为空,且最小值为 1。");
 | 
	
	
		
			
				|  | @@ -1646,6 +1693,10 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              if (!item.getNewData()) {
 | 
	
		
			
				|  |  |                  if (item.getSsrq() == null) {
 | 
	
		
			
				|  |  |                      return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,手术日期不能为空", item.getSsmc()));
 | 
	
		
			
				|  |  | +                }else {
 | 
	
		
			
				|  |  | +                    if(item.getSsrq() != null && !cn.hutool.core.date.DateUtil.isIn(item.getSsrq(),setlinfoUpld.getAdmTime(),setlinfoUpld.getDscgTime())){
 | 
	
		
			
				|  |  | +                        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,手术日期应在出入院时间范围内", item.getSsmc()));
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (StringUtil.isBlank(item.getSsys())) {
 | 
	
		
			
				|  |  |                      return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,手术医生不能为空", item.getSsmc()));
 | 
	
	
		
			
				|  | @@ -1688,6 +1739,22 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |                  if (ListUtil.notBlank(a)) {
 | 
	
		
			
				|  |  |                      return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,%s", item.getSsmc(), a));
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                if(item.getOpStartDate() != null && !cn.hutool.core.date.DateUtil.isIn(item.getOpStartDate(),setlinfoUpld.getAdmTime(),setlinfoUpld.getDscgTime())){
 | 
	
		
			
				|  |  | +                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,手术开始时间应在出入院时间范围内", item.getSsmc()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if(item.getOpEndDate() != null && !cn.hutool.core.date.DateUtil.isIn(item.getOpEndDate(),setlinfoUpld.getAdmTime(),setlinfoUpld.getDscgTime())){
 | 
	
		
			
				|  |  | +                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,手术结束时间应在出入院时间范围内", item.getSsmc()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if(item.getAnstStartDate() != null && !cn.hutool.core.date.DateUtil.isIn(item.getAnstStartDate(),setlinfoUpld.getAdmTime(),setlinfoUpld.getDscgTime())){
 | 
	
		
			
				|  |  | +                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,麻醉开始时间应在出入院时间范围内", item.getSsmc()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if(item.getAnstEndDate() != null && !cn.hutool.core.date.DateUtil.isIn(item.getAnstEndDate(),setlinfoUpld.getAdmTime(),setlinfoUpld.getDscgTime())){
 | 
	
		
			
				|  |  | +                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,麻醉结束时间应在出入院时间范围内", item.getSsmc()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                  PublicServer.surgeryTimeLimit(item.getSsmc(), item.getOpStartDate(), item.getOpEndDate(), item.getAnstStartDate(), item.getAnstEndDate());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -2273,7 +2340,8 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              drgQualityParam.put("oprt_info_list", new ArrayList<>(1));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          log.info("质控测算传参:{}", JSON.toJSONString(drgQualityParam));
 | 
	
		
			
				|  |  | -        JSONObject result =  drgWebServices.drgQuality(JSON.parseObject(JSON.toJSONString(drgQualityParam)));
 | 
	
		
			
				|  |  | +        JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(drgQualityParam));
 | 
	
		
			
				|  |  | +        JSONObject result =  drgWebServices.drgQuality(jsonObject);
 | 
	
		
			
				|  |  |          resultMap.put("result",result);
 | 
	
		
			
				|  |  |          resultMap.put("param",drgQualityParam);
 | 
	
		
			
				|  |  |          return resultMap;
 |