Selaa lähdekoodia

新增医生端获取病人信息接口,及转诊预约号源开发

8 vuotta sitten
vanhempi
commit
58f3fad073

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

@ -1,11 +1,20 @@
package com.yihu.wlyy.web.common.util;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.SOAPUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.parser.JSONParser;
import net.sf.json.JSON;
import net.sf.json.util.JSONUtils;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -13,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * Created by lyr on 2016/9/29.
 */
@ -179,4 +191,108 @@ public class WlyySerivceController extends BaseController{
        }
    }
    /**
     * 转诊预约医生特殊号源获取
     * @param OrgCode 医院编号
     * @param DeptCode 科室编号
     * @param strStart 开始时间
     * @param strEnd 结束时间
     * @param DocCode 医生编号
     * @return
     */
    @RequestMapping(value = "/third/smjk/RegDeptSpeDoctorSectionList",method = RequestMethod.POST)
    @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 checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String param = "?OrgCode="+OrgCode+"&DeptCode="+DeptCode+"&strStart="+strStart+"&strEnd="+strEnd+"&DocCode="+DocCode;
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/smjk/RegDeptSpeDoctorSectionList"+param,"" );
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"医生排班时间获取失败");
            }else{
                JSONObject myJsonObject = new JSONObject(jsonString);
                return write(200,"医生排班时间获取成功","data",parseXmlForSpe(myJsonObject.get("data").toString()));
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"医生排班时间获取失败");
        }
    }
    /**
     * 转诊预约医生号源转换
     * @param xml
     * @return
     */
    private List<Map<String,Object>>  parseXmlForSpe(String xml) {
            List<Map<String,Object>> re = new ArrayList<>();
            Document document = null;
            try{
                 document = DocumentHelper.parseText(xml);
             }catch (Exception e){
                throw new RuntimeException("解析数据失败!");
            }
            Element root = document.getRootElement();
            List<?> child = root.elements();//取出root的子集合
            for (Object o : child) {
                List<?> dataList = ((Element) o).elements();
                for(Object dataElement:dataList) {
                    Element e = (Element) dataElement;
                    // 日期
                    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;
        }
        public static Date getDateAfter(Date d, int day) {
            Calendar now = Calendar.getInstance();
            now.setTime(d);
            now.set(Calendar.DATE, now.get(Calendar.DATE) + day);
            return now.getTime();
      }
}

+ 61 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -0,0 +1,61 @@
package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroup;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.account.DoctorPatientGroupService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * 医生端:患者分组管理
 *
 * @author George
 */
@Controller
@RequestMapping(value = "/doctor/patient", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-患者信息")
public class PatientInfoController extends BaseController {
    @Autowired
    private PatientInfoService patientInfoService;
    /**
     * 获取患者基本信息
     *
     * @return
     */
    @RequestMapping(value = "info")
    @ResponseBody
    public String getPatient(String patient) {
        try {
            // 获取医生下的患者
            Patient temp = patientInfoService.findByCode(patient);
            return write(200, "获取患者信息成功!", "data", temp);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取患者信息失败!");
        }
    }
}