|  | @ -5,13 +5,14 @@ import com.yihu.wlyy.entity.patient.Patient;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.PatientReservation;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.logs.BusinessLogs;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.message.SMSDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.app.consult.ConsultService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.app.reservation.PatientReservationService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.account.DoctorService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.account.PatientService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.third.guahao.GuahaoDoctor;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.third.guahao.GuahaoXMService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.third.guahao.GuahaoYihuService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.third.guahao.IGuahaoService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.third.jw.JwSmjkService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.task.PushMsgTask;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.HttpClientUtil;
 | 
	
	
		
			
				|  | @ -34,7 +35,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestParam;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.ResponseBody;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
	
		
			
				|  | @ -66,6 +66,10 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     WeiXinOpenIdUtils weiXinOpenIdUtils;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ConsultService consultService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private JwSmjkService jwSmjkService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 根据城市编码获取相应挂号服务
 | 
	
	
		
			
				|  | @ -138,8 +142,9 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  |                              @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "")
 | 
	
		
			
				|  |  |                              @RequestParam(value = "pageSize", required = false) Integer pageSize) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             List<Map<String, String>> list = getService(city).GetOrgList(city, filter, type, pageIndex, pageSize);
 | 
	
		
			
				|  |  |             return write(200, "获取机构列表成功!", "data", list);
 | 
	
		
			
				|  |  | //            List<Map<String, String>> list = getService(city).GetOrgList(city, filter, type, pageIndex, pageSize);
 | 
	
		
			
				|  |  |             String re = jwSmjkService.GetOrgList(type);
 | 
	
		
			
				|  |  |             return write(200, "获取机构列表成功!", "data", re);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -160,7 +165,8 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  |                                 @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "")
 | 
	
		
			
				|  |  |                                 @RequestParam(value = "pageSize", required = false) Integer pageSize) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             List<Map<String, String>> list = getService(city).GetOrgDepList(hospitalId, filter, pageIndex, pageSize);
 | 
	
		
			
				|  |  | //            List<Map<String, String>> list = getService(city).GetOrgDepList(hospitalId, filter, pageIndex, pageSize);
 | 
	
		
			
				|  |  |             String list = jwSmjkService.GetOrgDepList(hospitalId);
 | 
	
		
			
				|  |  |             return write(200, "获取科室列表成功!", "data", list);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
	
		
			
				|  | @ -183,7 +189,8 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  |                                 @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "")
 | 
	
		
			
				|  |  |                                 @RequestParam(value = "pageSize", required = false) Integer pageSize) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             List<GuahaoDoctor> list = getService(city).GetDoctorList(hospitalId, hosDeptId, filter, pageIndex, pageSize);
 | 
	
		
			
				|  |  | //            List<GuahaoDoctor> list = getService(city).GetDoctorList(hospitalId, hosDeptId, filter, pageIndex, pageSize);
 | 
	
		
			
				|  |  |             String list = jwSmjkService.GetDoctorList(hospitalId,hosDeptId);
 | 
	
		
			
				|  |  |             return write(200, "获取医生列表成功!", "data", list);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
	
		
			
				|  | @ -202,7 +209,8 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  |                                    @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "AA2")
 | 
	
		
			
				|  |  |                                    @RequestParam(value = "doctorId", required = true) String doctorId) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = getService(city).GetDoctorArrange(hospitalId, hosDeptId, doctorId);
 | 
	
		
			
				|  |  | //            List<Map<String, Object>> list = getService(city).GetDoctorArrange(hospitalId, hosDeptId, doctorId);
 | 
	
		
			
				|  |  |             String list = jwSmjkService.GetDoctorArrange(hospitalId,hosDeptId,doctorId);
 | 
	
		
			
				|  |  |             return write(200, "获取医生排班成功!", "data", list);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
	
		
			
				|  | @ -221,7 +229,8 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  |                                          @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "03101")
 | 
	
		
			
				|  |  |                                          @RequestParam(value = "doctorId", required = true) String doctorId) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             List<Map<String, String>> list = getService(city).GetDoctorArrangeSimple(hospitalId, hosDeptId, doctorId);
 | 
	
		
			
				|  |  | //            List<Map<String, String>> list = getService(city).GetDoctorArrangeSimple(hospitalId, hosDeptId, doctorId);
 | 
	
		
			
				|  |  |             String list = jwSmjkService.GetDoctorArrangeSimple(hospitalId,hosDeptId,doctorId);
 | 
	
		
			
				|  |  |             return write(200, "获取医生排班成功!", "data", list);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
	
		
			
				|  | @ -240,7 +249,8 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  |                                 @ApiParam(name = "hosDeptId", value = "科室id", defaultValue = "1040610")
 | 
	
		
			
				|  |  |                                 @RequestParam(value = "hosDeptId", required = true) String hosDeptId) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             GuahaoDoctor doctor = getService(city).GetDoctorInfo(doctorId, hospitalId, hosDeptId);
 | 
	
		
			
				|  |  | //            GuahaoDoctor doctor = getService(city).GetDoctorInfo(doctorId, hospitalId, hosDeptId);
 | 
	
		
			
				|  |  |             String doctor = jwSmjkService.GetDoctorInfo(hospitalId,hosDeptId,doctorId);
 | 
	
		
			
				|  |  |             return write(200, "获取医生信息成功!", "data", doctor);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
	
		
			
				|  | @ -289,12 +299,17 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  |             if (StringUtils.isEmpty(patientPhone)) {
 | 
	
		
			
				|  |  |                 return error(-1, "未设置手机号码!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             String orderCode = getService(city).CreateOrder(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //String orderCode = getService(city).CreateOrder(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone);
 | 
	
		
			
				|  |  |             String orderCode = jwSmjkService.CreateOrder(hospitalId,hospitalName,hosDeptId,hosDeptName,doctorId,doctorName,arrangeDate,patient,patientName,cardNo,clinicCard,patientPhone);
 | 
	
		
			
				|  |  |             //预约发送微信消息
 | 
	
		
			
				|  |  |             PatientReservation obj = patientReservationService.findByCode(orderCode);
 | 
	
		
			
				|  |  |             if (obj != null) {
 | 
	
		
			
				|  |  |                 Patient p = patientService.findByCode(obj.getPatient());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 if(StringUtils.isNotBlank(obj.getDoctor())){
 | 
	
		
			
				|  |  |                     consultService.sendMucMessageBySingnType(obj.getDoctor(),obj.getDoctorName(),patient,"我已成功为您预约:" + DateUtil.dateToStrLong(obj.getStartTime()) + "," + hospitalName + hosDeptName + doctorName + "医生的号源。您可直接前往医院就诊</br><a name='guahao' href='javascript:void(0)' data-id='" + obj.getId() + "'>点击查看详情</a>","1",p.getName());
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 String msg = "您成功预约了 " + obj.getOrgName() + " " + obj.getDoctorName() + " " + obj.getStartTime() + " 的号源!";
 | 
	
		
			
				|  |  |                 // 推送消息给微信端
 | 
	
		
			
				|  |  |                 JSONObject json = new JSONObject();
 | 
	
	
		
			
				|  | @ -367,7 +382,7 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "CancelOrder", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ResponseBody
 | 
	
		
			
				|  |  |     @ApiOperation("取消挂号单")
 | 
	
		
			
				|  |  |     @ApiOperation("取消挂号单(已废弃)")
 | 
	
		
			
				|  |  |     public String CancelOrder(@ApiParam(name = "orderId", value = "订单id", defaultValue = "9")
 | 
	
		
			
				|  |  |                               @RequestParam(value = "orderId", required = true) Long orderId) {
 | 
	
		
			
				|  |  |         try {
 | 
	
	
		
			
				|  | @ -691,11 +706,12 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  |     public String GetRegList(@ApiParam(name = "patient", value = "患者编号", defaultValue = "0cc6e4562de2437ab2dbbf51a9fc3b49")
 | 
	
		
			
				|  |  |                              @RequestParam(value = "patient", required = false) String patient) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  |             Date nowDate = new Date();
 | 
	
		
			
				|  |  |             Date oneMonthAfter = getMonthBefore(nowDate, -1);
 | 
	
		
			
				|  |  |             Date threeMonthBefore = getMonthBefore(nowDate, 3);        //三个月历史记录
 | 
	
		
			
				|  |  |             List<PatientReservation> list = guahaoXM.GetRegList(patient, sm.format(threeMonthBefore), sm.format(oneMonthAfter), threeMonthBefore, oneMonthAfter);
 | 
	
		
			
				|  |  | //            SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  | //            Date nowDate = new Date();
 | 
	
		
			
				|  |  | //            Date oneMonthAfter = getMonthBefore(nowDate, -1);
 | 
	
		
			
				|  |  | //            Date threeMonthBefore = getMonthBefore(nowDate, 3);        //三个月历史记录
 | 
	
		
			
				|  |  | //            List<PatientReservation> list = guahaoXM.GetRegList(patient, sm.format(threeMonthBefore), sm.format(oneMonthAfter), threeMonthBefore, oneMonthAfter);
 | 
	
		
			
				|  |  |             String list = jwSmjkService.GetRegList(patient);
 | 
	
		
			
				|  |  |             return write(200, "获取患者预约信息列表成功!", "data", list);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 | 
	
	
		
			
				|  | @ -712,7 +728,8 @@ public class BookingController extends WeixinBaseController {
 | 
	
		
			
				|  |  |                                           @ApiParam(name = "regCode", value = "挂号单号",defaultValue = "9c34e255-5984-43f0-8ecf-3bbf160e3c58")
 | 
	
		
			
				|  |  |                                           @RequestParam(value = "regCode", required = true) String regCode) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             PatientReservation obj = guahaoXM.getRegDetail(patientCode, orgCode, regCode);
 | 
	
		
			
				|  |  | //            PatientReservation obj = guahaoXM.getRegDetail(patientCode, orgCode, regCode);
 | 
	
		
			
				|  |  |             String obj = jwSmjkService.GetRegDetail(patientCode,orgCode,regCode);
 | 
	
		
			
				|  |  |             return write(200, "获取患者预约信息成功!", "data", obj);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, e.getMessage());
 |