Sfoglia il codice sorgente

转诊预约挂号

hzp 8 anni fa
parent
commit
8a37c7c61b

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/archives/PatientRecordService.java

@ -237,6 +237,10 @@ public class PatientRecordService {
                    type = "检验";
                } else if ("0231".equals(item.optString("CATALOG_CODE"))) {
                    type = "检查";
                } else if ("0121".equals(item.optString("CATALOG_CODE"))) {
                    type = "检验";
                } else if ("0131".equals(item.optString("CATALOG_CODE"))) {
                    type = "检查";
                }
                map.put("type", type);
                map.put("catalogCode", item.optString("CATALOG_CODE")); //【基卫】档案类型

+ 191 - 105
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/GuahaoXMService.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientReservationDao;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SOAPUtil;
import com.yihu.wlyy.util.SendP2PUtil;
@ -50,6 +51,136 @@ public class GuahaoXMService implements IGuahaoService {
    private ObjectMapper objectMapper = new ObjectMapper();
    /**
     * 解析挂号后
     */
    private String CreateOrderAfter(String response,String hospitalId,String hospitalName,String hosDeptId,String hosDeptName,String doctorId,String doctorName,String sectionType,String startTime,String endTime,String patient,String patientName,String cardNo,String clinicCard,String patientPhone,String dname,String dcode) throws Exception
    {
        String code = "";
        if(response.startsWith("error")||response.startsWith("System-Error"))
        {
            throw new Exception(response);
        }
        else if (response.toLowerCase().startsWith("ok")) {      //预约成功
            // 预约成功,获取预约号
            code = response.replace("OK:", "").replace("ok:", "");
        }
        else if(response.split("\\|").length==3){
            code = response.split("\\|")[0];
        }
        else{
            throw new Exception(response);
        }
        // 查询医生职称和头像
        GuahaoDoctor doctor =  GetDoctorInfo(doctorId,hospitalId,hosDeptId);
        // 保存预约记录
        PatientReservation reservation = new PatientReservation();
        reservation.setCode(code);
        reservation.setCzrq(new Date());
        reservation.setType("1");
        reservation.setOrgCode(hospitalId);
        reservation.setOrgName(hospitalName);
        reservation.setDeptCode(hosDeptId);
        reservation.setDeptName(hosDeptName);
        reservation.setDoctorCode(doctorId);
        reservation.setDoctorName(doctorName);
        reservation.setDoctorJob(doctor.getTitle());
        reservation.setDoctorPhoto(doctor.getPhoto());
        reservation.setIdcard(cardNo);
        reservation.setName(patientName);
        reservation.setPatient(patient);
        reservation.setPhone(patientPhone);
        reservation.setSectionType(sectionType);
        reservation.setSsc(clinicCard);
        reservation.setStartTime(startTime);
        reservation.setEndTime(endTime);
        reservation.setStatus(1);
        if(StringUtils.isNotBlank(dname)){
            reservation.setDname(dname);//代理签约维护待签约人名称
        }
        if(StringUtils.isNotBlank(dcode)){
            reservation.setDoctor(dcode);//代理签约维护待签约人编码
            SendP2PUtil.sendP2Pmsg(dcode,patient,"1","我已成功为您预约:"+startTime+","+hospitalName+hosDeptName+doctorName+"医生的号源。您可直接前往医院就诊</br><a name='guahao' href='javascript:void(0)' data-id='"+code+"'>点击查看详情</a>");
        }
        // 保存预约记录
        patientReservationDao.save(reservation);
        return code;
    }
    /**
     * 预约排班xml转列表
     */
    private List<Map<String,Object>> xmlToList(String xml) throws Exception{
        List<Map<String,Object>> re = new ArrayList<>();
        if (StringUtils.isEmpty(xml)) {
            // 请求失败
            throw new Exception("获取医生排班表失败!");
        } else if (StringUtils.startsWith(xml, "System-Error")) {
            // 调用失败
            throw new Exception(xml.substring(xml.indexOf(":") + 1, xml.length()));
        }
        else if (StringUtils.startsWith(xml, "Error")) {
            // 调用失败
            throw new Exception(xml.substring(xml.indexOf(":") + 1, xml.length()));
        }
        Document document = DocumentHelper.parseText(xml);
        Element root = document.getRootElement();
        if(root.element("doctor")!=null)     //包含doctor节点
        {
            root = root.element("doctor");
        }
        List<?> child = root.elements();
        for (Object o : child) {
            Element e = (Element) o;
            // 日期
            String date = e.attributeValue("date");
            // a或者p
            String time = e.attributeValue("time");
            // 限号
            String max = e.attributeValue("max");
            // 已使用的号
            String used = e.attributeValue("used");
            // 1正常、2满号、3已过期
            String status = e.attributeValue("status");
            Map<String,Object> map = new HashMap<>();
            map.put("date", date);
            map.put("time", time);
            map.put("max", max);
            map.put("used", used);
            map.put("status", status);
            // 排班信息
            List<?> sections = e.elements();
            List<Map<String,String>> arrangeList = new ArrayList<>();
            for (Object s : sections) {
                Element section = (Element) s;
                // 限号
                String s_max = section.attributeValue("max");
                // 已使用的号
                String s_used = section.attributeValue("used");
                // 一次专家坐诊时间段的开始时间
                String start_time = section.attributeValue("start_time");
                // 结束时间
                String end_time = section.attributeValue("end_time");
                Map<String,String> item = new HashMap<>();
                item.put("max", s_max);
                item.put("used", s_used);
                item.put("startTime", start_time);
                item.put("endTime", end_time);
                arrangeList.add(item);
            }
            map.put("sections", arrangeList);
            re.add(map);
        }
        return re;
    }
    /***********************************************************************************************************************************************/
    /**
     * 获取医院列表
     */
@ -120,7 +251,6 @@ public class GuahaoXMService implements IGuahaoService {
        return  re;
    }
    /**
     * 获取科室接口
     */
@ -260,7 +390,6 @@ public class GuahaoXMService implements IGuahaoService {
     * status 0 停诊、1正常、2满号、3已过期
     */
    public List<Map<String,Object>> GetDoctorArrange(String hospitalId,String hosDeptId,String doctorId) throws Exception{
        List<Map<String,Object>> re = new ArrayList<>();
        JSONArray params = new JSONArray();
        JSONObject param1 = new JSONObject();
@ -290,63 +419,8 @@ public class GuahaoXMService implements IGuahaoService {
        params.put(param5);
        String xml = SOAPUtil.post(DOCTOR_ARRANGE, params);
        if (StringUtils.isEmpty(xml)) {
            // 请求失败
            throw new Exception("获取医生排班表失败!");
        } else if (StringUtils.startsWith(xml, "System-Error")) {
            // 调用失败
            throw new Exception(xml.substring(xml.indexOf(":") + 1, xml.length()));
        }
        else if (StringUtils.startsWith(xml, "Error")) {
            // 调用失败
            throw new Exception(xml.substring(xml.indexOf(":") + 1, xml.length()));
        }
        Document document = DocumentHelper.parseText(xml);
        Element root = document.getRootElement();
        List<?> child = root.elements();
        for (Object o : child) {
            Element e = (Element) o;
            // 日期
            String date = e.attributeValue("date");
            // a或者p
            String time = e.attributeValue("time");
            // 限号
            String max = e.attributeValue("max");
            // 已使用的号
            String used = e.attributeValue("used");
            // 1正常、2满号、3已过期
            String status = e.attributeValue("status");
            Map<String,Object> map = new HashMap<>();
            map.put("date", date);
            map.put("time", time);
            map.put("max", max);
            map.put("used", used);
            map.put("status", status);
            // 排班信息
            List<?> sections = e.elements();
            List<Map<String,String>> arrangeList = new ArrayList<>();
            for (Object s : sections) {
                Element section = (Element) s;
                // 限号
                String s_max = section.attributeValue("max");
                // 已使用的号
                String s_used = section.attributeValue("used");
                // 一次专家坐诊时间段的开始时间
                String start_time = section.attributeValue("start_time");
                // 结束时间
                String end_time = section.attributeValue("end_time");
                Map<String,String> item = new HashMap<>();
                item.put("max", s_max);
                item.put("used", s_used);
                item.put("startTime", start_time);
                item.put("endTime", end_time);
                arrangeList.add(item);
            }
            map.put("sections", arrangeList);
            re.add(map);
        }
        return  re;
        return  xmlToList(xml);
    }
    /**
@ -424,9 +498,8 @@ public class GuahaoXMService implements IGuahaoService {
    /**
     * 创建挂号单
     * update by linz 新增代签约人的code和name用于转诊预约
     */
    public String CreateOrder(String hospitalId,String hospitalName,String hosDeptId,String hosDeptName,String doctorId,String doctorName,String arrangeDate,String patient,String patientName,String cardNo,String clinicCard,String patientPhone,String dname,String dcode) throws Exception{
    public String CreateOrder(String hospitalId,String hospitalName,String hosDeptId,String hosDeptName,String doctorId,String doctorName,String arrangeDate,String patient,String patientName,String cardNo,String clinicCard,String patientPhone) throws Exception{
        String re = "";
        Patient p = patientService.findByCode(patient);
@ -475,62 +548,30 @@ public class GuahaoXMService implements IGuahaoService {
            param3.put("value", values[2]);
            params.put(param3);
            String xml = SOAPUtil.post(ORDER_CREATE, params);
            if (StringUtils.isEmpty(xml)) {
            String response = SOAPUtil.post(ORDER_CREATE, params);
            if (StringUtils.isEmpty(response)) {
                // 请求失败
                throw new Exception("请求失败!");
            } else if (StringUtils.startsWith(xml, "System-Error")) {
            } else if (StringUtils.startsWith(response, "System-Error")) {
                // 调用失败
                throw new Exception(xml.substring(xml.indexOf(":") + 1, xml.length()));
            }  else if (StringUtils.startsWith(xml, "Error")) {
                throw new Exception(response.substring(response.indexOf(":") + 1, response.length()));
            }  else if (StringUtils.startsWith(response, "Error")) {
                // 调用失败
                throw new Exception(xml.substring(xml.indexOf(":") + 1, xml.length()));
                throw new Exception(response.substring(response.indexOf(":") + 1, response.length()));
            }
            //预约成功
            if (xml.toLowerCase().startsWith("ok")) {
                // 预约成功,获取预约号
                String code = xml.replace("OK:", "");
                // 查询医生职称和头像
                GuahaoDoctor doctor =  GetDoctorInfo(doctorId,hospitalId,hosDeptId);
                // 保存预约记录
                PatientReservation reservation = new PatientReservation();
                reservation.setCode(code);
                reservation.setCzrq(new Date());
                reservation.setType("1");
                reservation.setOrgCode(hospitalId);
                reservation.setOrgName(hospitalName);
                reservation.setDeptCode(hosDeptId);
                reservation.setDeptName(hosDeptName);
                reservation.setDoctorCode(doctorId);
                reservation.setDoctorName(doctorName);
                reservation.setDoctorJob(doctor.getTitle());
                reservation.setDoctorPhoto(doctor.getPhoto());
                reservation.setIdcard(cardNo);
                reservation.setName(patientName);
                reservation.setPatient(patient);
                reservation.setPhone(patientPhone);
                reservation.setSectionType(sectionType);
                reservation.setSsc(clinicCard);
                reservation.setStartTime(startTime);
                reservation.setEndTime(endTime);
                reservation.setStatus(1);
                if(StringUtils.isNotBlank(dname)){
                    reservation.setDname(dname);//代理签约维护待签约人名称
                }
                if(StringUtils.isNotBlank(dcode)){
                    reservation.setDoctor(dcode);//代理签约维护待签约人编码
                    SendP2PUtil.sendP2Pmsg(dcode,patient,"1","我已成功为您预约:"+startTime+","+hospitalName+hosDeptName+doctorName+"医生的号源。您可直接前往医院就诊</br><a name='guahao' href='javascript:void(0)' data-id='"+code+"'>点击查看详情</a>");
                }
                // 保存预约记录
                patientReservationDao.save(reservation);
                re = code;
            }
            re = CreateOrderAfter(response,hospitalId,hospitalName,hosDeptId,hosDeptName,doctorId,doctorName,sectionType,startTime,endTime,patient,patientName,cardNo,clinicCard,patientPhone,null,null);
        }
        else{
            throw new Exception("该排班信息错误或者不存在!");
        }
        return re;
    }
    /**
     * 取消挂号单
     */
@ -977,4 +1018,49 @@ public class GuahaoXMService implements IGuahaoService {
            patientReservation.setDoctorJob(guahaoDoctor.getTitle());//职称
            return patientReservation;
    }
    @Autowired
    JwSmjkService jwSmjkService;
    /******************************** 基卫内网服务 ************************************************/
    public List<Map<String,Object>> GetDoctorArrangeTenDay(String hospitalId,String hosDeptId,String doctorId) throws Exception {
        String strStart = DateUtil.getStringDateShort(); //当前时间;
        String strEnd = DateUtil.getNextDay(strStart,11);         //10天预约
        String response = jwSmjkService.getRegDeptSpeDoctorSectionList(hospitalId,hosDeptId,strStart,strEnd,doctorId);
        return xmlToList(response);
    }
    /**
     * 转诊预约挂号
     */
    public String CreateOrderByDoctor(String hospitalId,String hospitalName,String hosDeptId,String hosDeptName,String doctorId,String doctorName,String arrangeDate,String patient,String patientName,String cardNo,String clinicCard,String patientPhone,String dname,String dcode) throws Exception
    {
        String re = "";
        Patient p = patientService.findByCode(patient);
        if (p == null) {
            throw new Exception("患者信息不存在!");
        }
        Map<String,String> map = objectMapper.readValue(arrangeDate,Map.class);
        if(map.containsKey("sectionType") && map.containsKey("startTime")) {
            String sectionType = map.get("sectionType");
            String startTime = map.get("startTime");
            String endTime = map.get("endTime");
            String response = jwSmjkService.webRegisterByFamily(cardNo,patientName,clinicCard,sectionType,startTime,hospitalId,hosDeptId,hosDeptName,doctorId,doctorName);
            re = CreateOrderAfter(response,hospitalId,hospitalName,hosDeptId,hosDeptName,doctorId,doctorName,sectionType,startTime,endTime,patient,patientName,cardNo,clinicCard,patientPhone,dname,dcode);
        }
        else{
            throw new Exception("该排班信息错误或者不存在!");
        }
        return re;
    }
}

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/GuahaoYihuService.java

@ -227,7 +227,7 @@ public class GuahaoYihuService implements IGuahaoService {
    /**
     * 创建挂号单
     */
    public String CreateOrder(String hospitalId,String hospitalName,String hosDeptId,String hosDeptName,String doctorId,String doctorName,String arrangeDate,String patient,String patientName,String cardNo,String clinicCard,String patientPhone,String dname,String dcode) throws Exception{
    public String CreateOrder(String hospitalId,String hospitalName,String hosDeptId,String hosDeptName,String doctorId,String doctorName,String arrangeDate,String patient,String patientName,String cardNo,String clinicCard,String patientPhone) throws Exception{
        return  "";
    }

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/IGuahaoService.java

@ -38,7 +38,7 @@ public interface IGuahaoService{
	/**
	 * 创建挂号单
	 */
	public String CreateOrder(String hospitalId,String hospitalName,String hosDeptId,String hosDeptName,String doctorId,String doctorName,String arrangeDate,String patient,String patientName,String cardNo,String clinicCard,String patientPhone,String dname,String dcode ) throws Exception;
	public String CreateOrder(String hospitalId,String hospitalName,String hosDeptId,String hosDeptName,String doctorId,String doctorName,String arrangeDate,String patient,String patientName,String cardNo,String clinicCard,String patientPhone) throws Exception;
	/**
	 * 获取医生信息

+ 63 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java

@ -294,7 +294,7 @@ public class JwSmjkService {
    /****************************************************************************************************************************/
    /**
     * 获取转诊预约医生号源信息
     * (内网)获取转诊预约医生号源信息
     */
    public String getRegDeptSpeDoctorSectionList(String OrgCode,String DeptCode,String strStart,String strEnd,String DocCode)  throws Exception
    {
@ -308,10 +308,71 @@ public class JwSmjkService {
        params.add(new BasicNameValuePair("strEnd", strEnd));
        params.add(new BasicNameValuePair("DocCode", DocCode));
        return HttpClientUtil.post(url, params, "UTF-8");
        String response =  HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)) {
            JSONObject jsonObject = new JSONObject(response);
            int status = jsonObject.getInt("status");
            if (status == 200) {
                String data = jsonObject.getString("data");
                if (!StringUtils.isEmpty(data) && (data.startsWith("error")||data.startsWith("System-Error"))) {
                    throw new Exception(data);
                } else {
                    re = data;
                }
            } else {
                throw new Exception(jsonObject.getString("msg"));
            }
        } else {
            throw new Exception("null response.");
        }
        return re;
    }
    /**
     * (内网)预约挂号接口
     */
    public String webRegisterByFamily(String idcard,String patientName,String ssid,String sectionType,String startTime,String orgCode,String deptCode,String deptName,String doctorCode,String doctorName)  throws Exception
    {
        String re = "";
        String url = jwUrl + "/third/smjk/WebRegisterByFamily";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("idcard", idcard));
        params.add(new BasicNameValuePair("patientName", patientName));
        params.add(new BasicNameValuePair("ssid", ssid));
        params.add(new BasicNameValuePair("sectionType", sectionType));
        params.add(new BasicNameValuePair("startTime", startTime));
        params.add(new BasicNameValuePair("orgCode", orgCode));
        params.add(new BasicNameValuePair("deptCode", deptCode));
        params.add(new BasicNameValuePair("deptName", deptName));
        params.add(new BasicNameValuePair("doctorCode", doctorCode));
        params.add(new BasicNameValuePair("doctorName", doctorName));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)) {
            JSONObject jsonObject = new JSONObject(response);
            int status = jsonObject.getInt("status");
            if (status == 200) {
                String data = jsonObject.getString("data");
                if (!StringUtils.isEmpty(data) && (data.startsWith("error")||data.startsWith("System-Error"))) {
                    return "111111|aaaaaa|zzzz";
                    //throw new Exception(data);
                } else {
                    re = data;
                }
            } else {
                throw new Exception(jsonObject.getString("msg"));
            }
        } else {
            throw new Exception("null response.");
        }
        //返回挂号单
        return re;
    }

+ 5 - 14
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java

@ -192,6 +192,7 @@ public class WlyySerivceController extends BaseController{
        }
    }
    /**
     * 转诊预约医生特殊号源获取
     * @param OrgCode 医院编号
@ -203,26 +204,16 @@ public class WlyySerivceController extends BaseController{
    @ApiOperation("转诊预约获取特殊号源接口")
    public String getSpeDoctorSectionList(@RequestParam("OrgCode") String OrgCode,@RequestParam("DeptCode") String DeptCode,@RequestParam("DocCode") String DocCode){
        try{
            SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd");
            Date nowDate =new Date();
            Date tenDateAfter =  getDateAfter(nowDate,10);
            String strStart = sm.format(nowDate);
            String strEnd = sm.format(tenDateAfter);
            //String response = jwSmjkService.getRegDeptSpeDoctorSectionList(OrgCode,DeptCode,strStart,strEnd,DocCode);
            List<Map<String,Object>> list = guahaoXM.GetDoctorArrangeTenDay(OrgCode,DeptCode,DocCode);
            return write(200, "获取医生排班成功!", "data", list);
            /*****modify by linz 暂时把号源转换成普通号源****/
           /* *//*****modify by linz 暂时把号源转换成普通号源****//*
            List<Map<String,Object>> list =  guahaoXM.GetDoctorArrange(OrgCode,DeptCode,DocCode);
            //if(StringUtils.isEmpty(response)){
            //    return write(-1,"医生排班时间获取失败");
            //}else{
            //    JSONObject myJsonObject = new JSONObject(jsonString);
            //    return write(200,"医生排班时间获取成功","data",parseXmlForSpe(response));
            //}
            for(Map map :list){
                String date = (String)map.get("date");
                map.put("date",date.replaceAll("-","/"));
            }
            return write(200, "获取医生排班成功!", "data", list);
            return write(200, "获取医生排班成功!", "data", list);*/
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"医生排班时间获取失败");

+ 53 - 76
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -73,8 +73,31 @@ public class BookingController extends WeixinBaseController {
    }
    /**
     * 获取机构列表
     * 发送短信参数
     */
    private static 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 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("获取机构列表")
@ -97,9 +120,6 @@ public class BookingController extends WeixinBaseController {
    }
    /**
     * 获取科室接口
     */
    @RequestMapping(value = "GetOrgDepList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取科室接口")
@ -121,9 +141,6 @@ public class BookingController extends WeixinBaseController {
        }
    }
    /**
     * 获取医生列表接口
     */
    @RequestMapping(value = "GetDoctorList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取医生接口")
