|
@ -1,5 +1,6 @@
|
|
|
package com.yihu.wlyy.service.app.label;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
|
|
@ -308,7 +309,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
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());
|
|
|
epTime = redisTemplate.opsForSet().isMember("expenses:remind:set", p.getCode());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -406,7 +407,29 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result.size() > 0 ? new JSONArray(result.values()) : new JSONArray();
|
|
|
if(result.size() > 0) {
|
|
|
List<JSONObject> list = Lists.newArrayList(result.values());
|
|
|
|
|
|
Collections.sort(list, new Comparator<JSONObject>() {
|
|
|
@Override
|
|
|
public int compare(JSONObject o1, JSONObject o2) {
|
|
|
String openid1 = o1.has("openid") ? o1.getString("openid") : "";
|
|
|
String openid2 = o2.has("openid") ? o2.getString("openid") : "";
|
|
|
int re = openid1.compareTo(openid2);
|
|
|
if (re > 0) {
|
|
|
return -1;
|
|
|
} else if (re < 0) {
|
|
|
return 1;
|
|
|
} else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return new JSONArray(list);
|
|
|
} else {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -1531,17 +1554,18 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
|
|
|
/**
|
|
|
* 医生端查询
|
|
|
*
|
|
|
* @param filter
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject search(String filter,String doctorCode){
|
|
|
Map<String,JSONObject> teams = new HashMap<>();
|
|
|
Map<String,JSONObject> patients = new HashMap<>();
|
|
|
public JSONObject search(String filter, String doctorCode) {
|
|
|
Map<String, JSONObject> teams = new HashMap<>();
|
|
|
Map<String, JSONObject> patients = new HashMap<>();
|
|
|
|
|
|
String reg = "^(\\d{6})(19|20)(\\d{2})(1[0-2]|0[1-9])(0[1-9]|[1-2][0-9]|3[0-1])(\\d{3})(\\d|X|x)?$";
|
|
|
Pattern pattern1 = Pattern.compile(reg); //粗略的校验
|
|
|
Matcher matcher = pattern1.matcher(filter);
|
|
|
if(matcher.matches()){
|
|
|
if (matcher.matches()) {
|
|
|
// 身份证校验通过
|
|
|
String sql = "select" +
|
|
|
" p. CODE," +
|
|
@ -1561,7 +1585,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" LEFT JOIN wlyy_admin_team t ON f.admin_team_code = t.id" +
|
|
|
" where" +
|
|
|
" p. idcard = ? AND (f.id IS NULL || f.status > 0)";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql,filter);
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, filter);
|
|
|
for (Map<String, Object> p : list) {
|
|
|
JSONObject pJson = new JSONObject();
|
|
|
|
|
@ -1571,11 +1595,11 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
pJson.put("sex", p.get("sex") != null ? p.get("sex") : "");
|
|
|
pJson.put("age", p.get("idcard") != null ? IdCardUtil.getAgeForIdcard(String.valueOf(p.get("idcard"))) : "");
|
|
|
pJson.put("photo", p.get("photo") != null ? p.get("photo") : "");
|
|
|
pJson.put("id",p.get("id")!=null? p.get("id"):"");
|
|
|
pJson.put("doctor",p.get("doctor")!=null? p.get("doctor"):"");
|
|
|
pJson.put("doctorHealth",p.get("doctor_health")!=null? p.get("doctor_health"):"");
|
|
|
if(p.get("id")!=null && (doctorCode.equals(pJson.get("doctor"))||doctorCode.equals(pJson.get("doctorHealth")))){
|
|
|
if(p.get("teamCode") != null && StringUtils.isNotEmpty(p.get("teamCode").toString())) {
|
|
|
pJson.put("id", p.get("id") != null ? p.get("id") : "");
|
|
|
pJson.put("doctor", p.get("doctor") != null ? p.get("doctor") : "");
|
|
|
pJson.put("doctorHealth", p.get("doctor_health") != null ? p.get("doctor_health") : "");
|
|
|
if (p.get("id") != null && (doctorCode.equals(pJson.get("doctor")) || doctorCode.equals(pJson.get("doctorHealth")))) {
|
|
|
if (p.get("teamCode") != null && StringUtils.isNotEmpty(p.get("teamCode").toString())) {
|
|
|
JSONObject team = teams.get(p.get("teamCode").toString());
|
|
|
if (team == null) {
|
|
|
team = new JSONObject();
|
|
@ -1590,11 +1614,11 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
pArray.put(pJson);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
} else {
|
|
|
patients.put(p.get("code").toString(), pJson);
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
} else {
|
|
|
String sql = "select" +
|
|
|
" p. CODE," +
|
|
|
" p. NAME," +
|
|
@ -1623,11 +1647,11 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
pJson.put("sex", p.get("sex") != null ? p.get("sex") : "");
|
|
|
pJson.put("age", p.get("idcard") != null ? IdCardUtil.getAgeForIdcard(String.valueOf(p.get("idcard"))) : "");
|
|
|
pJson.put("photo", p.get("photo") != null ? p.get("photo") : "");
|
|
|
pJson.put("id",p.get("id")!=null? p.get("id"):"");
|
|
|
pJson.put("doctor",p.get("doctor")!=null? p.get("doctor"):"");
|
|
|
pJson.put("doctorHealth",p.get("doctor_health")!=null? p.get("doctor_health"):"");
|
|
|
if(p.get("id")!=null && (doctorCode.equals(pJson.get("doctor"))||doctorCode.equals(pJson.get("doctorHealth")))){
|
|
|
if(p.get("teamCode") != null && StringUtils.isNotEmpty(p.get("teamCode").toString())) {
|
|
|
pJson.put("id", p.get("id") != null ? p.get("id") : "");
|
|
|
pJson.put("doctor", p.get("doctor") != null ? p.get("doctor") : "");
|
|
|
pJson.put("doctorHealth", p.get("doctor_health") != null ? p.get("doctor_health") : "");
|
|
|
if (p.get("id") != null && (doctorCode.equals(pJson.get("doctor")) || doctorCode.equals(pJson.get("doctorHealth")))) {
|
|
|
if (p.get("teamCode") != null && StringUtils.isNotEmpty(p.get("teamCode").toString())) {
|
|
|
JSONObject team = teams.get(p.get("teamCode").toString());
|
|
|
if (team == null) {
|
|
|
team = new JSONObject();
|
|
@ -1642,7 +1666,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
pArray.put(pJson);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
} else {
|
|
|
patients.put(p.get("code").toString(), pJson);
|
|
|
}
|
|
|
}
|
|
@ -1650,11 +1674,12 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
}
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("teams",teams.values());
|
|
|
result.put("patients",patients.values());
|
|
|
result.put("teams", teams.values());
|
|
|
result.put("patients", patients.values());
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 添加居民到某个标签
|
|
|
*
|
|
@ -2391,7 +2416,29 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result.size() > 0 ? new JSONArray(result.values()) : new JSONArray();
|
|
|
if(result.size() > 0) {
|
|
|
List<JSONObject> list = Lists.newArrayList(result.values());
|
|
|
|
|
|
Collections.sort(list, new Comparator<JSONObject>() {
|
|
|
@Override
|
|
|
public int compare(JSONObject o1, JSONObject o2) {
|
|
|
String openid1 = o1.has("openid") ? o1.getString("openid") : "";
|
|
|
String openid2 = o2.has("openid") ? o2.getString("openid") : "";
|
|
|
int re = openid1.compareTo(openid2);
|
|
|
if (re > 0) {
|
|
|
return -1;
|
|
|
} else if (re < 0) {
|
|
|
return 1;
|
|
|
} else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return new JSONArray(list);
|
|
|
} else {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|