|
@ -1,15 +1,19 @@
|
|
|
package com.yihu.wlyy.web.doctor.sign;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
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.domain.Page;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@ -23,7 +27,7 @@ import com.yihu.wlyy.web.BaseController;
|
|
|
|
|
|
/**
|
|
|
* 医生端:签约管理控制类
|
|
|
*
|
|
|
*
|
|
|
* @author AndyTsai
|
|
|
*/
|
|
|
|
|
@ -32,22 +36,26 @@ import com.yihu.wlyy.web.BaseController;
|
|
|
@Api(description = "医生端-签约管理")
|
|
|
public class DoctorSignController extends BaseController {
|
|
|
|
|
|
// @Autowired
|
|
|
// @Autowired
|
|
|
// private SignContractService signContractService;
|
|
|
@Autowired
|
|
|
private PatientInfoService patientInfoService;
|
|
|
@Autowired
|
|
|
private SignWebService signWebService;
|
|
|
|
|
|
@Autowired
|
|
|
private DoctorInfoService infoService;
|
|
|
/**
|
|
|
* 三师签约列表查询
|
|
|
* @param type 类型:1已签约,2未过期
|
|
|
* @param id
|
|
|
* @param pagesize
|
|
|
* @return
|
|
|
*/
|
|
|
@Autowired
|
|
|
private PatientInfoService patientInfoService;
|
|
|
@Autowired
|
|
|
private SignWebService signWebService;
|
|
|
|
|
|
@Autowired
|
|
|
private DoctorInfoService infoService;
|
|
|
@Autowired
|
|
|
StringRedisTemplate redisTemplate;
|
|
|
|
|
|
/**
|
|
|
* 三师签约列表查询
|
|
|
*
|
|
|
* @param type 类型:1已签约,2未过期
|
|
|
* @param id
|
|
|
* @param pagesize
|
|
|
* @return
|
|
|
*/
|
|
|
// @RequestMapping(value = "list")
|
|
|
// @ResponseBody
|
|
|
// public String list( int type, long id, int pagesize, @RequestParam(required=false) String patientName) {
|
|
@ -90,180 +98,191 @@ public class DoctorSignController extends BaseController {
|
|
|
// return error(-1, "查询失败!");
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "list")
|
|
|
@ResponseBody
|
|
|
public String list( int type, long id, int pagesize, @RequestParam(required=false) String patientName) {
|
|
|
try {
|
|
|
String doctor=getUID();
|
|
|
Page<Object> page = infoService.findPatientByDoctorSign(doctor, id, pagesize,patientName);
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (page != null) {
|
|
|
for (Object obj : page) {
|
|
|
Object[] temp = (Object[]) obj;
|
|
|
if (temp == null ) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", temp[1]);
|
|
|
|
|
|
// 患者姓名
|
|
|
json.put("name", temp[2]);
|
|
|
// 患者头像
|
|
|
json.put("photo", temp[3]);
|
|
|
// 省名称
|
|
|
json.put("provinceName", temp[4]);
|
|
|
// 城市名称
|
|
|
json.put("cityName", temp[5]);
|
|
|
// 区县名称
|
|
|
json.put("townName", temp[6]);
|
|
|
// 详细地址
|
|
|
json.put("address", temp[7]);
|
|
|
// 签约日期
|
|
|
json.put("qyrq", DateUtil.dateToStrShort((Date) temp[8]));
|
|
|
//患者标识
|
|
|
json.put("code", temp[9]);
|
|
|
//患者联系方式
|
|
|
json.put("mobile", temp[10]);
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "list")
|
|
|
@ResponseBody
|
|
|
public String list(int type, long id, int pagesize, @RequestParam(required = false) String patientName) {
|
|
|
try {
|
|
|
String doctor = getUID();
|
|
|
Page<Object> page = infoService.findPatientByDoctorSign(doctor, id, pagesize, patientName);
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (page != null) {
|
|
|
for (Object obj : page) {
|
|
|
Object[] temp = (Object[]) obj;
|
|
|
if (temp == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", temp[1]);
|
|
|
|
|
|
// 患者姓名
|
|
|
json.put("name", temp[2]);
|
|
|
// 患者头像
|
|
|
json.put("photo", temp[3]);
|
|
|
// 省名称
|
|
|
json.put("provinceName", temp[4]);
|
|
|
// 城市名称
|
|
|
json.put("cityName", temp[5]);
|
|
|
// 区县名称
|
|
|
json.put("townName", temp[6]);
|
|
|
// 详细地址
|
|
|
json.put("address", temp[7]);
|
|
|
// 签约日期
|
|
|
json.put("qyrq", DateUtil.dateToStrShort((Date) temp[8]));
|
|
|
//患者标识
|
|
|
json.put("code", temp[9]);
|
|
|
//患者联系方式
|
|
|
json.put("mobile", temp[10]);
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 患者信息查询
|
|
|
*
|
|
|
* @param patient 患者标识
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "patient")
|
|
|
@ResponseBody
|
|
|
public String patient(String patient) {
|
|
|
try {
|
|
|
Patient temp = patientInfoService.findByCode(patient);
|
|
|
if (temp != null) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
// 设置患者姓名
|
|
|
json.put("name", temp.getName());
|
|
|
// 设置患者头像
|
|
|
json.put("photo", CommonUtil.getPhoneUrl(temp.getPhoto()));
|
|
|
// 设置患者年龄
|
|
|
json.put("age", DateUtil.getAgeByBirthday(temp.getBirthday()));
|
|
|
// 设置患者性别
|
|
|
json.put("sex", temp.getSex());
|
|
|
// 设置手机号码
|
|
|
//CommonUtil.getMobileEncode(temp.getMobile())
|
|
|
json.put("mobile", temp.getMobile());
|
|
|
// 设置身份证号
|
|
|
json.put("idcard", CommonUtil.getIdcardEncode(temp.getIdcard()));
|
|
|
// 设置社保卡号
|
|
|
json.put("ssc", temp.getSsc());
|
|
|
// 设置省名称
|
|
|
json.put("province", temp.getProvinceName());
|
|
|
// 设置市名称
|
|
|
json.put("city", temp.getCityName());
|
|
|
// 设置区县名称
|
|
|
json.put("area", temp.getTownName());
|
|
|
// 设置街道
|
|
|
json.put("street", temp.getStreet());
|
|
|
// 设置街道名称
|
|
|
json.put("streetName", temp.getStreetName());
|
|
|
// 设置地址
|
|
|
json.put("address", temp.getAddress());
|
|
|
return write(200, "患者信息查询成功!", "data", json);
|
|
|
} else {
|
|
|
return error(-1, "患者信息查询失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "患者信息查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取签约患者信息
|
|
|
*
|
|
|
* @param status 签约状态 1:待签约 2, 待解约 3 已签约,4已经解约
|
|
|
* @param doctorType 医生类别 健管 3 全科 2
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/sign_info")
|
|
|
public String getSignInfoByDoctor(
|
|
|
int status,
|
|
|
int doctorType,
|
|
|
int page,
|
|
|
int pageSize) {
|
|
|
try {
|
|
|
List<Map<String, Object>> listSign = signWebService.getSignWebByDoctor(getUID(), status, doctorType);
|
|
|
List<Map<String, Object>> listSub = new ArrayList<>();
|
|
|
int totalPage = 0;
|
|
|
int start = (page - 1) * pageSize;
|
|
|
int end = (page - 1) * pageSize + pageSize;
|
|
|
|
|
|
if (listSign != null) {
|
|
|
totalPage = listSign.size() % pageSize > 0 ? (listSign.size() / pageSize + 1) : listSign.size() / pageSize;
|
|
|
if (end < listSign.size()) {
|
|
|
listSub = listSign.subList(start, end);
|
|
|
} else if (start < listSign.size() && end >= listSign.size()) {
|
|
|
listSub = listSign.subList(start, listSign.size());
|
|
|
}
|
|
|
}
|
|
|
JSONObject data = new JSONObject();
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
if (listSub != null) {
|
|
|
for (Map<String, Object> temp : listSub) {
|
|
|
if (temp == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("code", temp.get("code"));
|
|
|
json.put("doctorCode", temp.get("doctor"));
|
|
|
json.put("patientCode", temp.get("patient"));
|
|
|
json.put("patientName", temp.get("name"));
|
|
|
json.put("provinceName", temp.get("provinceName"));
|
|
|
json.put("cityName", temp.get("cityName"));
|
|
|
json.put("townName", temp.get("townName"));
|
|
|
json.put("address", temp.get("address"));
|
|
|
json.put("photo", temp.get("photo"));
|
|
|
json.put("status", temp.get("status"));
|
|
|
String statusName = "";
|
|
|
switch (Integer.parseInt(temp.get("status").toString())) {
|
|
|
case 0:
|
|
|
statusName = "待签约";
|
|
|
break;
|
|
|
case 1:
|
|
|
statusName = "已签约";
|
|
|
break;
|
|
|
case 2:
|
|
|
statusName = "待解约";
|
|
|
break;
|
|
|
case -3:
|
|
|
case -4:
|
|
|
statusName = "已解约";
|
|
|
break;
|
|
|
|
|
|
/**
|
|
|
* 患者信息查询
|
|
|
* @param patient 患者标识
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "patient")
|
|
|
@ResponseBody
|
|
|
public String patient(String patient) {
|
|
|
try {
|
|
|
Patient temp = patientInfoService.findByCode(patient);
|
|
|
if (temp != null) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
// 设置患者姓名
|
|
|
json.put("name", temp.getName());
|
|
|
// 设置患者头像
|
|
|
json.put("photo", CommonUtil.getPhoneUrl(temp.getPhoto()));
|
|
|
// 设置患者年龄
|
|
|
json.put("age", DateUtil.getAgeByBirthday(temp.getBirthday()));
|
|
|
// 设置患者性别
|
|
|
json.put("sex", temp.getSex());
|
|
|
// 设置手机号码
|
|
|
//CommonUtil.getMobileEncode(temp.getMobile())
|
|
|
json.put("mobile",temp.getMobile());
|
|
|
// 设置身份证号
|
|
|
json.put("idcard", CommonUtil.getIdcardEncode(temp.getIdcard()));
|
|
|
// 设置社保卡号
|
|
|
json.put("ssc", temp.getSsc());
|
|
|
// 设置省名称
|
|
|
json.put("province", temp.getProvinceName());
|
|
|
// 设置市名称
|
|
|
json.put("city", temp.getCityName());
|
|
|
// 设置区县名称
|
|
|
json.put("area", temp.getTownName());
|
|
|
// 设置街道
|
|
|
json.put("street", temp.getStreet());
|
|
|
// 设置街道名称
|
|
|
json.put("streetName", temp.getStreetName());
|
|
|
// 设置地址
|
|
|
json.put("address", temp.getAddress());
|
|
|
return write(200, "患者信息查询成功!", "data", json);
|
|
|
} else {
|
|
|
return error(-1, "患者信息查询失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "患者信息查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取签约患者信息
|
|
|
* @param status 签约状态 1:待签约 2, 待解约 3 已签约,4已经解约
|
|
|
* @param doctorType 医生类别 健管 3 全科 2
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/sign_info")
|
|
|
public String getSignInfoByDoctor(
|
|
|
int status,
|
|
|
int doctorType,
|
|
|
int page,
|
|
|
int pageSize) {
|
|
|
try{
|
|
|
List<Map<String,Object>> listSign = signWebService.getSignWebByDoctor(getUID(), status, doctorType);
|
|
|
List<Map<String,Object>> listSub = new ArrayList<>();
|
|
|
int totalPage = 0;
|
|
|
int start = (page - 1)*pageSize;
|
|
|
int end = (page - 1)*pageSize + pageSize;
|
|
|
}
|
|
|
json.put("statusName", statusName);
|
|
|
json.put("id", temp.get("id"));
|
|
|
json.put("applyDate", DateUtil.dateToStrShort((Date) temp.get("applyDate")));
|
|
|
json.put("releaseSpeak", temp.get("reason"));
|
|
|
json.put("streetName", temp.get("streetName"));
|
|
|
json.put("sex", temp.get("sex"));
|
|
|
if (status == 5) {
|
|
|
String epTime = redisTemplate.opsForValue().get("expenses:remind:" + temp.get("patient"));
|
|
|
|
|
|
if(listSign != null){
|
|
|
totalPage = listSign.size() % pageSize > 0 ? (listSign.size() / pageSize + 1) : listSign.size() / pageSize;
|
|
|
if(end < listSign.size()){
|
|
|
listSub = listSign.subList(start,end);
|
|
|
}else if(start < listSign.size() && end >= listSign.size()){
|
|
|
listSub = listSign.subList(start,listSign.size());
|
|
|
}
|
|
|
}
|
|
|
JSONObject data = new JSONObject();
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if (listSub != null) {
|
|
|
for (Map<String,Object> temp : listSub) {
|
|
|
if (temp == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("code", temp.get("code"));
|
|
|
json.put("doctorCode",temp.get("doctor"));
|
|
|
json.put("patientCode", temp.get("patient"));
|
|
|
json.put("patientName", temp.get("name"));
|
|
|
json.put("provinceName", temp.get("provinceName"));
|
|
|
json.put("cityName", temp.get("cityName"));
|
|
|
json.put("townName", temp.get("townName"));
|
|
|
json.put("address", temp.get("address"));
|
|
|
json.put("photo", temp.get("photo"));
|
|
|
json.put("status", temp.get("status"));
|
|
|
String statusName="";
|
|
|
switch(Integer.parseInt(temp.get("status").toString()))
|
|
|
{
|
|
|
case 0:statusName="待签约";
|
|
|
break;
|
|
|
case 1:statusName="已签约";
|
|
|
break;
|
|
|
case 2:statusName="待解约";
|
|
|
break;
|
|
|
case -3:
|
|
|
case -4: statusName="已解约";
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
json.put("statusName", statusName);
|
|
|
json.put("id", temp.get("id"));
|
|
|
json.put("applyDate", DateUtil.dateToStrShort((Date) temp.get("applyDate")));
|
|
|
json.put("releaseSpeak", temp.get("reason"));
|
|
|
json.put("streetName", temp.get("streetName"));
|
|
|
json.put("sex", temp.get("sex"));
|
|
|
jsonArray.put(json);
|
|
|
}
|
|
|
}
|
|
|
data.put("list",jsonArray );
|
|
|
data.put("totalPage", totalPage);
|
|
|
data.put("page", page);
|
|
|
return write(200, "查询成功!", "data", data);
|
|
|
}
|
|
|
catch(Exception ex)
|
|
|
{
|
|
|
ex.printStackTrace();
|
|
|
return error(-1,"系统错误,请联系管理员!");
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isEmpty(epTime)) {
|
|
|
json.put("expensesRemindStatus", 0);
|
|
|
} else {
|
|
|
json.put("expensesRemindStatus", df.format(new Date()).equals(epTime) ? 1 : 0);
|
|
|
}
|
|
|
}
|
|
|
jsonArray.put(json);
|
|
|
}
|
|
|
}
|
|
|
data.put("list", jsonArray);
|
|
|
data.put("totalPage", totalPage);
|
|
|
data.put("page", page);
|
|
|
return write(200, "查询成功!", "data", data);
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
return error(-1, "系统错误,请联系管理员!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|