Browse Source

Merge branch 'dev' of huangzhanpeng/wlyy_management into dev

lyr 8 years ago
parent
commit
13a7ddcdaf

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/reservation/PatientReservationService.java

@ -165,7 +165,7 @@ public class PatientReservationService extends BaseService {
		}
	}
	/**
	 * 分页获取患者预约记录
	 * 分页获取患者预约记录(医生端)
	 */
	public List<PatientReservation> getReservationByDoctor(String doctor, int page, int pagesize) {
		// 排序

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

@ -719,83 +719,81 @@ public class GuahaoXMService implements IGuahaoService {
     */
    public Integer GetOrderStatus(String hospitalId,String orderId,String clinicCard) throws Exception
    {
        StringBuffer sb = new StringBuffer();
        sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
        sb.append("<root>");
        sb.append("<org_code>").append(hospitalId).append("</org_code>");
        sb.append("<resid>").append(orderId).append("</resid>");
        sb.append("<ssid>").append(clinicCard).append("</ssid>");
        sb.append("</root>");
        String[] values = SOAPUtil.getCredential(sb.toString(), true);
        Integer re = null;
        try {
            StringBuffer sb = new StringBuffer();
            sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            sb.append("<root>");
            sb.append("<org_code>").append(hospitalId).append("</org_code>");
            sb.append("<resid>").append(orderId).append("</resid>");
            sb.append("<ssid>").append(clinicCard).append("</ssid>");
            sb.append("</root>");
        JSONArray params = new JSONArray();
            String[] values = SOAPUtil.getCredential(sb.toString(), true);
        JSONObject param1 = new JSONObject();
        param1.put("key", "?strCondition");
        param1.put("value", values[0]);
        params.put(param1);
            JSONArray params = new JSONArray();
        JSONObject param2 = new JSONObject();
        param2.put("key", "?strCredential");
        param2.put("value", values[1]);
        params.put(param2);
            JSONObject param1 = new JSONObject();
            param1.put("key", "?strCondition");
            param1.put("value", values[0]);
            params.put(param1);
        JSONObject param3 = new JSONObject();
        param3.put("key", "?strKey");
        param3.put("value", values[2]);
        params.put(param3);
            JSONObject param2 = new JSONObject();
            param2.put("key", "?strCredential");
            param2.put("value", values[1]);
            params.put(param2);
        String xml = SOAPUtil.post(ORDER_INFO, 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()));
        }
            JSONObject param3 = new JSONObject();
            param3.put("key", "?strKey");
            param3.put("value", values[2]);
            params.put(param3);
        Document document = DocumentHelper.parseText(xml);
        Element root = document.getRootElement();
        List<?> child = root.elements();
        if(child!=null)
        {
            Integer re = null;
            Element obj = (Element) child.get(0);
            String status = obj.attributeValue("status");
            String xml = SOAPUtil.post(ORDER_INFO, 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()));
            }
            switch (status)
            {
                case "撤销":
                {
                    re=0;
                    break;
                }
                case "确认":
                {
                    re=1;
                    break;
                }
                case "已诊":
                {
                    re = 2;
                    break;
                }
                case "停诊":
                {
                    re = 3;
                    break;
            Document document = DocumentHelper.parseText(xml);
            Element root = document.getRootElement();
            List<?> child = root.elements();
            if (child != null) {
                Element obj = (Element) child.get(0);
                String status = obj.attributeValue("status");
                switch (status) {
                    case "撤销": {
                        re = 0;
                        break;
                    }
                    case "确认": {
                        re = 1;
                        break;
                    }
                    case "已诊": {
                        re = 2;
                        break;
                    }
                    case "停诊": {
                        re = 3;
                        break;
                    }
                }
            } else {
                throw new Exception("获取预约状态失败!");
            }
            return re;
        }
        else {
            throw new Exception("获取预约状态失败!");
        catch (Exception ex)
        {
            ex.printStackTrace();
        }
        return re;
    }
    /**
@ -804,6 +802,10 @@ public class GuahaoXMService implements IGuahaoService {
    public List<PatientReservation> GetRegList(String patientCode,String strStart,String strEnd) throws Exception
    {
        Patient patient = patientService.findByCode(patientCode);
        if(patient==null){
            throw new Exception("不存在该用户!");
        }
        //获取签名信息
        List<PatientReservation> patientRegList = new ArrayList<>();
        String[] values = SOAPUtil.getCredential(null, true);
@ -845,67 +847,69 @@ public class GuahaoXMService implements IGuahaoService {
        Element root = document.getRootElement();
        List<?> child = root.elements();
        if(patient==null){
            throw new Exception("获取挂号人员信息失败!");
        }
        for (Object o : child) {
            Element e = (Element) o;
            // 医生编码
            String regdate = e.attributeValue("regdate");//预约日期
            String time = e.attributeValue("time");//a or p 上下午
            String regBegin = e.attributeValue("start_time");//预约时间段的开始时间
            String regEnd = e.attributeValue("end_time");//预约时间段的结束时间
            String orgID = e.attributeValue("orgID");//机构ID
            String OrgCode = e.attributeValue("OrgCode");//医疗机构编码
            String org = e.attributeValue("org");//医疗机构名称
            String DeptCode = e.attributeValue("DeptCode");//科室代码
            String dept =e.attributeValue("dept");//科室
            String DoctorCode = e.attributeValue("DoctorCode");//医生代码
            String doctor = e.attributeValue("doctor");//医生
            String Introduction = e.attributeValue("Introduction");//医生简介
            String status = e.attributeValue("status");//状态:删除、新建、确认、已诊
            String enter_time = e.attributeValue("enter_time");//预约登记时间
            String notes = e.attributeValue("notes");//备注
            String code  = e.getText();//预约号
            PatientReservation patientReservation = new PatientReservation();
            patientReservation.setCode(code);
            patientReservation.setSectionType(time);
            patientReservation.setCzrq(dateFormat.parse(enter_time));
            patientReservation.setDeptCode(DeptCode);
            patientReservation.setDeptName(dept);
            patientReservation.setDoctorCode(DoctorCode);
            patientReservation.setDoctorName(doctor);
            patientReservation.setStartTime(regBegin);
            patientReservation.setEndTime(regEnd);
            patientReservation.setOrgCode(OrgCode);
            patientReservation.setOrgName(org);
            patientReservation.setType("1");
            patientReservation.setPatient(patient.getCode());
            patientReservation.setName(patient.getName());
            patientReservation.setIdcard(patient.getIdcard());
            patientReservation.setPhone(patient.getMobile());
            switch (status){
                case "删除":
                    patientReservation.setStatus(0);
                    break;
                case "新建":
                    patientReservation.setStatus(1);
                    break;
                case "确认":
                    patientReservation.setStatus(2);
                    break;
                case "已诊":
                    patientReservation.setStatus(3);
                    break;
                default:patientReservation.setStatus(4);
            };
            patientReservation.setSsc(patient.getSsc());
            GuahaoDoctor guahaoDoctor = GetDoctorInfo(DoctorCode, OrgCode, DeptCode);
            patientReservation.setDoctorPhoto(guahaoDoctor.getPhoto());//照片
            patientReservation.setDoctorJob(guahaoDoctor.getTitle());//职称
            patientRegList.add(patientReservation);
        if(child.size()>0) {
            for (Object o : child) {
                Element e = (Element) o;
                // 医生编码
                String regdate = e.attributeValue("regdate");//预约日期
                String time = e.attributeValue("time");//a or p 上下午
                String regBegin = e.attributeValue("start_time");//预约时间段的开始时间
                String regEnd = e.attributeValue("end_time");//预约时间段的结束时间
                String orgID = e.attributeValue("orgID");//机构ID
                String OrgCode = e.attributeValue("OrgCode");//医疗机构编码
                String org = e.attributeValue("org");//医疗机构名称
                String DeptCode = e.attributeValue("DeptCode");//科室代码
                String dept = e.attributeValue("dept");//科室
                String DoctorCode = e.attributeValue("DoctorCode");//医生代码
                String doctor = e.attributeValue("doctor");//医生
                String Introduction = e.attributeValue("Introduction");//医生简介
                String status = e.attributeValue("status");//状态:删除、新建、确认、已诊
                String enter_time = e.attributeValue("enter_time");//预约登记时间
                String notes = e.attributeValue("notes");//备注
                String code = e.getText();//预约号
                PatientReservation patientReservation = new PatientReservation();
                patientReservation.setCode(code);
                patientReservation.setSectionType(time);
                patientReservation.setCzrq(dateFormat.parse(enter_time));
                patientReservation.setDeptCode(DeptCode);
                patientReservation.setDeptName(dept);
                patientReservation.setDoctorCode(DoctorCode);
                patientReservation.setDoctorName(doctor);
                patientReservation.setStartTime(regBegin);
                patientReservation.setEndTime(regEnd);
                patientReservation.setOrgCode(OrgCode);
                patientReservation.setOrgName(org);
                patientReservation.setType("1");
                patientReservation.setPatient(patientCode);
                patientReservation.setName(patient.getName());
                patientReservation.setIdcard(patient.getIdcard());
                patientReservation.setPhone(patient.getMobile());
                switch (status) {
                    case "删除":
                        patientReservation.setStatus(0);
                        break;
                    case "新建":
                        patientReservation.setStatus(1);
                        break;
                    case "确认":
                        patientReservation.setStatus(2);
                        break;
                    case "已诊":
                        patientReservation.setStatus(3);
                        break;
                    default:
                        patientReservation.setStatus(4);
                }
                ;
                patientReservation.setSsc(patient.getSsc());
                GuahaoDoctor guahaoDoctor = GetDoctorInfo(DoctorCode, OrgCode, DeptCode);
                patientReservation.setDoctorPhoto(guahaoDoctor.getPhoto());//照片
                patientReservation.setDoctorJob(guahaoDoctor.getTitle());//职称
                patientRegList.add(patientReservation);
            }
        }
        return patientRegList;
    }
@ -960,6 +964,9 @@ public class GuahaoXMService implements IGuahaoService {
        if(patient==null){
            throw new Exception("获取挂号人员信息失败!");
        }
        if(child.size()>0)
        {
            Element e = (Element) child.get(0);
            // 医生编码
            String regdate = e.attributeValue("regdate");//预约日期
@ -1017,6 +1024,10 @@ public class GuahaoXMService implements IGuahaoService {
            patientReservation.setDoctorPhoto(guahaoDoctor.getPhoto());//照片
            patientReservation.setDoctorJob(guahaoDoctor.getTitle());//职称
            return patientReservation;
        }
        else{
            return null;
        }
    }

+ 40 - 50
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -89,7 +89,7 @@ public class BookingController extends WeixinBaseController {
    }
    /**
     * 获取前三个月时间
     * 获取时间
     */
    private static Date getMonthBefore(Date d, int month) {
        Calendar now = Calendar.getInstance();
@ -404,9 +404,7 @@ public class BookingController extends WeixinBaseController {
        }
    }
    /**
     * 取消挂号单
     */
    @RequestMapping(value = "CancelOrder", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("取消挂号单")
@ -454,7 +452,7 @@ public class BookingController extends WeixinBaseController {
    }
    /********************************************* 医生端查询 **************************************************************************/
    @RequestMapping(value = "GetPatientReservationList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息列表接口-医生端")
@ -474,7 +472,8 @@ public class BookingController extends WeixinBaseController {
                String code = item.getCode();
                if (type.equals("0")) {  //医护网接口
                } else if (type.equals("1"))   //厦门市民健康预约接口
                }
                else if (type.equals("1"))   //厦门市民健康预约接口
                {
                    Integer status = guahaoXM.GetOrderStatus(item.getOrgCode(), code, item.getSsc());
                    //更新状态
@ -537,28 +536,6 @@ public class BookingController extends WeixinBaseController {
    }
    /**
     * 获取患者预约信息列表接口
     */
    @RequestMapping(value = "GetRegList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息列表接口--患者端")
    public String GetRegList(@ApiParam(name = "patient", value = "患者编号", defaultValue = "1")
                             @RequestParam(value = "patient", required = false) String patient) {
        try {
            SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd");
            Date nowDate = new Date();
            Date threeMonthBefore = getMonthBefore(nowDate, 3);
            List<PatientReservation> list = guahaoXM.GetRegList(patient, sm.format(threeMonthBefore), sm.format(nowDate));
            return write(200, "获取患者预约信息列表成功!", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取患者预约信息单条
     */
    @RequestMapping(value = "GetPatientReservation", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息单条-医生端")
@ -596,43 +573,56 @@ public class BookingController extends WeixinBaseController {
        }
    }
    /**
     * 获取患者预约信息单条
     */
    @RequestMapping(value = "GetPatientReservationXm", method = RequestMethod.POST)
    @RequestMapping(value = "CountReservationByDoctorForPatient", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息单条-患者端")
    public String GetPatientReservationXm(@ApiParam(name = "patientCode", value = "患者编号")
                                          @RequestParam(value = "patientCode", required = true) String patientCode,
                                          @ApiParam(name = "orgCode", value = "机构编码")
                                          @RequestParam(value = "orgCode", required = true) String orgCode,
                                          @ApiParam(name = "regCode", value = "挂号单号")
                                          @RequestParam(value = "regCode", required = true) String regCode) {
    @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 {
            PatientReservation obj = guahaoXM.getRegDetail(patientCode, orgCode, regCode);
            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));
            return write(200, "获取患者预约信息列表成功!", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取医生为患者预约的总数
     */
    @RequestMapping(value = "CountReservationByDoctorForPatient", method = RequestMethod.POST)
    @RequestMapping(value = "GetPatientReservationXm", 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) {
    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 {
            Long obj = patientReservationService.countReservationByDoctorForPatient(doctor, patient);
            PatientReservation obj = guahaoXM.getRegDetail(patientCode, orgCode, regCode);
            return write(200, "获取患者预约信息成功!", "data", obj);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
}