package com.yihu.wlyy.web.patient.scheduling; import java.util.Date; import java.util.List; import com.yihu.wlyy.entity.patient.SignFamily; import com.yihu.wlyy.service.app.sign.FamilyContractService; import io.swagger.annotations.Api; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.yihu.wlyy.entity.doctor.schedule.DoctorScheduling; import com.yihu.wlyy.entity.doctor.schedule.DoctorSchedulingTimes; import com.yihu.wlyy.service.app.scheduling.DoctorSchedulingService; import com.yihu.wlyy.service.app.team.DrHealthTeamService; import com.yihu.wlyy.util.DateUtil; import com.yihu.wlyy.web.BaseController; /* * 医生排班控制类 */ @Controller @RequestMapping(value = "patient/scheduling", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @Api(description = "医生排班") public class SchedulingController extends BaseController { @Autowired private DoctorSchedulingService doctorSchedulingService; @Autowired private DrHealthTeamService drHealthTeamService; @Autowired private FamilyContractService familyContractService; /** * 获取医生视频预约排班信息 * @param days 未来几天 * @return */ @RequestMapping(value = "video_list") @ResponseBody public String videoList(int days) { try { //查询患者签约信息 SignFamily sc = familyContractService.findByPatient(getUID()); if(sc == null){ return error(-1, "三师签约信息无效,请确定是否已过期!"); } // 默认为未来两周 if (days == 0) { days = 14; } // 开始日期 Date begin = DateUtil.getNowDateShort(); // 结束日期 Date end = DateUtil.strToDate(DateUtil.getNextDay(DateUtil.getStringDateShort(), days), DateUtil.YYYY_MM_DD); // 查询医生排班设置 List sdList = doctorSchedulingService.findDoctorVideoScheduling(sc.getTeamCode()); // 查询未来几天排班数据 List sdtList = doctorSchedulingService.findDoctorVideoSchedulingTimes(sc.getTeamCode(), begin, end); JSONObject json = new JSONObject(); json.put("sd_list", sdList); json.put("sdt_list", sdtList); return write(200, "查询成功", "data", json); } catch (Exception e) { error(e); return error(-1, "医生排班信息查询失败!"); } } }