|  | @@ -54,6 +54,7 @@ import thyyxxk.webserver.entity.medicalinsurance.setllistupldTemp.UpldCollection
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.querydata.AutoUploadBill;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.querydata.JieSuanDanChaXun;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.querydata.SiSetlinfoTemp;
 | 
	
		
			
				|  |  | +import thyyxxk.webserver.entity.querydata.TSetlDeptConf;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.vo.DrgGroupTestVO;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.vo.quality.DiseInfoListVO;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.vo.quality.OprtInfoListVO;
 | 
	
	
		
			
				|  | @@ -102,12 +103,14 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |      private final RedisLikeService redisLikeService;
 | 
	
		
			
				|  |  |      private DrgWebServices drgWebServices;
 | 
	
		
			
				|  |  |      private AutoUploadBillService autoUploadBillService;
 | 
	
		
			
				|  |  | +    private TSetlDeptConfService tSetlDeptConfService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public SetlListUpldService(ExecService exec, SiQueryDao queryDao, UpIdCollectionDao upIdCollectionDao,
 | 
	
		
			
				|  |  |                                 DismissDao dismissDao, PublicServer publicServer, SendWxInfoService sendWxInfoService,
 | 
	
		
			
				|  |  |                                 SiLogDao logDao, CaseFrontSheetMainService caseFrontSheetMainService,
 | 
	
		
			
				|  |  |                                 RedisLikeService redisLikeService, DrgWebServices drgWebServices,
 | 
	
		
			
				|  |  | -                               AutoUploadBillService autoUploadBillService
 | 
	
		
			
				|  |  | +                               AutoUploadBillService autoUploadBillService,
 | 
	
		
			
				|  |  | +                               TSetlDeptConfService tSetlDeptConfService
 | 
	
		
			
				|  |  |      ) {
 | 
	
		
			
				|  |  |          this.exec = exec;
 | 
	
		
			
				|  |  |          this.queryDao = queryDao;
 | 
	
	
		
			
				|  | @@ -120,6 +123,7 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |          this.redisLikeService = redisLikeService;
 | 
	
		
			
				|  |  |          this.drgWebServices = drgWebServices;
 | 
	
		
			
				|  |  |          this.autoUploadBillService = autoUploadBillService;
 | 
	
		
			
				|  |  | +        this.tSetlDeptConfService = tSetlDeptConfService;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -150,7 +154,8 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |          JSONObject jsonObject = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_SI_SETTLE_INFO, upldCollection.getData().getSetlinfo().getInsuplc());
 | 
	
		
			
				|  |  |          jsonObject.replace("input", input);
 | 
	
		
			
				|  |  |          // 这里是上传
 | 
	
		
			
				|  |  | -        JSONObject result = exec.executeTrade(jsonObject, SiFunction.UPLOAD_SI_SETTLE_INFO);
 | 
	
		
			
				|  |  | +        //JSONObject result = exec.executeTrade(jsonObject, SiFunction.UPLOAD_SI_SETTLE_INFO);
 | 
	
		
			
				|  |  | +        JSONObject result = null;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          log.info("医保结算信息上传 \n操作人:{}\n参数:{} \n结果:{}", TokenUtil.getTokenUserId(), jsonObject, result);
 | 
	
		
			
				|  |  |          if (null == result) {
 | 
	
	
		
			
				|  | @@ -178,13 +183,6 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private void checkUploadCondition(String patNo, ResultVo<UpldCollection> upldCollection,Integer times) {
 | 
	
		
			
				|  |  | -        boolean shiFouQianShouBingAn = dao.shiFouQianShou(patNo, times) > 0;
 | 
	
		
			
				|  |  | -        if (!patNo.startsWith("JT")) {
 | 
	
		
			
				|  |  | -            if (!shiFouQianShouBingAn) {
 | 
	
		
			
				|  |  | -                throw new BizException(ExceptionEnum.LOGICAL_ERROR, "该病案没有签收,请病案室签收后上传。");
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          if (upldCollection.getCode() != 200) {
 | 
	
		
			
				|  |  |              throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR, upldCollection.getMessage());
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -669,7 +667,8 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请选择需要上传的患者。");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          boolean checkFlag = isCheckFlag();
 | 
	
		
			
				|  |  | -        if(checkFlag){
 | 
	
		
			
				|  |  | +        boolean checkAuditFlag = isCheckAuditFlag();
 | 
	
		
			
				|  |  | +        if(checkAuditFlag){
 | 
	
		
			
				|  |  |              List<String> visitIds = param.stream().map(obj -> obj.getPatNo() + obj.getTimes()).collect(Collectors.toList());
 | 
	
		
			
				|  |  |              List<Integer> auditFlags = dao.listSetlModifyReq(visitIds);
 | 
	
		
			
				|  |  |              if (ListUtil.notBlank(auditFlags)) {
 | 
	
	
		
			
				|  | @@ -682,6 +681,8 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<AutoUploadBill> autoUploadBills = new ArrayList<>();
 | 
	
		
			
				|  |  | +        String userId = TokenUtil.getTokenUserId();
 | 
	
		
			
				|  |  | +        String userName = publicServer.huoQuYuanGongXinXi(userId).getName();
 | 
	
		
			
				|  |  |          for (int i = 0; i < param.size(); i++) {
 | 
	
		
			
				|  |  |              SiSetlinfoTemp siPatInfo = param.get(i);
 | 
	
		
			
				|  |  |              AutoUploadBill autoUploadBill = new AutoUploadBill();
 | 
	
	
		
			
				|  | @@ -692,10 +693,12 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              autoUploadBill.setUploadDate(new Date());
 | 
	
		
			
				|  |  |              autoUploadBill.setSetlTime(siPatInfo.getSetlTime());
 | 
	
		
			
				|  |  |              autoUploadBill.setCreatedDate(new Date());
 | 
	
		
			
				|  |  | +            autoUploadBill.setUploadCode(userId);
 | 
	
		
			
				|  |  | +            autoUploadBill.setUploadName(userName);
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  |                  ResultVo<String> resultVo = upldSetlList(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(),checkFlag);
 | 
	
		
			
				|  |  |                  autoUploadBill.setLogText(resultVo.getMessage());
 | 
	
		
			
				|  |  | -                autoUploadBill.setFlag(resultVo.getCode() == 200?AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode():AutoUploadBill.FLAG.UPLOAD_FAIL.getCode());
 | 
	
		
			
				|  |  | +                autoUploadBill.setFlag(resultVo.getCode() == 200 ? AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode():AutoUploadBill.FLAG.UPLOAD_FAIL.getCode());
 | 
	
		
			
				|  |  |                  upldSetlErrorMessage(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(), resultVo.getMessage(), resultVo.getCode() == 200 ? 0 : 1, i + 1, param.size(), siPatInfo.getOutDeptName(), siPatInfo.getPsnName(), siPatInfo.getReferPhysicianName());
 | 
	
		
			
				|  |  |              } catch (Exception e) {
 | 
	
		
			
				|  |  |                  log.error("批量上传结算单错误:{}", e);
 | 
	
	
		
			
				|  | @@ -714,6 +717,11 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |          return "1".equals(checkUploadFlag)? true : false;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    public boolean isCheckAuditFlag() {
 | 
	
		
			
				|  |  | +        String checkUploadFlag = dao.getDictValueByDictName("1.4", "check_audit_flag");
 | 
	
		
			
				|  |  | +        return "1".equals(checkUploadFlag)? true : false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 全部上传
 | 
	
		
			
				|  |  |       *
 | 
	
	
		
			
				|  | @@ -728,7 +736,8 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |                  return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有要上传的信息。");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              boolean checkFlag = isCheckFlag();
 | 
	
		
			
				|  |  | -            if(checkFlag){
 | 
	
		
			
				|  |  | +            boolean checkAuditFlag = isCheckAuditFlag();
 | 
	
		
			
				|  |  | +            if(checkAuditFlag){
 | 
	
		
			
				|  |  |                  // 只有全部为审核通过的数据才能上传
 | 
	
		
			
				|  |  |                  boolean isAllAuditPass = list.stream().allMatch(obj -> obj.getAuditFlag() != null && obj.getAuditFlag() == 1);
 | 
	
		
			
				|  |  |                  if (!isAllAuditPass) {
 | 
	
	
		
			
				|  | @@ -1340,9 +1349,15 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              dao.setlModBat(param.getBatjBa4(), "batj_ba4_modify");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          dao.shenBao(param.getOperation(), param.getDecType(), param.getInpatientNo(), param.getAdmissTimes());
 | 
	
		
			
				|  |  | +        if(!"1".equals(param.getSaveAuditPassFlag())){
 | 
	
		
			
				|  |  | +            tSetlDeptConfService.asynSendAuditMessge(param.getDisDept(),param.getName(),param.getInpatientNo());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "保存成功。");
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      //发起审核 返回日志
 | 
	
		
			
				|  |  |      public SetlAuditLog  sendReq(Integer auditFlag ,Integer auditType,ZyInactpatient param){
 | 
	
		
			
				|  |  |          //发起审核
 | 
	
	
		
			
				|  | @@ -1629,7 +1644,7 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |          if (ListUtil.isBlank(list)) {
 | 
	
		
			
				|  |  |              throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR, "没有查到数据");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        String[] title = {"住院号", "住院次数", "上传类型","上传结果标识","上传时间", "日志", "患者结算时间"};
 | 
	
		
			
				|  |  | +        String[] title = {"住院号", "住院次数", "上传类型","上传人","上传结果标识","上传时间", "日志", "患者结算时间"};
 | 
	
		
			
				|  |  |          String[][] content = new String[list.size()][];
 | 
	
		
			
				|  |  |          for (int i = 0, len = list.size(); i < len; i++) {
 | 
	
		
			
				|  |  |              content[i] = new String[title.length];
 | 
	
	
		
			
				|  | @@ -1637,10 +1652,11 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |              content[i][0] = pojo.getPatNo();
 | 
	
		
			
				|  |  |              content[i][1] = pojo.getTimes().toString();
 | 
	
		
			
				|  |  |              content[i][2] = pojo.getTypeFlag()==AutoUploadBill.TypeFlag.AUTO_UPLOAD.getCode() ? AutoUploadBill.TypeFlag.AUTO_UPLOAD.getName():AutoUploadBill.TypeFlag.SD_UPLOAD.getName();
 | 
	
		
			
				|  |  | -            content[i][3] = pojo.getFlag()==AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode() ? AutoUploadBill.FLAG.UPLOAD_SUCCESS.getName():AutoUploadBill.FLAG.UPLOAD_FAIL.getName();
 | 
	
		
			
				|  |  | -            content[i][4] = DateUtil.formatDatetime(pojo.getCreatedDate());
 | 
	
		
			
				|  |  | -            content[i][5] = pojo.getLogText();
 | 
	
		
			
				|  |  | -            content[i][6] = DateUtil.formatDatetime(pojo.getSetlTime(), DateUtil.DEFAULT_PATTERN);
 | 
	
		
			
				|  |  | +            content[i][3] = StringUtil.isBlank(pojo.getUploadName())?"":pojo.getUploadName();
 | 
	
		
			
				|  |  | +            content[i][4] = pojo.getFlag()==AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode() ? AutoUploadBill.FLAG.UPLOAD_SUCCESS.getName():AutoUploadBill.FLAG.UPLOAD_FAIL.getName();
 | 
	
		
			
				|  |  | +            content[i][5] = DateUtil.formatDatetime(pojo.getCreatedDate());
 | 
	
		
			
				|  |  | +            content[i][6] = pojo.getLogText();
 | 
	
		
			
				|  |  | +            content[i][7] = DateUtil.formatDatetime(pojo.getSetlTime(), DateUtil.DEFAULT_PATTERN);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          ExcelUtil.exportExcel(response, title, content);
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -2095,4 +2111,33 @@ public class SetlListUpldService {
 | 
	
		
			
				|  |  |          ResultVo<Map<String, List<CodeName>>> mapResultVo = caseFrontSheetMainService.sheetVerification(sheetOverview);
 | 
	
		
			
				|  |  |          return mapResultVo;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @description:查询科室配置信息
 | 
	
		
			
				|  |  | +     * @author: lihong
 | 
	
		
			
				|  |  | +     * @date: 2023/1/9 15:46
 | 
	
		
			
				|  |  | +     * @param: query
 | 
	
		
			
				|  |  | +     * @return: java.lang.Object
 | 
	
		
			
				|  |  | +     **/
 | 
	
		
			
				|  |  | +    public List<String> querySetlDeptConfInfo(TSetlDeptConf query) {
 | 
	
		
			
				|  |  | +        List<String> result = new ArrayList<>();
 | 
	
		
			
				|  |  | +        List<TSetlDeptConf> tSetlDeptConfs = tSetlDeptConfService.querySetlDeptConfInfo(query);
 | 
	
		
			
				|  |  | +        if(ListUtil.notBlank(tSetlDeptConfs)){
 | 
	
		
			
				|  |  | +             result = tSetlDeptConfs.stream().map(obj -> obj.getDeptCode()).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return  result;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @description:保存科室配置数据
 | 
	
		
			
				|  |  | +     * @author: lihong
 | 
	
		
			
				|  |  | +     * @date: 2023/1/9 16:09
 | 
	
		
			
				|  |  | +     * @param: data
 | 
	
		
			
				|  |  | +     **/
 | 
	
		
			
				|  |  | +    public void saveSetlDeptConfInfo(List<TSetlDeptConf> data) {
 | 
	
		
			
				|  |  | +        AssertUtil.isnotBlank(data, "保存的数据不能为空");
 | 
	
		
			
				|  |  | +        AssertUtil.isnotBlank(data.get(0).getCode(), "人员编码不能为空");
 | 
	
		
			
				|  |  | +        QueryWrapper delWrapper = new QueryWrapper();
 | 
	
		
			
				|  |  | +        delWrapper.eq("code",data.get(0).getCode());
 | 
	
		
			
				|  |  | +        tSetlDeptConfService.remove(delWrapper);
 | 
	
		
			
				|  |  | +        tSetlDeptConfService.batchSaveData(data);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |