Procházet zdrojové kódy

Merge branch 'dev' of zlf/patient-co-management into dev

zlf před 8 roky
rodič
revize
a75d8909c1

+ 53 - 53
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -23,59 +23,59 @@ public class DoctorInterceptor extends BaseInterceptor {
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		boolean flag = true;
		try {
			response.setCharacterEncoding("UTF-8");
			JSONObject json = getAgent(request);
			if (json == null) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				return false;
			}
			String tokenStr = json.has("token") ? json.getString("token") : "";
			String uid = json.has("uid") ? json.getString("uid") : "";
			String imei = json.has("imei") ? json.getString("imei") : "";
			if (StringUtils.isEmpty(tokenStr) || StringUtils.isEmpty(imei) || StringUtils.isEmpty(uid)) {
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				return false;
			}
			Token token = SystemData.doctorTokens.get(uid);
			if (token == null) {
				token = tokenDao.findByPatient(uid, 2);
				if (token != null) {
					// 加入缓存
					SystemData.doctorTokens.put(uid, token);
				}
			}
			if (token == null || token.getPlatform() != 2) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				flag = false;
			} else {
				if (token.getTimeout().getTime() < new Date().getTime()) {
					// 登录超时
					response.getOutputStream().write(error(SystemConf.LOGIN_TIMEOUT, "登录超时,请重新登录").getBytes());
					flag = false;
				} else if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(uid, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
					// 别处登录
					response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
					flag = false;
				} else {
					// 一天只更新一次
					if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
						// 今天未更新,则更新缓存
						token.setCzrq(new Date());
						// 更新内存
						SystemData.doctorTokens.put(uid, token);
						// 更新数据库
						tokenDao.save(token);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
//		try {
//			response.setCharacterEncoding("UTF-8");
//			JSONObject json = getAgent(request);
//			if (json == null) {
//				// 未登录
//				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//				return false;
//			}
//			String tokenStr = json.has("token") ? json.getString("token") : "";
//			String uid = json.has("uid") ? json.getString("uid") : "";
//			String imei = json.has("imei") ? json.getString("imei") : "";
//
//			if (StringUtils.isEmpty(tokenStr) || StringUtils.isEmpty(imei) || StringUtils.isEmpty(uid)) {
//				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//				return false;
//			}
//
//			Token token = SystemData.doctorTokens.get(uid);
//			if (token == null) {
//				token = tokenDao.findByPatient(uid, 2);
//				if (token != null) {
//					// 加入缓存
//					SystemData.doctorTokens.put(uid, token);
//				}
//			}
//			if (token == null || token.getPlatform() != 2) {
//				// 未登录
//				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//				flag = false;
//			} else {
//				if (token.getTimeout().getTime() < new Date().getTime()) {
//					// 登录超时
//					response.getOutputStream().write(error(SystemConf.LOGIN_TIMEOUT, "登录超时,请重新登录").getBytes());
//					flag = false;
//				} else if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(uid, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
//					// 别处登录
//					response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
//					flag = false;
//				} else {
//					// 一天只更新一次
//					if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
//						// 今天未更新,则更新缓存
//						token.setCzrq(new Date());
//						// 更新内存
//						SystemData.doctorTokens.put(uid, token);
//						// 更新数据库
//						tokenDao.save(token);
//					}
//				}
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
		return flag;
	}

+ 54 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/DrugService.java

@ -0,0 +1,54 @@
package com.yihu.wlyy.service.app.record;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
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.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class DrugService extends BaseService {
    /**
     * 获取用药记录
     */
    public String getDrugsList(String strSSID,String startDate,String endDate,String startNum,String endNum) throws Exception {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/DrugsList";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSSID", strSSID));
        params.add(new BasicNameValuePair("startDate", startDate));
        params.add(new BasicNameValuePair("endDate", endDate));
        params.add(new BasicNameValuePair("startNum", startNum));
        params.add(new BasicNameValuePair("endNum", endNum));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray result = new JSONArray();
        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)){
                    JSONObject jsonData = new JSONObject(data);
                    result = jsonData.getJSONArray("EhrList");
                }
            }
        }
        return result.toString();
    }
}

+ 52 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/HealthDataService.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.service.app.record;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
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.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class HealthDataService extends BaseService {
    /**
     * 获取健康档案信息
     */
    public String getHealthData(String strSSID, String strEvent, String strCatalog, String strSerial) throws Exception {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/HealthData";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSSID", strSSID));
        params.add(new BasicNameValuePair("strEvent", strEvent));
        params.add(new BasicNameValuePair("strCatalog", strCatalog));
        params.add(new BasicNameValuePair("strSerial", strSerial));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray result = new JSONArray();
        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)){
                    JSONObject jsonData = new JSONObject(data);
                    result = jsonData.getJSONArray("EhrList");
                }
            }
        }
        return result.toString();
    }
}

+ 20 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/HospitalizationService.java

@ -3,8 +3,11 @@ package com.yihu.wlyy.service.app.record;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
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.stereotype.Service;
import java.util.ArrayList;
@ -17,7 +20,7 @@ import java.util.List;
public class HospitalizationService extends BaseService {
    /**
     * 获取健康档案信息
     * 获取住院记录
     */
    public String getHospitalizationRecord(String strSSID, String startDate, String endDate, String startNum, String endNum) throws Exception {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
@ -30,7 +33,21 @@ public class HospitalizationService extends BaseService {
        params.add(new BasicNameValuePair("startNum", startNum));
        params.add(new BasicNameValuePair("endNum", endNum));
        String result = HttpClientUtil.post(url, params, "UTF-8");
        return result;
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray result = new JSONArray();
        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)){
                    JSONObject jsonData = new JSONObject(data);
                    result = jsonData.getJSONArray("EhrList");
                }
            }
        }
        return result.toString();
    }
}

+ 65 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/OutpatientService.java

@ -1,23 +1,40 @@
package com.yihu.wlyy.service.app.record;
import com.google.common.annotations.VisibleForTesting;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
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.Service;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class OutpatientService extends BaseService {
    public String getOutpatientRecord(String strSSID, String startDate, String endDate, String startNum, String endNum) {
    @Autowired
    SystemDictService systemDictService;
    /**
     * 获取门/急诊记录
     */
    public String getOutpatientRecord(String strSSID, String startNum, String endNum) {
        String startDate = "1900-01-01";
        String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/OutpatientRecord";
@ -28,7 +45,51 @@ public class OutpatientService extends BaseService {
        params.add(new BasicNameValuePair("startNum", startNum));
        params.add(new BasicNameValuePair("endNum", endNum));
        String result = HttpClientUtil.post(url, params, "UTF-8");
        return result;
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray resultArray = new JSONArray();
        List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
        Map<String, String> systemDictMap = new HashMap<>();
        for (SystemDict systemDict : systemDictList) {
            systemDictMap.put(systemDict.getCode(), systemDict.getValue());
        }
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            if (status == 200){
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data)){
                    JSONObject jsonData = new JSONObject(data);
                    JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                    if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                        Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                        for (int i=0; i<jsonArray.length(); i++) {
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            String patientId = jsonObject.getString("XMAN_ID");
                            String eventNo = jsonObject.getString("EVENT");
                            Integer orgId = jsonObject.getInt("ORG_ID");
                            String key = patientId + eventNo + orgId;
                            JSONObject catalogObject = new JSONObject();
                            String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                            String catalogValue = systemDictMap.get(catalogCode);
                            jsonObject.remove("CATALOG_CODE");
                            if (jsonObjectMap.containsKey(key)) {
                                jsonObject = jsonObjectMap.get(key);
                                catalogObject = jsonObject.getJSONObject("CATALOG");
                            }
                            catalogObject.put(catalogCode, catalogValue);
                            jsonObject.put("CATALOG", catalogObject);
                            jsonObjectMap.put(key, jsonObject);
                        }
                        for (String key : jsonObjectMap.keySet()) {
                            resultArray.put(jsonObjectMap.get(key));
                        }
                    }
                }
            }
        }
        return resultArray.toString();
    }
}

+ 56 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/RegDeptSpeDoctorService.java

@ -0,0 +1,56 @@
package com.yihu.wlyy.service.app.record;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
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.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class RegDeptSpeDoctorService extends BaseService {
    /**
     * 获取转诊预约医生号源信息
     */
    public String getRegDeptSpeDoctorSectionList(String OrgCode,String DeptCode,String strStart,String strEnd,String DocCode)  throws Exception
    {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/RegDeptSpeDoctorSectionList";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("OrgCode", OrgCode));
        params.add(new BasicNameValuePair("DeptCode", DeptCode));
        params.add(new BasicNameValuePair("strStart", strStart));
        params.add(new BasicNameValuePair("strEnd", strEnd));
        params.add(new BasicNameValuePair("DocCode", DocCode));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray result = new JSONArray();
        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)){
                    JSONObject jsonData = new JSONObject(data);
                    result = jsonData.getJSONArray("EhrList");
                }
            }
        }
        return result.toString();
    }
}

+ 53 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/DrugController.java

@ -0,0 +1,53 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.DrugService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/doctor/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-健康档案用药记录")
public class DrugController extends BaseController {
    @Autowired
    private DrugService drugService;
    /**
     * 获取用药记录
     *
     * @return
     */
    @RequestMapping(value = "/drug", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取用药记录")
    public String getDrugsList(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                               @RequestParam(value="strSSID",required = true) String strSSID,
                               @ApiParam(name="startDate",value="查询的开始日期",defaultValue = "2015-01-01")
                               @RequestParam(value="startDate",required = true) String startDate,
                               @ApiParam(name="endDate",value="查询的结束日期",defaultValue = "2016-10-01")
                               @RequestParam(value="endDate",required = true) String endDate,
                               @ApiParam(name="startNum",value="需要获取的起始行数",defaultValue = "0")
                               @RequestParam(value="startNum",required = true) String startNum,
                               @ApiParam(name="endNum",value="需要获取的结束的行数",defaultValue = "10")
                               @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String data = drugService.getDrugsList(strSSID, startDate, endDate, startNum, endNum);
            return write(200, "获取用药记录成功!", "data", data);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取用药记录失败!");
        }
    }
}

+ 52 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/HealthDataController.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.HealthDataService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/doctor/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-健康档案信息")
public class HealthDataController extends BaseController {
    @Autowired
    private HealthDataService healthDataService;
    /**
     * 获取门/急诊数据
     *
     * @return
     */
    @RequestMapping(value = "/healthData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取健康档案信息")
    public String getHealthData(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                                @RequestParam(value="strSSID",required = true) String strSSID,
                                @ApiParam(name="strEvent",value="事件ID",defaultValue = "")
                                @RequestParam(value="strEvent",required = true) String strEvent,
                                @ApiParam(name="strCatalog",value="档案类型",defaultValue = "")
                                @RequestParam(value="strCatalog",required = true) String strCatalog,
                                @ApiParam(name="strSerial",value="该类别顺序号,默认填1",defaultValue = "1")
                                @RequestParam(value="strSerial",required = true) String strSerial) {
        try {
            String data = healthDataService.getHealthData(strSSID, strEvent, strCatalog, strSerial);
            return write(200, "获取健康档案信息成功!", "data", data);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取健康档案信息失败!");
        }
    }
}

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/HospitalizationController.java

