|
@ -240,10 +240,11 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
* @param labelType 标签类型
|
|
|
* @param page 第几页
|
|
|
* @param pagesize 页大小
|
|
|
* @param sortByStandardStatus
|
|
|
* @param isSlowDisease 是否是慢病管理
|
|
|
* @param diseaseCondition
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getPatientByLabel(String doctor, String labelCode, String labelType, Long teamCode, int page, int pagesize, boolean sortByStandardStatus) throws Exception {
|
|
|
public JSONArray getPatientByLabel(String doctor, String labelCode, String labelType, Long teamCode, int page, int pagesize, boolean isSlowDisease, String diseaseCondition) throws Exception {
|
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
|
|
|
|
if (doc == null) {
|
|
@ -310,10 +311,16 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" ) f " +
|
|
|
"WHERE " +
|
|
|
" f. CODE = s.sign_code " +
|
|
|
" AND s.server_type ='"+labelCode+"' " +
|
|
|
" ORDER BY " +
|
|
|
" AND s.server_type ='"+labelCode+"' ";
|
|
|
if(StringUtils.isNotBlank(diseaseCondition)){
|
|
|
sql = sql + " AND p.diseaseCondition = ?";
|
|
|
args = new Object[]{doctor, doctor, teamCode,diseaseCondition};
|
|
|
}else{
|
|
|
args = new Object[]{doctor, doctor, teamCode};
|
|
|
}
|
|
|
|
|
|
sql = sql + " ORDER BY " +
|
|
|
" f.ptOpenid DESC";
|
|
|
args = new Object[]{doctor, doctor, teamCode};
|
|
|
} else {
|
|
|
if (labelCode.equals("0")) {
|
|
|
sql = "SELECT " +
|
|
@ -353,7 +360,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
|
//查询患者设备绑定情况
|
|
|
if(sortByStandardStatus){
|
|
|
if(isSlowDisease){
|
|
|
String _pdsql = "SELECT p.code,(SELECT sum(d.category_code) from wlyy_patient_device d WHERE p.code = d.`user`) device from wlyy_patient p";
|
|
|
patientDeviceTypeMap = jdbcTemplate.queryForMap(_pdsql);
|
|
|
}
|
|
@ -506,7 +513,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
int re = 0;
|
|
|
|
|
|
//是否根据预警字段优先排序
|
|
|
if(sortByStandardStatus){
|
|
|
if(isSlowDisease){
|
|
|
int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
|
|
|
int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
|
|
|
|
|
@ -3552,10 +3559,11 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
* @param page
|
|
|
* @param pagesize
|
|
|
* @param sortByStandardStatus 是否根据预警状态排序,如果true, 需要附带查询患者设备绑定情况
|
|
|
* @param diseaseCondition
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getPatientByTeamCodeExitDoctor(long teamCode, String labelCode, String labelType, int page, int pagesize, boolean sortByStandardStatus) throws Exception {
|
|
|
public JSONArray getPatientByTeamCodeExitDoctor(long teamCode, String labelCode, String labelType, int page, int pagesize, boolean sortByStandardStatus, String diseaseCondition) throws Exception {
|
|
|
|
|
|
Map<String, JSONObject> result = new TreeMap<>();
|
|
|
List<Map<String, Object>> signList = new ArrayList<>();
|
|
@ -3608,14 +3616,21 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" WHERE " +
|
|
|
" p. CODE = t1.patient " +
|
|
|
" AND t1. STATUS > 0 " +
|
|
|
" AND t1.admin_team_code = ?" +
|
|
|
" AND t1.admin_team_code = ?";
|
|
|
if(StringUtils.isNotBlank(diseaseCondition)){
|
|
|
sql = sql + " AND p.diseaseCondition = ?";
|
|
|
args = new Object[]{teamCode,diseaseCondition};
|
|
|
}else{
|
|
|
args = new Object[]{teamCode};
|
|
|
}
|
|
|
sql = sql +
|
|
|
" ) f " +
|
|
|
"WHERE " +
|
|
|
" f. CODE = s.sign_code " +
|
|
|
" AND s.server_type ='"+labelCode+"' " +
|
|
|
" ORDER BY " +
|
|
|
" f.ptOpenid DESC";
|
|
|
args = new Object[]{teamCode};
|
|
|
|
|
|
}else {
|
|
|
if ("0".equals(labelCode)) {
|
|
|
sql = "SELECT " +
|
|
@ -3992,4 +4007,445 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 慢病管理-根据患者姓名或标签名称查询
|
|
|
*
|
|
|
* @param doctor
|
|
|
* @param filter
|
|
|
* @param diseaseCondition
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray searchSlowDiseasePatientByNameOrLabel(String doctor, String filter,
|
|
|
String labelCode, String labelType, long teamCode,
|
|
|
String exLabelCode,
|
|
|
String exLabelType,
|
|
|
int page, int pagesize, String diseaseCondition) throws Exception {
|
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
|
|
|
|
Map<String,Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
|
|
|
|
|
|
if (doc == null) {
|
|
|
throw new Exception("doctor info can not find");
|
|
|
}
|
|
|
|
|
|
Map<String, JSONObject> result = new HashMap<>();
|
|
|
List<Map<String, Object>> signList = new ArrayList<>();
|
|
|
page = page * pagesize;
|
|
|
Object[] args = null;
|
|
|
String sql = "";
|
|
|
//String reg = "(^\\d{15}$)|(^\\d{17}([0-9]|X)$)";
|
|
|
// String reg = "^(\\d+)([0-9]|X|x)$";
|
|
|
// 匹配数字字符串
|
|
|
String reg = "[0-9]{1,}";
|
|
|
Pattern pattern = Pattern.compile(reg);
|
|
|
Matcher matcher = pattern.matcher(filter);
|
|
|
|
|
|
sql = "select " +
|
|
|
" DISTINCT t1.* " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
" JOIN wlyy_sign_patient_label_info t2 ON t1.patient = t2.patient " +
|
|
|
" JOIN wlyy_patiend t3 ON t1.patient = t3.code " +
|
|
|
(teamCode > 0 ? " join (select * from wlyy_sign_patient_label where label_type != '4' or team_code = " + teamCode + " or (label_type = '4' and (label_code in (1,2)))) lb on t2.label = lb.label_code and t2.label_type = lb.label_type " : "") +
|
|
|
" WHERE " +
|
|
|
" (t1.doctor = ? or t1.doctor_health = ?) " +
|
|
|
" AND t1.status > 0 " +
|
|
|
" AND t2.status = 1) " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : " AND (t2.label = 4 or t2.label = 5 )") +
|
|
|
(StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
|
|
|
(teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "")+
|
|
|
(StringUtils.isNotEmpty(diseaseCondition) ? " AND t3.diseaseCondition = ? " : "");
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
sql = sql + " AND (t1.idcard like ?) ";
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
args = new Object[]{doctor, doctor, labelCode, labelType, "%" + filter + "%"};
|
|
|
} else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
|
|
|
args = new Object[]{doctor, doctor, labelType, "%" + filter + "%"};
|
|
|
} else {
|
|
|
args = new Object[]{doctor, doctor, "%" + filter + "%"};
|
|
|
}
|
|
|
} else {
|
|
|
sql = sql + " AND (t1.name like ? or t2.label_name like ?) ";
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
args = new Object[]{doctor, doctor, labelCode, labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
} else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
|
|
|
args = new Object[]{doctor, doctor, labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
} else {
|
|
|
args = new Object[]{doctor, doctor, "%" + filter + "%", "%" + filter + "%"};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotEmpty(diseaseCondition)){
|
|
|
Object[] argsnew = new Object[args.length+1];
|
|
|
|
|
|
for (int i = 0; i < argsnew.length; i++) {
|
|
|
if(i == (argsnew.length-1)){
|
|
|
argsnew[i] = diseaseCondition;
|
|
|
}else{
|
|
|
argsnew[i] = args[i];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sql = sql + " order by t3.diseaseCondition,t3.openid desc limit " + page + "," + pagesize;
|
|
|
signList = jdbcTemplate.queryForList(sql, argsnew);
|
|
|
}else{
|
|
|
|
|
|
sql = sql + " order by t3.diseaseCondition,t3.openid desc limit " + page + "," + pagesize;
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|
|
|
}
|
|
|
|
|
|
String _pdsql = "SELECT p.code,(SELECT sum(d.category_code) from wlyy_patient_device d WHERE p.code = d.`user`) device from wlyy_patient p";
|
|
|
patientDeviceTypeMap = jdbcTemplate.queryForMap(_pdsql);
|
|
|
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
|
for (Map<String, Object> sign : signList) {
|
|
|
Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
|
|
|
|
|
|
if (p == null) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (result.containsKey(p.getCode())) {
|
|
|
JSONObject jsonP = result.get(p.getCode());
|
|
|
|
|
|
if (!String.valueOf(jsonP.get("signType")).equals(String.valueOf(sign.get("type")))) {
|
|
|
jsonP.put("signType", 3);
|
|
|
}
|
|
|
if (String.valueOf(sign.get("type")).equals("2")) {
|
|
|
jsonP.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
|
|
|
// 缴费情况
|
|
|
jsonP.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
|
|
|
// 缴费时间
|
|
|
jsonP.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
|
|
|
// 缴费类型
|
|
|
jsonP.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
|
|
|
if (StringUtils.isEmpty(String.valueOf(jsonP.get("expensesStatus"))) || String.valueOf(jsonP.get("expensesStatus")).equals("0")) {
|
|
|
boolean epTime = false;
|
|
|
try {
|
|
|
epTime = redisTemplate.opsForSet().isMember("expenses:remind:set", p.getCode());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!epTime) {
|
|
|
jsonP.put("expensesRemindStatus", 0);
|
|
|
} else {
|
|
|
jsonP.put("expensesRemindStatus", 1);
|
|
|
}
|
|
|
}
|
|
|
boolean epTime = false;
|
|
|
try {
|
|
|
epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!epTime) {
|
|
|
jsonP.put("wechatFocusRemind", 0);
|
|
|
} else {
|
|
|
jsonP.put("wechatFocusRemind", 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotEmpty(exLabelCode)) {
|
|
|
SignPatientLabelInfo labelInfoEx = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(p.getCode(), exLabelCode, exLabelType, 1);
|
|
|
|
|
|
if (labelInfoEx != null) {
|
|
|
continue;
|
|
|
}
|
|
|
} else if (StringUtils.isNotEmpty(exLabelType)) {
|
|
|
List<SignPatientLabelInfo> labelExs = labelInfoDao.findByPatientAndLabelTypeAndStatus(p.getCode(), exLabelType, 1);
|
|
|
|
|
|
if (labelExs != null && labelExs.size() > 0) {
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
List<SignPatientLabelInfo> labels = null;
|
|
|
if (teamCode > 0) {
|
|
|
labels = labelInfoDao.findByPatientAndStatusByTeam(sign.get("patient").toString(), 1, teamCode);
|
|
|
} else {
|
|
|
labels = labelInfoDao.findByPatientAndStatus(sign.get("patient").toString(), 1);
|
|
|
}
|
|
|
|
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
|
// 设置患者标识
|
|
|
json.put("code", p.getCode());
|
|
|
// 设置患者姓名
|
|
|
json.put("name", p.getName());
|
|
|
// 设置患者手机号
|
|
|
json.put("mobile", p.getMobile());
|
|
|
// 设置患者微信openid
|
|
|
json.put("openid", StringUtils.isNotEmpty(p.getOpenid()) ? p.getOpenid() : "");
|
|
|
// 设置患者联系电话
|
|
|
json.put("phone", p.getPhone());
|
|
|
// 设置患者紧急联系人
|
|
|
json.put("emerMobile", sign.get("emer_mobile") == null ? "" : String.valueOf(sign.get("emer_mobile")));
|
|
|
// 设置患者头像
|
|
|
json.put("photo", p.getPhoto());
|
|
|
// 设置患者年龄
|
|
|
json.put("age", IdCardUtil.getAgeForIdcard(p.getIdcard()));
|
|
|
// 设置患者性别
|
|
|
json.put("sex", p.getSex());
|
|
|
// 设置签约日期
|
|
|
json.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
|
|
|
// 设置签约类型
|
|
|
json.put("signType", sign.get("type") == null ? "" : sign.get("type"));
|
|
|
// 身份证号
|
|
|
json.put("idcard", p.getIdcard());
|
|
|
// 社保号
|
|
|
json.put("ssc", p.getSsc());
|
|
|
if (String.valueOf(sign.get("type")).equals("2")) {
|
|
|
// 缴费情况
|
|
|
json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
|
|
|
// 缴费时间
|
|
|
json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
|
|
|
// 缴费类型
|
|
|
json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
|
|
|
// if("2".equals(String.valueOf(sign.get("type"))) && "1".equals(String.valueOf(sign.get("expenses_status")))){
|
|
|
// json.put("qyrq", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD) : "");
|
|
|
// }
|
|
|
if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
|
|
|
boolean epTime = false;
|
|
|
try {
|
|
|
epTime = redisTemplate.opsForSet().isMember("expenses:remind:set", p.getCode());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!epTime) {
|
|
|
json.put("expensesRemindStatus", 0);
|
|
|
} else {
|
|
|
json.put("expensesRemindStatus", 1);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
// 缴费情况
|
|
|
json.put("expensesStatus", "1");
|
|
|
}
|
|
|
|
|
|
//病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
|
|
|
json.put("disease",p.getDisease());
|
|
|
// 病情:0绿标,1黄标,2红标,
|
|
|
json.put("diseaseCondition",p.getDiseaseCondition());
|
|
|
//预警状态
|
|
|
json.put("standardStatus",p.getStandardStatus());
|
|
|
//设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
|
|
|
Integer deviceType = 0;
|
|
|
if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
|
|
|
deviceType = (Integer) patientDeviceTypeMap.get(p.getCode());
|
|
|
}
|
|
|
json.put("deviceType",deviceType);
|
|
|
|
|
|
boolean epTime = false;
|
|
|
try {
|
|
|
epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!epTime) {
|
|
|
json.put("wechatFocusRemind", 0);
|
|
|
} else {
|
|
|
json.put("wechatFocusRemind", 1);
|
|
|
}
|
|
|
// 患者标签
|
|
|
json.put("labels", labels == null ? "" : labels);
|
|
|
|
|
|
result.put(p.getCode(), json);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result.size() > 0 ? new JSONArray(result.values()) : new JSONArray();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* "慢病管理-查询所有团队下患者
|
|
|
*
|
|
|
* @param filter 搜索关键字
|
|
|
* @param diseaseCondition
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray searchSlowDiseaseTeamsPatients(String filter, long teamCode, int page, int pagesize, String diseaseCondition) throws Exception {
|
|
|
Map<String, JSONObject> result = new HashMap<>();
|
|
|
List<Map<String, Object>> signList = new ArrayList<>();
|
|
|
Map<String,Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
|
|
|
|
|
|
page = page * pagesize;
|
|
|
//String reg = "(^\\d{15}$)|(^\\d{17}([0-9]|X)$)";
|
|
|
String reg = "^(\\d+)([0-9]|X|x)$";
|
|
|
Pattern pattern = Pattern.compile(reg);
|
|
|
Matcher matcher = pattern.matcher(filter);
|
|
|
boolean isIdcard = matcher.find();
|
|
|
Object[] args = new Object[]{teamCode, "%" + filter + "%"};
|
|
|
|
|
|
String sqlTemp = "select " +
|
|
|
" DISTINCT t1.* " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
" JOIN wlyy_patiend t2 ON t1.patient = t2.code " +
|
|
|
(isIdcard ? ",wlyy_patient p " : "") +
|
|
|
" WHERE " +
|
|
|
(isIdcard ? " t1.patient = p.code and " : "") +
|
|
|
" t1.status > 0 " +
|
|
|
" AND t1.admin_team_code = ? " +
|
|
|
" AND" +
|
|
|
(isIdcard ? " p.idcard like ? " : " t1.name like ? ");
|
|
|
|
|
|
String sql = sqlTemp + " order by t2.diseaseCondition,t2.openid desc limit " + page + "," + pagesize;
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
|
String _pdsql = "SELECT p.code,(SELECT sum(d.category_code) from wlyy_patient_device d WHERE p.code = d.`user`) device from wlyy_patient p";
|
|
|
patientDeviceTypeMap = jdbcTemplate.queryForMap(_pdsql);
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
|
for (Map<String, Object> sign : signList) {
|
|
|
Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
|
|
|
|
|
|
if (p == null) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (result.containsKey(p.getCode())) {
|
|
|
JSONObject jsonP = result.get(p.getCode());
|
|
|
|
|
|
if (!String.valueOf(jsonP.get("signType")).equals(String.valueOf(sign.get("type")))) {
|
|
|
jsonP.put("signType", 3);
|
|
|
}
|
|
|
if (String.valueOf(sign.get("type")).equals("2")) {
|
|
|
jsonP.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
|
|
|
// 缴费情况
|
|
|
jsonP.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
|
|
|
// 缴费时间
|
|
|
jsonP.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
|
|
|
// 缴费类型
|
|
|
jsonP.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
|
|
|
if (StringUtils.isEmpty(String.valueOf(jsonP.get("expensesStatus"))) || String.valueOf(jsonP.get("expensesStatus")).equals("0")) {
|
|
|
boolean epTime = false;
|
|
|
try {
|
|
|
epTime = redisTemplate.opsForSet().isMember("expenses:remind:set", p.getCode());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
if (!epTime) {
|
|
|
jsonP.put("expensesRemindStatus", 0);
|
|
|
} else {
|
|
|
jsonP.put("expensesRemindStatus", 1);
|
|
|
}
|
|
|
}
|
|
|
boolean epTime = false;
|
|
|
try {
|
|
|
epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!epTime) {
|
|
|
jsonP.put("wechatFocusRemind", 0);
|
|
|
} else {
|
|
|
jsonP.put("wechatFocusRemind", 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
List<SignPatientLabelInfo> labels = null;
|
|
|
if (teamCode > 0) {
|
|
|
labels = labelInfoDao.findByPatientAndStatusByTeam(sign.get("patient").toString(), 1, teamCode);
|
|
|
} else {
|
|
|
labels = labelInfoDao.findByPatientAndStatus(sign.get("patient").toString(), 1);
|
|
|
}
|
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
|
// 设置患者标识
|
|
|
json.put("code", p.getCode());
|
|
|
// 设置患者姓名
|
|
|
json.put("name", p.getName());
|
|
|
// 设置患者手机号
|
|
|
json.put("mobile", p.getMobile());
|
|
|
// 设置患者微信openid
|
|
|
json.put("openid", StringUtils.isNotEmpty(p.getOpenid()) ? p.getOpenid() : "");
|
|
|
// 设置患者联系电话
|
|
|
json.put("phone", p.getPhone());
|
|
|
// 设置患者紧急联系人
|
|
|
json.put("emerMobile", sign.get("emer_mobile") == null ? "" : String.valueOf(sign.get("emer_mobile")));
|
|
|
// 设置患者头像
|
|
|
json.put("photo", p.getPhoto());
|
|
|
// 设置患者年龄
|
|
|
json.put("age", IdCardUtil.getAgeForIdcard(p.getIdcard()));
|
|
|
// 设置患者性别
|
|
|
json.put("sex", p.getSex());
|
|
|
// 设置签约日期
|
|
|
json.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
|
|
|
// 设置签约类型
|
|
|
json.put("signType", sign.get("type") == null ? "" : sign.get("type"));
|
|
|
// 身份证号
|
|
|
json.put("idcard", p.getIdcard());
|
|
|
// 社保号
|
|
|
json.put("ssc", p.getSsc());
|
|
|
if (String.valueOf(sign.get("type")).equals("2")) {
|
|
|
// 缴费情况
|
|
|
json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
|
|
|
// 缴费时间
|
|
|
json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
|
|
|
// 缴费类型
|
|
|
json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
|
|
|
|
|
|
if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
|
|
|
boolean epTime = false;
|
|
|
try {
|
|
|
epTime = redisTemplate.opsForSet().isMember("expenses:remind:set", p.getCode());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!epTime) {
|
|
|
json.put("expensesRemindStatus", 0);
|
|
|
} else {
|
|
|
json.put("expensesRemindStatus", 1);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
// 缴费情况
|
|
|
json.put("expensesStatus", "1");
|
|
|
}
|
|
|
|
|
|
//病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
|
|
|
json.put("disease",p.getDisease());
|
|
|
// 病情:0绿标,1黄标,2红标,
|
|
|
json.put("diseaseCondition",p.getDiseaseCondition());
|
|
|
//预警状态
|
|
|
json.put("standardStatus",p.getStandardStatus());
|
|
|
//设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
|
|
|
Integer deviceType = 0;
|
|
|
if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
|
|
|
deviceType = (Integer) patientDeviceTypeMap.get(p.getCode());
|
|
|
}
|
|
|
json.put("deviceType",deviceType);
|
|
|
|
|
|
boolean epTime = false;
|
|
|
try {
|
|
|
epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!epTime) {
|
|
|
json.put("wechatFocusRemind", 0);
|
|
|
} else {
|
|
|
json.put("wechatFocusRemind", 1);
|
|
|
}
|
|
|
// 患者标签
|
|
|
json.put("labels", labels == null ? "" : labels);
|
|
|
|
|
|
result.put(p.getCode(), json);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result.size() > 0 ? new JSONArray(result.values()) : new JSONArray();
|
|
|
}
|
|
|
}
|