SchedulingController.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package com.yihu.wlyy.web.patient.scheduling;
  2. import java.util.Date;
  3. import java.util.List;
  4. import com.yihu.wlyy.entity.patient.SignFamily;
  5. import com.yihu.wlyy.service.app.sign.FamilyContractService;
  6. import io.swagger.annotations.Api;
  7. import org.json.JSONObject;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.http.MediaType;
  10. import org.springframework.stereotype.Controller;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RequestMethod;
  13. import org.springframework.web.bind.annotation.ResponseBody;
  14. import com.yihu.wlyy.entity.doctor.schedule.DoctorScheduling;
  15. import com.yihu.wlyy.entity.doctor.schedule.DoctorSchedulingTimes;
  16. import com.yihu.wlyy.service.app.scheduling.DoctorSchedulingService;
  17. import com.yihu.wlyy.service.app.team.DrHealthTeamService;
  18. import com.yihu.wlyy.util.DateUtil;
  19. import com.yihu.wlyy.web.BaseController;
  20. /*
  21. * 医生排班控制类
  22. */
  23. @Controller
  24. @RequestMapping(value = "patient/scheduling", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  25. @Api(description = "医生排班")
  26. public class SchedulingController extends BaseController {
  27. @Autowired
  28. private DoctorSchedulingService doctorSchedulingService;
  29. @Autowired
  30. private DrHealthTeamService drHealthTeamService;
  31. @Autowired
  32. private FamilyContractService familyContractService;
  33. /**
  34. * 获取医生视频预约排班信息
  35. * @param days 未来几天
  36. * @return
  37. */
  38. @RequestMapping(value = "video_list")
  39. @ResponseBody
  40. public String videoList(int days) {
  41. try {
  42. //查询患者签约信息
  43. SignFamily sc = familyContractService.findByPatient(getUID());
  44. if(sc == null){
  45. return error(-1, "三师签约信息无效,请确定是否已过期!");
  46. }
  47. // 默认为未来两周
  48. if (days == 0) {
  49. days = 14;
  50. }
  51. // 开始日期
  52. Date begin = DateUtil.getNowDateShort();
  53. // 结束日期
  54. Date end = DateUtil.strToDate(DateUtil.getNextDay(DateUtil.getStringDateShort(), days), DateUtil.YYYY_MM_DD);
  55. // 查询医生排班设置
  56. List<DoctorScheduling> sdList = doctorSchedulingService.findDoctorVideoScheduling(sc.getTeamCode());
  57. // 查询未来几天排班数据
  58. List<DoctorSchedulingTimes> sdtList = doctorSchedulingService.findDoctorVideoSchedulingTimes(sc.getTeamCode(), begin, end);
  59. JSONObject json = new JSONObject();
  60. json.put("sd_list", sdList);
  61. json.put("sdt_list", sdtList);
  62. return write(200, "查询成功", "data", json);
  63. } catch (Exception e) {
  64. error(e);
  65. return error(-1, "医生排班信息查询失败!");
  66. }
  67. }
  68. }