123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607 |
- package com.yihu.wlyy.web.third;
- import com.yihu.wlyy.entity.patient.Patient;
- import com.yihu.wlyy.entity.patient.PatientReservation;
- import com.yihu.wlyy.logs.BusinessLogs;
- 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.task.PushMsgTask;
- import com.yihu.wlyy.util.HttpClientUtil;
- import com.yihu.wlyy.util.SystemConf;
- import com.yihu.wlyy.web.WeixinBaseController;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.lang3.StringUtils;
- import org.apache.http.NameValuePair;
- import org.apache.http.message.BasicNameValuePair;
- import org.json.JSONArray;
- import org.json.JSONObject;
- import org.springframework.beans.factory.annotation.Autowired;
- 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.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- import java.text.SimpleDateFormat;
- import java.util.*;
- /**
- * 预约挂号
- *
- * @author hzp at 2016-08-30
- */
- @Controller
- @RequestMapping(value = "/third/guahao")
- @Api(description = "预约挂号接口")
- public class BookingController extends WeixinBaseController {
- @Autowired
- private GuahaoXMService guahaoXM;
- @Autowired
- private GuahaoYihuService guahaoYihu;
- @Autowired
- private PatientReservationService patientReservationService;
- @Autowired
- private PatientService patientService;
- @Autowired
- private DoctorService doctorService;
- /**
- * 根据城市编码获取相应挂号服务
- *
- * @return
- */
- private IGuahaoService getService(String city) {
- IGuahaoService re = guahaoYihu;
- if (city != null && city.equals("350200")) {
- re = guahaoXM;
- }
- return re;
- }
- /**
- * 发送短信参数
- */
- private List<NameValuePair> buildSmsParams(String content, String mobile) {
- List<NameValuePair> params = new ArrayList<NameValuePair>();
- params.add(new BasicNameValuePair("SpCode", SystemConf.getInstance().getSmsCode()));
- params.add(new BasicNameValuePair("LoginName", SystemConf.getInstance().getSmsName()));
- params.add(new BasicNameValuePair("Password", SystemConf.getInstance().getSmsPassword()));
- params.add(new BasicNameValuePair("MessageContent", content));
- params.add(new BasicNameValuePair("UserNumber", mobile));
- params.add(new BasicNameValuePair("SerialNumber", String.valueOf(System.currentTimeMillis())));
- params.add(new BasicNameValuePair("ScheduleTime", ""));
- params.add(new BasicNameValuePair("f", "1"));
- return params;
- }
- private JSONObject toJson(String result) {
- JSONObject json = new JSONObject();
- try {
- String[] temps = result.split("&");
- for (String temp : temps) {
- if (temp.split("=").length != 2) {
- continue;
- }
- String key = temp.split("=")[0];
- String value = temp.split("=")[1];
- json.put(key, value);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return json;
- }
- /**
- * 获取时间
- */
- private static Date getMonthBefore(Date d, int month) {
- Calendar now = Calendar.getInstance();
- now.setTime(d);
- now.set(Calendar.MONTH, now.get(Calendar.MONTH) - month);
- return now.getTime();
- }
- @RequestMapping(value = "GetOrgList", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("获取机构列表")
- public String GetOrgList(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
- @RequestParam(value = "city", required = true) String city,
- @ApiParam(name = "filter", value = "过滤条件", defaultValue = "")
- @RequestParam(value = "filter", required = false) String filter,
- @ApiParam(name = "type", value = "类型", defaultValue = "1")
- @RequestParam(value = "type", required = false) String type,
- @ApiParam(name = "pageIndex", value = "第几页", defaultValue = "")
- @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
- @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);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "GetOrgDepList", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("获取科室接口")
- public String GetOrgDepList(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
- @RequestParam(value = "city", required = true) String city,
- @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
- @RequestParam(value = "hospitalId", required = true) String hospitalId,
- @ApiParam(name = "filter", value = "过滤条件", defaultValue = "")
- @RequestParam(value = "filter", required = false) String filter,
- @ApiParam(name = "pageIndex", value = "第几页", defaultValue = "")
- @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
- @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);
- return write(200, "获取科室列表成功!", "data", list);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "GetDoctorList", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("获取医生接口")
- public String GetDoctorList(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
- @RequestParam(value = "city", required = true) String city,
- @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
- @RequestParam(value = "hospitalId", required = true) String hospitalId,
- @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1040610")
- @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
- @ApiParam(name = "filter", value = "过滤条件", defaultValue = "")
- @RequestParam(value = "filter", required = false) String filter,
- @ApiParam(name = "pageIndex", value = "第几页", defaultValue = "")
- @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
- @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "")
- @RequestParam(value = "pageSize", required = false) Integer pageSize) {
- try {
- List<GuahaoDoctor> list = getService(city).GetDoctorList(hospitalId, hosDeptId, filter, pageIndex, pageSize);
- return write(200, "获取医生列表成功!", "data", list);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "GetDoctorArrange", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("获取医生排班接口(包含排班详细)")
- public String GetDoctorArrange(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
- @RequestParam(value = "city", required = true) String city,
- @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211G1102")
- @RequestParam(value = "hospitalId", required = true) String hospitalId,
- @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "3020001")
- @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
- @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);
- return write(200, "获取医生排班成功!", "data", list);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "GetDoctorArrangeSimple", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("获取医生排班接口(一级)")
- public String GetDoctorArrangeSimple(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
- @RequestParam(value = "city", required = true) String city,
- @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
- @RequestParam(value = "hospitalId", required = true) String hospitalId,
- @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1010210")
- @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
- @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);
- return write(200, "获取医生排班成功!", "data", list);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "GetDoctorInfo", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("根据医生编码获取医生详细信息")
- public String GetDoctorInfo(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
- @RequestParam(value = "city", required = true) String city,
- @ApiParam(name = "doctorId", value = "医生id", defaultValue = "07101")
- @RequestParam(value = "doctorId", required = true) String doctorId,
- @ApiParam(name = "hospitalId", value = "医院id", defaultValue = "350211A1001")
- @RequestParam(value = "hospitalId", required = true) String hospitalId,
- @ApiParam(name = "hosDeptId", value = "科室id", defaultValue = "1040610")
- @RequestParam(value = "hosDeptId", required = true) String hosDeptId) {
- try {
- GuahaoDoctor doctor = getService(city).GetDoctorInfo(doctorId, hospitalId, hosDeptId);
- return write(200, "获取医生信息成功!", "data", doctor);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "CreateOrder", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("创建挂号单")
- public String CreateOrder(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
- @RequestParam(value = "city", required = true) String city,
- @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
- @RequestParam(value = "hospitalId", required = true) String hospitalId,
- @ApiParam(name = "hospitalName", value = "医院名称", defaultValue = "厦门大学附属第一医院")
- @RequestParam(value = "hospitalName", required = true) String hospitalName,
- @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1040610")
- @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
- @ApiParam(name = "hosDeptName", value = "医院科室名称", defaultValue = "儿二科")
- @RequestParam(value = "hosDeptName", required = true) String hosDeptName,
- @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "07101")
- @RequestParam(value = "doctorId", required = true) String doctorId,
- @ApiParam(name = "doctorName", value = "医生姓名", defaultValue = "林素莲")
- @RequestParam(value = "doctorName", required = true) String doctorName,
- @ApiParam(name = "arrangeDate", value = "排班信息", defaultValue = "{\"sectionType\":\"a\",\"startTime\":\"2016-09-02 08:20:00\",\"endTime\":\"2016-09-02 08:30:00\"}")
- @RequestParam(value = "arrangeDate", required = true) String arrangeDate,
- @ApiParam(name = "patient", value = "患者代码", defaultValue = "01954b2ebbb24a40a05da9d2f5c94795")
- @RequestParam(value = "patient", required = true) String patient,
- @ApiParam(name = "patientName", value = "患者姓名", defaultValue = "张锦川")
- @RequestParam(value = "patientName", required = true) String patientName,
- @ApiParam(name = "cardNo", value = "身份证号码", defaultValue = "35052419880511553X")
- @RequestParam(value = "cardNo", required = true) String cardNo,
- @ApiParam(name = "clinicCard", value = "市民卡号", defaultValue = "D57117706")
- @RequestParam(value = "clinicCard", required = true) String clinicCard,
- @ApiParam(name = "patientPhone", value = "患者手机", defaultValue = "13950116510")
- @RequestParam(value = "patientPhone", required = true) String patientPhone) {
- 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 = getService(city).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());
- String msg = "您成功预约了 " + obj.getOrgName() + " " + obj.getDoctorName() + " " + obj.getStartTime() + " 的号源!";
- if (StringUtils.isNotEmpty(p.getOpenid())) {
- // 推送消息给微信端
- JSONObject json = new JSONObject();
- json.put("first", "");
- json.put("toUser", p.getCode());
- json.put("id", obj.getCode());
- json.put("date", obj.getStartTime());
- json.put("orgCode", obj.getOrgCode());
- json.put("orgName", obj.getOrgName());
- json.put("doctorName", obj.getDoctorName());
- json.put("deptName", obj.getDeptName());
- json.put("remark", p.getName() + ",您好!" + msg);
- PushMsgTask.getInstance().putWxMsg(getAccessToken(), 6, p.getOpenid(), p.getName(), json);
- }
- //发送短信小时
- // 调用总部发送信息的接口
- //String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, p.getMobile()), "GBK");
- //JSONObject json = toJson(result);
- // if (json == null) {
- // // 发送失败
- // throw new Exception("短信发送失败!");
- // } else if (json.getInt("result") != 0) {
- // return json.getString("description");
- // } else {
- // //发送成功,保存到数据库
- // }
- BusinessLogs.info(BusinessLogs.BusinessType.appointment, getUID(), p.getCode(), new JSONObject(obj));
- return write(200, "创建挂号单成功!");
- } else {
- return error(-1, "创建挂号单失败!");
- }
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "CancelOrder", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("取消挂号单")
- public String CancelOrder(@ApiParam(name = "orderId", value = "订单id", defaultValue = "9")
- @RequestParam(value = "orderId", required = true) Long orderId) {
- try {
- //获取订单信息
- PatientReservation obj = patientReservationService.findById(orderId);
- boolean re = false;
- if (obj != null) {
- String type = obj.getType();
- String code = obj.getCode();
- if (type.equals("0")) { //医护网接口
- re = guahaoYihu.CancelOrder(code);
- } else if (type.equals("1")) //厦门市民健康预约接口
- {
- re = guahaoXM.CancelOrder(code, obj.getSsc());
- }
- }
- if (re) {
- //更新状态
- patientReservationService.updateStatus(orderId, 0);
- //微信消息
- Patient p = patientService.findByCode(obj.getPatient());
- if (StringUtils.isNotEmpty(p.getOpenid())) {
- JSONObject json = new JSONObject();
- json.put("first", "");
- json.put("toUser", p.getCode());
- json.put("name", obj.getName());
- json.put("date", obj.getStartTime());
- json.put("doctorName", obj.getDoctorName());
- json.put("orgName", obj.getOrgName());
- json.put("remark", obj.getName() + ",您好!\n您已取消了" + obj.getStartTime() + "的挂号!");
- PushMsgTask.getInstance().putWxMsg(getAccessToken(), 7, p.getOpenid(), obj.getName(), json);
- }
- return write(200, "取消挂号单成功!");
- } else {
- return error(-1, "取消挂号单失败!");
- }
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- /****************************************** 内网预约 ***************************************************************/
- /* @RequestMapping(value = "sendMessage", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("发送短信测试")
- public String sendMessage()
- {
- try {
- //发送短信消息,调用总部发送信息的接口
- String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams("测试", "13559207522"), "GBK");
- System.out.print(result);
- *//*JSONObject json = toJson(result);
- JSONObject result = smsService.sendMsg("13559207522", "测试");
- if (result != null && result.getInt("result") != 0) {
- System.out.print("短信提醒失败!(原因:" + result.getString("description") + ")");
- }*//*
- return error(-1, "创建挂号单失败!"+result);
- }
- catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }*/
- @RequestMapping(value = "CreateOrderByDoctor", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("(内网)转诊预约挂号")
- public String CreateOrderByDoctor(@ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
- @RequestParam(value = "hospitalId", required = true) String hospitalId,
- @ApiParam(name = "hospitalName", value = "医院名称", defaultValue = "厦门大学附属第一医院")
- @RequestParam(value = "hospitalName", required = true) String hospitalName,
- @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1011610")
- @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
- @ApiParam(name = "hosDeptName", value = "医院科室名称", defaultValue = "内分泌糖尿病科门诊")
- @RequestParam(value = "hosDeptName", required = true) String hosDeptName,
- @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "50108")
- @RequestParam(value = "doctorId", required = true) String doctorId,
- @ApiParam(name = "doctorName", value = "医生姓名", defaultValue = "杨叔禹")
- @RequestParam(value = "doctorName", required = true) String doctorName,
- @ApiParam(name = "arrangeDate", value = "排班信息", defaultValue = "{\"sectionType\":\"p\",\"startTime\":\"2016-12-29 14:00:00\",\"endTime\":\"2016-12-29 14:08:00\"}")
- @RequestParam(value = "arrangeDate", required = true) String arrangeDate,
- @ApiParam(name = "patient", value = "患者代码", defaultValue = "01954b2ebbb24a40a05da9d2f5c94795")
- @RequestParam(value = "patient", required = true) String patient,
- @ApiParam(name = "patientName", value = "患者姓名", defaultValue = "张锦川")
- @RequestParam(value = "patientName", required = true) String patientName,
- @ApiParam(name = "cardNo", value = "身份证号码", defaultValue = "35052419880511553X")
- @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 = "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 {
- String orderCode = guahaoXM.CreateOrderByDoctor(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode);
- //获取预约信息查询是否挂号成功
- PatientReservation obj = patientReservationService.findByCode(orderCode);
- if (obj != null) {
- String des = "";
- try {
- String msg = obj.getDname() + "医生已成功为您预约:" + obj.getStartTime() + "," + obj.getOrgName() +
- obj.getDeptName() + obj.getDeptName() + "医生的号源。您可直接前往医院就诊。";
- //发送短信消息,调用总部发送信息的接口
- String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, patientPhone), "GBK");
- System.out.print(result);
- JSONObject resultJson = toJson(result);
- if (resultJson != null && resultJson.getInt("result") != 0) {
- des = "短信提醒失败!(原因:"+resultJson.getString("description")+")";
- }
- // 推送消息给微信端
- 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 +=" 微信提醒失败,患者无绑定微信!";
- }
- BusinessLogs.info(BusinessLogs.BusinessType.appointment, getUID(), p.getCode(), new JSONObject(obj));
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- return write(200, "创建挂号单成功!"+des,"data",obj.getId());
- } else {
- return error(-1, "创建挂号单失败!");
- }
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "GetDoctorArrangeTenDay", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("(内网)获取医生排班接口")
- public String GetDoctorArrangeTenDay(
- @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
- @RequestParam(value = "hospitalId", required = true) String hospitalId,
- @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1011610")
- @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
- @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "50108")
- @RequestParam(value = "doctorId", required = true) String doctorId) {
- try {
- List<Map<String, Object>> list = guahaoXM.GetDoctorArrangeTenDay(hospitalId, hosDeptId, doctorId);
- return write(200, "获取医生排班成功!", "data", list);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- /********************************************* 医生端查询 **************************************************************************/
- @RequestMapping(value = "GetPatientReservationList", method = {RequestMethod.POST,RequestMethod.GET})
- @ResponseBody
- @ApiOperation("获取患者预约信息列表接口-医生端")
- public String GetPatientReservation(@ApiParam(name = "pageIndex", value = "第几页", defaultValue = "1")
- @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
- @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "10")
- @RequestParam(value = "pageSize", required = false) Integer pageSize,
- @ApiParam(name = "patient", value = "患者编号", defaultValue = "4afdbce6194e412fbc770eb4dfbe7b00")
- @RequestParam(value = "patient", required = false) String patient,
- @ApiParam(name = "teamCode", value = "行政团队")
- @RequestParam(value = "teamCode", required = false) Long teamCode) {
- try {
- JSONArray list = patientReservationService.getReservationByPatient(patient, teamCode, pageIndex, pageSize);
- return write(200, "获取患者预约信息列表成功!", "data", list);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "GetDoctorReservationList", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("获取医生代预约信息列表接口-医生端")
- public String GetDoctorReservation(@ApiParam(name = "pageIndex", value = "第几页", defaultValue = "1")
- @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
- @ApiParam(name = "pageSize", value = "每页记录数", defaultValue = "10")
- @RequestParam(value = "pageSize", required = false) Integer pageSize,
- @ApiParam(name = "doctor", value = "医生编号", defaultValue = "shiliuD20160926005")
- @RequestParam(value = "doctor", required = false) String doctor) {
- try {
- List<Map<String,String>> list = patientReservationService.getReservationByDoctor(doctor, pageIndex, pageSize);
- return write(200, "获取患者预约信息列表成功!", "data", list);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "GetPatientReservation", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("获取患者预约信息单条-医生端")
- public String GetPatientReservation(@ApiParam(name = "orderId", value = "订单id", defaultValue = "9")
- @RequestParam(value = "orderId", required = true) Long orderId) {
- try {
- PatientReservation obj = patientReservationService.findById(orderId);
- return write(200, "获取患者预约信息成功!", "data", obj);
- }
- catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "CountReservationByDoctorForPatient", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("获取医生为患者预约的总数")
- public String CountReservationByDoctorForPatient(@ApiParam(name = "doctor", value = "医生编号")
- @RequestParam(value = "doctor", required = true) String doctor,
- @ApiParam(name = "patient", value = "患者编号")
- @RequestParam(value = "patient", required = true) String patient) {
- try {
- Long obj = patientReservationService.countReservationByDoctorForPatient(doctor, patient);
- return write(200, "获取患者预约信息成功!", "data", obj);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- /*************************************** 患者端查询 ******************************************************************/
- @RequestMapping(value = "GetRegList", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("获取患者预约信息列表接口--患者端")
- 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);
- return write(200, "获取患者预约信息列表成功!", "data", list);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- @RequestMapping(value = "GetPatientReservationXm", method = RequestMethod.POST)
- @ResponseBody
- @ApiOperation("获取患者预约信息单条-患者端")
- public String GetPatientReservationXm(@ApiParam(name = "patientCode", value = "患者编号",defaultValue = "0cc6e4562de2437ab2dbbf51a9fc3b49")
- @RequestParam(value = "patientCode", required = true) String patientCode,
- @ApiParam(name = "orgCode", value = "机构编码",defaultValue = "350211A1002")
- @RequestParam(value = "orgCode", required = true) String orgCode,
- @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);
- return write(200, "获取患者预约信息成功!", "data", obj);
- } catch (Exception e) {
- return error(-1, e.getMessage());
- }
- }
- }
|