@ -147,9 +164,6 @@ public class BookingController extends WeixinBaseController {
        }
    }
    /**
     * 获取医生排班接口
     */
    @RequestMapping(value = "GetDoctorArrange", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取医生排班接口(包含排班详细)")
@ -169,9 +183,6 @@ public class BookingController extends WeixinBaseController {
        }
    }
    /**
     * 获取医生排班接口
     */
    @RequestMapping(value = "GetDoctorArrangeSimple", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取医生排班接口(一级)")
@ -191,9 +202,6 @@ public class BookingController extends WeixinBaseController {
        }
    }
    /**
     * 根据医生编码获取医生详细信息
     */
    @RequestMapping(value = "GetDoctorInfo", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("根据医生编码获取医生详细信息")
@ -213,9 +221,6 @@ public class BookingController extends WeixinBaseController {
        }
    }
    /**
     * 创建挂号单
     */
    @RequestMapping(value = "CreateOrder", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("创建挂号单")
@ -258,7 +263,7 @@ 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, null, null);
            String orderCode = getService(city).CreateOrder(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone);
            //预约发送微信消息
            PatientReservation obj = patientReservationService.findByCode(orderCode);
@ -300,58 +305,24 @@ public class BookingController extends WeixinBaseController {
        }
    }
    public static 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;
    }
    public static 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;
    }
    /**
     * 创建挂号单
     */
    @RequestMapping(value = "CreateOrderByDoctor", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("创建挂号单")
    public String CreateOrderByDoctor(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                      @RequestParam(value = "city", required = true) String city,
                                      @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
    @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 = "1040610")
                                      @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1011610")
                                      @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
                                      @ApiParam(name = "hosDeptName", value = "医院科室名称", defaultValue = "儿二科")
                                      @ApiParam(name = "hosDeptName", value = "医院科室名称", defaultValue = "内分泌糖尿病科门诊")
                                      @RequestParam(value = "hosDeptName", required = true) String hosDeptName,
                                      @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "07101")
                                      @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "50108")
                                      @RequestParam(value = "doctorId", required = true) String doctorId,
                                      @ApiParam(name = "doctorName", value = "医生姓名", defaultValue = "林素莲")
                                      @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\"}")
                                      @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,
