FeiYongJieShouChongSuan.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package thyyxxk.webserver.scheduled;
  2. import lombok.extern.slf4j.Slf4j;
  3. import org.springframework.beans.factory.annotation.Value;
  4. import org.springframework.scheduling.annotation.Scheduled;
  5. import org.springframework.stereotype.Component;
  6. import thyyxxk.webserver.dao.his.scheduled.JieShouFeiYongDao;
  7. import thyyxxk.webserver.entity.yibao.patient.Patient;
  8. import thyyxxk.webserver.service.yibao.PatientService;
  9. import java.util.List;
  10. /**
  11. * <p>
  12. * 描述: 费用接受重算
  13. * </p>
  14. *
  15. * @author xc
  16. * @date 2021-12-21 16:37
  17. */
  18. @Slf4j
  19. @Component
  20. public class FeiYongJieShouChongSuan {
  21. private final JieShouFeiYongDao dao;
  22. private final PatientService patientService;
  23. @Value("${fei-yong-jie-shou}")
  24. private Boolean feiYongJieShou;
  25. public FeiYongJieShouChongSuan(JieShouFeiYongDao dao, PatientService patientService) {
  26. this.dao = dao;
  27. this.patientService = patientService;
  28. }
  29. @Scheduled(cron = "0 30 11 * * ?")
  30. public void jieShouFeiYong() {
  31. // 每天凌晨 1 点 执行
  32. if (feiYongJieShou) {
  33. List<Patient> xuYaoJieShouDeFeiYong = dao.xuYaoJieShouFeiYong();
  34. for (Patient item : xuYaoJieShouDeFeiYong) {
  35. try {
  36. patientService.receiveAndRecalculateCost(item);
  37. } catch (Exception e) {
  38. log.info("费用接受失败==>住院号:{},住院次数:{},账页号:{}", item.getInpatientNo(), item.getAdmissTimes(), item.getLedgerSn());
  39. e.printStackTrace();
  40. }
  41. }
  42. String message = dao.jieShouYaoPing();
  43. log.info("药品接收:{}", message);
  44. }
  45. }
  46. }