|
@ -1,10 +1,15 @@
|
|
|
package com.yihu.wlyy.web.doctor.concern;
|
|
|
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.service.app.concern.ConcernService;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@ -12,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* Created by Administrator on 2018/4/4 0004.
|
|
|
*/
|
|
@ -23,15 +30,58 @@ public class DoctorConcernController extends BaseController {
|
|
|
private ConcernService concernService;
|
|
|
|
|
|
@RequestMapping(value = "/getConcernPatients", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "获取医生关注的患者1", notes = "")
|
|
|
@ApiOperation(value = "获取医生关注的患者", notes = "", response = Patient.class)
|
|
|
public String getConcernDoctors(
|
|
|
@ApiParam(name = "doctor", value = "医生",required = false) @RequestParam(required = false, name = "doctor") String doctor
|
|
|
@ApiParam(name = "doctor", value = "医生", required = false) @RequestParam(required = false, name = "doctor") String doctor,
|
|
|
@ApiParam(name = "page", value = "当前页(从0开始)", required = true) @RequestParam(required = true, name = "page") Integer page,
|
|
|
@ApiParam(name = "pageSize", value = "每页显示条数", required = true) @RequestParam(required = true, name = "pageSize") Integer pageSize
|
|
|
|
|
|
) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(doctor)) {
|
|
|
doctor = getUID();
|
|
|
}
|
|
|
JSONArray array = new JSONArray();
|
|
|
List<Patient> patients = concernService.listPatientsByDoctorCode(doctor, page, pageSize);
|
|
|
for (Patient patient : patients) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("code", patient.getCode());
|
|
|
jsonObject.put("name", patient.getName());
|
|
|
jsonObject.put("photo", patient.getPhoto());
|
|
|
jsonObject.put("sex", patient.getSex());
|
|
|
jsonObject.put("age", IdCardUtil.getAgeForIdcard(patient.getIdcard()));
|
|
|
jsonObject.put("isWX", StringUtils.isEmpty(patient.getOpenid()) ? "false" : "true");
|
|
|
jsonObject.put("concernTime", DateUtil.dateToStr(patient.getConcernCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
|
|
|
|
array.add(jsonObject);
|
|
|
}
|
|
|
return write(200, "查询成功", "data", array);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return error(-100, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/getConcernCounts", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "获取医生有效的关注的患者数目和全部的数目", notes = "", response = Patient.class)
|
|
|
public String getConcernCounts(
|
|
|
@ApiParam(name = "doctor", value = "医生", required = false) @RequestParam(required = false, name = "doctor") String doctor
|
|
|
|
|
|
) {
|
|
|
try {
|
|
|
if(StringUtils.isEmpty(doctor)){
|
|
|
doctor=getUID();
|
|
|
if (StringUtils.isEmpty(doctor)) {
|
|
|
doctor = getUID();
|
|
|
}
|
|
|
return write(200,"查询成功","data",concernService.listPatientsByDoctorCode(doctor));
|
|
|
JSONObject jo = new JSONObject();
|
|
|
//获取有效的关注数
|
|
|
Integer countPatientStatus1 = concernService.countPatientsByDoctorCode(doctor);
|
|
|
//获取全部的的关注数
|
|
|
Integer countPatientAll = concernService.countAllPatientsByDoctorCode(doctor);
|
|
|
|
|
|
jo.put("countPatientAll",countPatientAll);
|
|
|
jo.put("countPatientStatus1",countPatientStatus1);
|
|
|
return write(200, "查询成功", "data", jo);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return error(-100, "查询失败");
|