|
@ -4,6 +4,7 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.PatientReservation;
|
|
|
import com.yihu.wlyy.service.app.reservation.PatientReservationService;
|
|
|
import com.yihu.wlyy.service.common.SMSService;
|
|
|
import com.yihu.wlyy.service.common.account.DoctorService;
|
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.service.third.guahao.GuahaoDoctor;
|
|
@ -59,6 +60,8 @@ public class BookingController extends WeixinBaseController {
|
|
|
@Autowired
|
|
|
private DoctorService doctorService;
|
|
|
|
|
|
@Autowired
|
|
|
private SMSService smsService;
|
|
|
/**
|
|
|
* 根据城市编码获取相应挂号服务
|
|
|
*
|
|
@ -380,52 +383,53 @@ public class BookingController extends WeixinBaseController {
|
|
|
@RequestParam(value = "cardNo", required = true) String cardNo,
|
|
|
@ApiParam(name = "clinicCard", value = "市民卡号", defaultValue = "A0601003595X")
|
|
|
@RequestParam(value = "clinicCard", required = true) String clinicCard,
|
|
|
@ApiParam(name = "patientPhone", value = "患者手机", defaultValue = "13950116510")
|
|
|
@ApiParam(name = "patientPhone", value = "患者手机", defaultValue = "13559207522")
|
|
|
@RequestParam(value = "patientPhone", required = true) String patientPhone,
|
|
|
@ApiParam(name = "dcode", value = "代预约医生编号", defaultValue = "test00000000005")
|
|
|
@RequestParam(value = "dcode", required = true) String dcode,
|
|
|
@ApiParam(name = "dname", value = "代预约医生名称", defaultValue = "组2全科医生")
|
|
|
@RequestParam(value = "dname", required = true) String dname) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(patientName)) {
|
|
|
return error(-1, "未设置姓名!");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(cardNo)) {
|
|
|
return error(-1, "未设置身份证号!");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(clinicCard)) {
|
|
|
return error(-1, "未设置社保卡号!");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(patientPhone)) {
|
|
|
return error(-1, "未设置手机号码!");
|
|
|
}
|
|
|
String orderCode = guahaoXM.CreateOrderByDoctor(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode);
|
|
|
String orderCode = "aca163be-cd9f-4614-b01f-944c4bcf5c30";//guahaoXM.CreateOrderByDoctor(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode);
|
|
|
//获取预约信息查询是否挂号成功
|
|
|
PatientReservation obj = patientReservationService.findByCode(orderCode);
|
|
|
if (obj != null) {
|
|
|
Patient p = patientService.findByCode(obj.getPatient());
|
|
|
Doctor d = doctorService.findDoctorByCode(getUID());
|
|
|
String msg = d.getName() + "医生已成功为您预约:" + obj.getStartTime() + "," + obj.getOrgName() +
|
|
|
obj.getDeptName() + obj.getDeptName() + "医生的号源。您可直接前往医院就诊。";
|
|
|
if (StringUtils.isNotEmpty(p.getOpenid())) {
|
|
|
String des = "";
|
|
|
try {
|
|
|
String msg = obj.getDname() + "医生已成功为您预约:" + obj.getStartTime() + "," + obj.getOrgName() +
|
|
|
obj.getDeptName() + obj.getDeptName() + "医生的号源。您可直接前往医院就诊。";
|
|
|
|
|
|
//发送短信消息,调用总部发送信息的接口
|
|
|
JSONObject result = smsService.sendMsg(patientPhone, msg);
|
|
|
if (result != null && result.getInt("result") != 0) {
|
|
|
des = "短信提醒失败!(原因:"+result.getString("description")+")";
|
|
|
}
|
|
|
|
|
|
// 推送消息给微信端
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "");
|
|
|
json.put("toUser", p.getCode());
|
|
|
json.put("id", obj.getCode());
|
|
|
json.put("date", obj.getStartTime());
|
|
|
json.put("orgName", obj.getOrgName());
|
|
|
json.put("orgCode", obj.getOrgCode());
|
|
|
json.put("doctorName", obj.getDeptName());
|
|
|
json.put("deptName", obj.getDeptName());
|
|
|
json.put("remark", p.getName() + ",您好!\n" + msg);
|
|
|
PushMsgTask.getInstance().putWxMsg(getAccessToken(), 6, p.getOpenid(), p.getName(), json);
|
|
|
Patient p = patientService.findByCode(patient);
|
|
|
if (StringUtils.isNotEmpty(p.getOpenid())) {
|
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "");
|
|
|
json.put("toUser", patient);
|
|
|
json.put("id", orderCode);
|
|
|
json.put("date", obj.getStartTime());
|
|
|
json.put("orgName", obj.getOrgName());
|
|
|
json.put("orgCode", obj.getOrgCode());
|
|
|
json.put("doctorName", obj.getDeptName());
|
|
|
json.put("deptName", obj.getDeptName());
|
|
|
json.put("remark", patientName + ",您好!\n" + msg);
|
|
|
//PushMsgTask.getInstance().putWxMsg(getAccessToken(), 6, p.getOpenid(), patientName, json);
|
|
|
}
|
|
|
else{
|
|
|
des +=" 微信提醒失败,患者无绑定微信!";
|
|
|
}
|
|
|
}
|
|
|
//发送短信小时
|
|
|
// 调用总部发送信息的接口
|
|
|
String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, p.getMobile()), "GBK");
|
|
|
|
|
|
return write(200, "创建挂号单成功!");
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
return write(200, "创建挂号单成功!"+des);
|
|
|
} else {
|
|
|
return error(-1, "创建挂号单失败!");
|
|
|
}
|