@ -32,7 +32,7 @@ public class HospitalizationController extends BaseController {
    @RequestMapping(value = "/hospitalization", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取住院记录")
    public String getHospitalizationRecord(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "D56668987")
    public String getHospitalizationRecord(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                                     @RequestParam(value="strSSID",required = true) String strSSID,
                                     @ApiParam(name="startDate",value="查询的开始日期",defaultValue = "2015-01-01")
                                     @RequestParam(value="startDate",required = true) String startDate,
@ -48,7 +48,7 @@ public class HospitalizationController extends BaseController {
            return write(200, "获取住院记录成功!", "data", data);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取住院记录成功!");
            return invalidUserException(e, -1, "获取住院记录失败!");
        }
    }
}

+ 7 - 13
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/OutpatientController.java

@ -31,20 +31,14 @@ public class OutpatientController extends BaseController {
    @ApiOperation("获取门/急诊数据")
    @RequestMapping(value = "/outpatient", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String getOutpatientRecord(
                    @ApiParam(name="strSSID", value="健康卡号")
                    @RequestParam(value = "strSSID") String strSSID,
                    @ApiParam(name="startDate", value="查询的开始日期")
                    @RequestParam(value = "startDate") String startDate,
                    @ApiParam(name="endDate", value="查询的结束日期")
                    @RequestParam(value = "endDate") String endDate,
                    @ApiParam(name="startNum", value="需要获取的起始行数")
                    @RequestParam(value = "startNum") String startNum,
                    @ApiParam(name="endNum", value="需要获取的结束的行数")
                    @RequestParam(value = "endNum") String endNum) {
    public String getOutpatientRecord(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "B09036263193")
                      @RequestParam(value="strSSID",required = true) String strSSID,
                      @ApiParam(name="startNum",value="需要获取的起始行数",defaultValue = "0")
                      @RequestParam(value="startNum",required = true) String startNum,
                      @ApiParam(name="endNum",value="需要获取的结束的行数",defaultValue = "10")
                      @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String result = outpatientService.getOutpatientRecord(strSSID,
                    startDate, endDate, startNum, endNum);
            String result = outpatientService.getOutpatientRecord(strSSID, startNum, endNum);
            return write(200, "获取门/急诊数据成功!", "data", result);
        } catch (Exception e) {
            error(e);

+ 52 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/RegDeptSpeDoctorController.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.RegDeptSpeDoctorService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/doctor/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-获取转诊预约医生号源信息")
public class RegDeptSpeDoctorController extends BaseController {
    @Autowired
    private RegDeptSpeDoctorService regDeptSpeDoctorService;
    /**
     * 获取转诊预约医生号源信息
     *
     * @return
     */
    @ApiOperation("获取转诊预约医生号源信息")
    @RequestMapping(value = "regDeptSpeDoctor", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String getRegDeptSpeDoctorSectionList(@ApiParam(name="OrgCode",value="机构编码",defaultValue = "350211A1001")
                                                 @RequestParam(value="OrgCode",required = true) String OrgCode,
                                                 @ApiParam(name="DeptCode",value="科室编码",defaultValue = "1040610")
                                                 @RequestParam(value="DeptCode",required = true) String DeptCode,
                                                 @ApiParam(name="strStart",value="预约排班开始时间",defaultValue = "2016-10-18")
                                                 @RequestParam(value="strStart",required = true) String strStart,
                                                 @ApiParam(name="strEnd",value="预约排班结束时间",defaultValue = "2016-10-20")
                                                 @RequestParam(value="strEnd",required = true) String strEnd,
                                                 @ApiParam(name="DocCode",value="医生编码",defaultValue = "80772")
                                                 @RequestParam(value="DocCode",required = true) String DocCode) {
        try {
            String data = regDeptSpeDoctorService.getRegDeptSpeDoctorSectionList(OrgCode, DeptCode, strStart, strEnd, DocCode);
            return write(200, "获取转诊预约医生号源信息成功!", "data", data);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取转诊预约医生号源信息失败!");
        }
    }
}