|  | @@ -1,10 +1,12 @@
 | 
	
		
			
				|  |  |  package thyyxxk.webserver.service.zhuyuanyiji;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import cn.hutool.extra.spring.SpringUtil;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
	
		
			
				|  |  |  import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  | +import org.springframework.scheduling.annotation.Async;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.config.exception.ExceptionEnum;
 | 
	
	
		
			
				|  | @@ -45,6 +47,10 @@ public class QueRenYiZhuShouFeiServer {
 | 
	
		
			
				|  |  |          this.patientService = patientService;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    public QueRenYiZhuShouFeiServer getThis() {
 | 
	
		
			
				|  |  | +        return SpringUtil.getBean(this.getClass());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * @param yzActOrder 查询条件 住院号,住院次数,执行科室, 分页
 | 
	
		
			
				|  |  |       * @return 返回分页数据
 | 
	
	
		
			
				|  | @@ -168,17 +174,25 @@ public class QueRenYiZhuShouFeiServer {
 | 
	
		
			
				|  |  |              pa.setLedgerSn(patient.getLedgerSn());
 | 
	
		
			
				|  |  |              huanZhe.add(pa);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        getThis().acceptFees(huanZhe);
 | 
	
		
			
				|  |  | +        log.info("医嘱确费保存==》操作人:{},数据:{}", TokenUtil.getTokenUserId(), JSON.toJSONStringWithDateFormat(xuYaoQueFei, GetDateFormat.DATE_TIME));
 | 
	
		
			
				|  |  | +        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "操作成功 (๑*◡*๑)");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 通过患者的住院号 确认费用
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param huanZhe 患者信息
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Async
 | 
	
		
			
				|  |  | +    public void acceptFees(Set<Patient> huanZhe) {
 | 
	
		
			
				|  |  |          for (Patient patient : huanZhe) {
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  |                  patientService.receiveAndRecalculateCost(patient);
 | 
	
		
			
				|  |  | -            } catch (Exception e) {
 | 
	
		
			
				|  |  | -                JSONObject obj = new JSONObject();
 | 
	
		
			
				|  |  | -                obj.put("message", String.format("患者名字为:【%s】,医嘱确认成功但接受费用失败,请护士重新接受费用", patient.getName()));
 | 
	
		
			
				|  |  | -                WebSocketServer.sendMessageByUserCode(TokenUtil.getTokenUserId(), SocketMsg.socketVo(Message.SYSTEM_NOTIFICATION, obj));
 | 
	
		
			
				|  |  | +            } catch (Exception ignored) {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        log.info("医嘱确费保存==》操作人:{},数据:{}", TokenUtil.getTokenUserId(), JSON.toJSONStringWithDateFormat(xuYaoQueFei, GetDateFormat.DATE_TIME));
 | 
	
		
			
				|  |  | -        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "操作成功 (๑*◡*๑)");
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 |