|  | @@ -201,8 +201,7 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |      public void dealDrgGroup(String patNo, Integer times,Integer ledgerSn, SetlinfoUpld setlinfo) {
 | 
	
		
			
				|  |  |          SiLog siLog = null;
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  | -            Integer flag = dao.setlModifyReqAuditFlag(patNo, times);
 | 
	
		
			
				|  |  | -            flag = flag == null ? 0 : flag;
 | 
	
		
			
				|  |  | +            Integer flag = getModifyFlag(patNo, times);
 | 
	
		
			
				|  |  |              List<YbZyDisDiag> ybZyDisDiags = dao.zhenDuanXinXi(patNo, times, flag == 1 ? "zy_dis_diag_yb_modify" : "zy_dis_diag_yb");
 | 
	
		
			
				|  |  |              List<BatjBa4> batjBa4s = dao.shouShuXinXi(patNo, times, flag == 1 ? "batj_ba4_modify" : "batj_ba4");
 | 
	
		
			
				|  |  |              ZyInactpatient param = new ZyInactpatient();
 | 
	
	
		
			
				|  | @@ -358,8 +357,7 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Integer flag = dao.setlModifyReqAuditFlag(patNo, times);
 | 
	
		
			
				|  |  | -        flag = flag == null ? 0 : flag;
 | 
	
		
			
				|  |  | +        Integer flag = getModifyFlag(patNo, times);
 | 
	
		
			
				|  |  |          // 患者基本信息
 | 
	
		
			
				|  |  |          SetlinfoUpld setlinfoUpld = dao.setlinfo1(patNo, times, ledgerSn);
 | 
	
		
			
				|  |  |          EntityCopy.Copy(dao.setlinfo2(patNo, times), setlinfoUpld);
 | 
	
	
		
			
				|  | @@ -541,6 +539,24 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |          return ResultVoUtil.success(upldCollection);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @NotNull
 | 
	
		
			
				|  |  | +    public Integer getModifyFlag(String patNo, Integer times) {
 | 
	
		
			
				|  |  | +        Integer flag = dao.setlModifyReqAuditFlag(patNo, times);
 | 
	
		
			
				|  |  | +        //有审核记录的就同步下数据
 | 
	
		
			
				|  |  | +        if (flag != null && flag != 1) {
 | 
	
		
			
				|  |  | +            //    这里判断 诊断和手术 修改表是否有数据  没有的话 就同步原表的数据
 | 
	
		
			
				|  |  | +            Integer existDiseDiag = dao.existDiseDiag(patNo, times);
 | 
	
		
			
				|  |  | +            if (existDiseDiag == null) {
 | 
	
		
			
				|  |  | +                dao.synchronousDisDiag(patNo, times);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            Integer exisOprt = dao.exisOprt(patNo, times);
 | 
	
		
			
				|  |  | +            if (exisOprt == null) {
 | 
	
		
			
				|  |  | +                dao.synchronousOprt(patNo, times);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        flag = flag == null ? 0 : 1;
 | 
	
		
			
				|  |  | +        return flag;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private String getDrgHaiPay(String insuplcAdmdvs,String defaultValue,Date setlTime){
 | 
	
	
		
			
				|  | @@ -634,8 +650,7 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      public ResultVo<UpldCollectionTemp> daYingShangChuanJieSuanDan(String patNo, Integer times, Integer ledgerSn) throws
 | 
	
		
			
				|  |  |              Exception {
 | 
	
		
			
				|  |  | -        Integer flag = dao.setlModifyReqAuditFlag(patNo, times);
 | 
	
		
			
				|  |  | -        flag = null == flag ? 0 : flag;
 | 
	
		
			
				|  |  | +        Integer flag = getModifyFlag(patNo,times);
 | 
	
		
			
				|  |  |          // 查询出来的信息
 | 
	
		
			
				|  |  |          ResultVo<UpldCollection> uploadInfo = getUploadInfo(patNo, times, ledgerSn);
 | 
	
		
			
				|  |  |          if (!uploadInfo.getCode().equals(ExceptionEnum.SUCCESS.getCode())) {
 | 
	
	
		
			
				|  | @@ -770,6 +785,48 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |          return ResultVoUtil.success();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @description:重新上传
 | 
	
		
			
				|  |  | +     * @author: lihong
 | 
	
		
			
				|  |  | +     * @date: 2023/2/2 10:04
 | 
	
		
			
				|  |  | +     * @param: patNo
 | 
	
		
			
				|  |  | +     * @param: times
 | 
	
		
			
				|  |  | +     * @param: ledgerSn
 | 
	
		
			
				|  |  | +     * @param: setlTime
 | 
	
		
			
				|  |  | +     **/
 | 
	
		
			
				|  |  | +    public void reUpload(String patNo,Integer times, Integer ledgerSn,Date setTime,String setlListId){
 | 
	
		
			
				|  |  | +        if(StringUtil.isBlank(setlListId)){
 | 
	
		
			
				|  |  | +           return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<AutoUploadBill> autoUploadBills = new ArrayList<>();
 | 
	
		
			
				|  |  | +        AutoUploadBill autoUploadBill = new AutoUploadBill();
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +        String userId = TokenUtil.getTokenUserId();
 | 
	
		
			
				|  |  | +        String userName = publicServer.huoQuYuanGongXinXi(userId).getName();
 | 
	
		
			
				|  |  | +        autoUploadBill.setPatNo(patNo);
 | 
	
		
			
				|  |  | +        autoUploadBill.setTimes(times);
 | 
	
		
			
				|  |  | +        autoUploadBill.setLedgerSn(ledgerSn);
 | 
	
		
			
				|  |  | +        autoUploadBill.setTypeFlag(AutoUploadBill.TypeFlag.SD_UPLOAD.getCode());
 | 
	
		
			
				|  |  | +        autoUploadBill.setUploadDate(new Date());
 | 
	
		
			
				|  |  | +        autoUploadBill.setSetlTime(setTime);
 | 
	
		
			
				|  |  | +        autoUploadBill.setCreatedDate(new Date());
 | 
	
		
			
				|  |  | +        autoUploadBill.setUploadCode(userId);
 | 
	
		
			
				|  |  | +        autoUploadBill.setUploadName(userName);
 | 
	
		
			
				|  |  | +        ResultVo<String> resultVo = upldSetlList(patNo, times, ledgerSn,false);
 | 
	
		
			
				|  |  | +        autoUploadBill.setLogText(resultVo.getMessage());
 | 
	
		
			
				|  |  | +        autoUploadBill.setFlag(resultVo.getCode() == 200 ? AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode():AutoUploadBill.FLAG.UPLOAD_FAIL.getCode());
 | 
	
		
			
				|  |  | +        }catch (Exception e){
 | 
	
		
			
				|  |  | +            log.error("结算单重新上传错误", e);
 | 
	
		
			
				|  |  | +            autoUploadBill.setLogText(e.getMessage());
 | 
	
		
			
				|  |  | +            autoUploadBill.setFlag(AutoUploadBill.FLAG.UPLOAD_FAIL.getCode());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        autoUploadBills.add(autoUploadBill);
 | 
	
		
			
				|  |  | +        autoUploadBillService.asyncSaveData(autoUploadBills);
 | 
	
		
			
				|  |  | +        if(autoUploadBill.getFlag() == AutoUploadBill.FLAG.UPLOAD_FAIL.getCode()){
 | 
	
		
			
				|  |  | +            throw new BizException(ExceptionEnum.LOGICAL_ERROR,"对已经上传的数据进行重新上传,[上传失败],详情:"+StringUtil.substring(autoUploadBill.getLogText(),0,200));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      public boolean isCheckFlag() {
 | 
	
		
			
				|  |  |          String checkUploadFlag = dao.getDictValueByDictName("1.3", "check_upload_flag");
 | 
	
		
			
				|  |  |          return "1".equals(checkUploadFlag)? true : false;
 | 
	
	
		
			
				|  | @@ -1381,9 +1438,9 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |                  if (StringUtil.isBlank(item.getQkjb()) || StringUtil.isBlank(item.getYhqk())) {
 | 
	
		
			
				|  |  |                      return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,切口愈合等级不能为空", item.getSsmc()));
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                if (StringUtil.notBlank(item.getMzys())) {
 | 
	
		
			
				|  |  | -                    if (item.getAnstStartDate() == null) {
 | 
	
		
			
				|  |  | -                        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,麻醉时间不能为空", item.getSsmc()));
 | 
	
		
			
				|  |  | +                if (StringUtil.notBlank(item.getMzff())) {
 | 
	
		
			
				|  |  | +                    if (item.getAnstStartDate() == null || item.getAnstEndDate() ==null  || StringUtil.isBlank(item.getMzys())) {
 | 
	
		
			
				|  |  | +                        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("手术:【%s】,麻醉方式不为空时,麻醉开始时间,麻醉结束时间,麻醉医师不能为空", item.getSsmc()));
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  List<String> a = VerifyCaseFrontSheet.logicalSurgeryTime(item.getOpStartDate(), item.getOpEndDate(), item.getAnstStartDate(), item.getAnstEndDate());
 | 
	
	
		
			
				|  | @@ -1438,6 +1495,9 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |          if(!"1".equals(param.getSaveAuditPassFlag())){
 | 
	
		
			
				|  |  |              tSetlDeptConfService.asynSendAuditMessge(param.getDisDept(),param.getOutDeptName(),param.getName(),param.getInpatientNo());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        SiSetlinfoTemp setlInfo = dao.getSetTimeAndSetListId(param.getInpatientNo(), param.getAdmissTimes(), param.getLedgerSn());
 | 
	
		
			
				|  |  | +        //已上传数据重新进行上传
 | 
	
		
			
				|  |  | +        reUpload(param.getInpatientNo(), param.getAdmissTimes(), param.getLedgerSn(),setlInfo.getSetlTime(),setlInfo.getSetlListId());
 | 
	
		
			
				|  |  |          return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "保存成功。");
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |