Explorar o código

预约列表接口修改

%!s(int64=8) %!d(string=hai) anos
pai
achega
6ab322612a

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

@ -723,8 +723,9 @@ public class GuahaoXMService implements IGuahaoService {
    /**
     * 根据患者医保卡获取近三个月的预约记录
     */
    public List<PatientReservation> GetRegList(String strSSID,String strStart,String strEnd) throws Exception
    public List<PatientReservation> GetRegList(String patientCode,String strStart,String strEnd) throws Exception
    {
        Patient patient = patientService.findByCode(patientCode);
        //获取签名信息
        List<PatientReservation> patientRegList = new ArrayList<>();
        String[] values = SOAPUtil.getCredential(null, true);
@ -732,7 +733,7 @@ public class GuahaoXMService implements IGuahaoService {
        JSONArray params = new JSONArray();
        JSONObject param1 = new JSONObject();
        param1.put("key", "?strSSID");
        param1.put("value", strSSID);
        param1.put("value", patient.getSsc());
        params.put(param1);
        JSONObject param2 = new JSONObject();
        param2.put("key", "?strStart");
@ -761,7 +762,7 @@ public class GuahaoXMService implements IGuahaoService {
        Document document = DocumentHelper.parseText(xml);
        Element root = document.getRootElement();
        List<?> child = root.elements();
        Patient patient = patientService.findBySsc(strSSID);
        if(patient==null){
            throw new Exception("获取挂号人员信息失败!");
        }
@ -818,9 +819,117 @@ public class GuahaoXMService implements IGuahaoService {
                    break;
                default:patientReservation.setStatus(4);
            };
            patientReservation.setSsc(strSSID);
            patientReservation.setSsc(patient.getSsc());
            GuahaoDoctor guahaoDoctor = GetDoctorInfo(DoctorCode, OrgCode, DeptCode);
            patientReservation.setDoctorPhoto(guahaoDoctor.getPhoto());//照片
            patientReservation.setDoctorJob(guahaoDoctor.getTitle());//职称
            patientRegList.add(patientReservation);
        }
        return patientRegList;
    }
    /**
     * 根据患者,预约编号,机构编号获取单条记录预约记录
     */
    public PatientReservation getRegDetail(String patientCode,String orgCode,String regCode) throws Exception
    {
        //获取签名信息
        Patient patient = patientService.findByCode(patientCode);
        StringBuffer sb = new StringBuffer();
        sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
        sb.append("<root>");
        sb.append("<org_code>").append(orgCode).append("</org_code>");
        sb.append("<resid>").append(regCode).append("</resid>");
        sb.append("<ssid>").append(patient.getSsc()).append("</ssid>");
        sb.append("</root>");
        String[] values = SOAPUtil.getCredential(sb.toString(), true);
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        JSONArray params = new JSONArray();
        JSONObject param1 = new JSONObject();
        param1.put("key", "?strCondition");
        param1.put("value", values[0]);
        params.put(param1);
        JSONObject param2 = new JSONObject();
        param2.put("key", "?strCredential");
        param2.put("value", values[1]);
        params.put(param2);
        JSONObject param3 = new JSONObject();
        param3.put("key", "?strKey");
        param3.put("value", values[2]);
        params.put(param3);
        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()));
        }
        Document document = DocumentHelper.parseText(xml);
        Element root = document.getRootElement();
        List<?> child = root.elements();
        if(patient==null){
            throw new Exception("获取挂号人员信息失败!");
        }
            Element e = (Element) child.get(0);
            // 医生编码
            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("org_id");//机构ID
            String OrgCode = e.attributeValue("org_code");//医疗机构编码
            String org = e.attributeValue("org_name");//医疗机构名称
            String DeptCode = e.attributeValue("dept_code");//科室代码
            String dept =e.attributeValue("dept_name");//科室
            String DoctorCode = e.attributeValue("doctor_code");//医生代码
            String doctor = e.attributeValue("doctor_name");//医生
            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());//职称
            return patientReservation;
    }
}

+ 25 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -447,13 +447,13 @@ public class BookingController extends WeixinBaseController {
	@RequestMapping(value = "GetRegList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取患者预约信息列表接口")
	public String GetRegList(@ApiParam(name="strSSID",value="市民卡号",defaultValue = "1")
										@RequestParam(value="strSSID",required = false) String strSSID) {
	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(strSSID,sm.format(threeMonthBefore),sm.format(nowDate));
			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());
@ -471,9 +471,9 @@ public class BookingController extends WeixinBaseController {
	 */
	@RequestMapping(value = "GetPatientReservation",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("获取患者预约信息单条")
	@ApiOperation("获取患者预约信息单条-医生")
	public String GetPatientReservation(@ApiParam(name="orderId",value="订单id",defaultValue = "9")
											@RequestParam(value="orderId",required = true) String orderId) {
										 @RequestParam(value="orderId",required = true) String orderId) {
		try {
			PatientReservation obj =  patientReservationService.findById(orderId);
			if(obj!=null) {
@ -502,4 +502,24 @@ public class BookingController extends WeixinBaseController {
			return error(-1,e.getMessage());
		}
	}
	/**
	 * 获取患者预约信息单条
	 */
	@RequestMapping(value = "GetPatientReservationXm",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) {
		try {
			PatientReservation obj =  guahaoXM.getRegDetail(patientCode,orgCode,regCode);
			return write(200, "获取患者预约信息成功!", "data", obj);
		} catch (Exception e) {
			return error(-1,e.getMessage());
		}
	}
}