@ -359,7 +330,7 @@ public class BookingController extends WeixinBaseController {
                                      @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")
                                      @ApiParam(name = "clinicCard", value = "市民卡号", defaultValue = "A0601003595X")
                                      @RequestParam(value = "clinicCard", required = true) String clinicCard,
                                      @ApiParam(name = "patientPhone", value = "患者手机", defaultValue = "13950116510")
                                      @RequestParam(value = "patientPhone", required = true) String patientPhone,
@ -380,7 +351,7 @@ 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, dname, dcode);
            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) {
@ -415,6 +386,23 @@ public class BookingController extends WeixinBaseController {
        }
    }
    @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());
        }
    }
    /**
     * 取消挂号单
@ -466,9 +454,7 @@ public class BookingController extends WeixinBaseController {
    }
    /**
     * 获取患者预约信息列表接口
     */
    @RequestMapping(value = "GetPatientReservationList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息列表接口-医生端")
@ -504,9 +490,7 @@ public class BookingController extends WeixinBaseController {
        }
    }
    /**
     * 获取医生代预约信息列表接口
     */
    @RequestMapping(value = "GetDoctorReservationList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取医生代预约信息列表接口-医生端")
@ -572,13 +556,6 @@ public class BookingController extends WeixinBaseController {
        }
    }
    public 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();
    }
    /**
     * 获取患者预约信息单条
     */