|
@ -176,6 +176,85 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
return result.size() > 0 ? new JSONArray(result.values()) : new JSONArray();
|
|
return result.size() > 0 ? new JSONArray(result.values()) : new JSONArray();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取团队下的患者
|
|
|
|
*
|
|
|
|
* @param doctor
|
|
|
|
* @param teamCode
|
|
|
|
* @param page
|
|
|
|
* @param pagesize
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public JSONArray getPatientByTeamCode(String doctor, long teamCode, int page, int pagesize) throws Exception {
|
|
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
|
|
|
|
|
|
if (doc == null) {
|
|
|
|
throw new Exception("doctor info can not find");
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, JSONObject> result = new HashMap<>();
|
|
|
|
List<Map<String, Object>> signList = new ArrayList<>();
|
|
|
|
int start = page * pagesize;
|
|
|
|
String sql = "";
|
|
|
|
Object[] args = null;
|
|
|
|
|
|
|
|
sql = " select * from wlyy_sign_family where " +
|
|
|
|
(doc.getLevel() == 2 ? " doctor" : "doctor_health") +
|
|
|
|
" = ? and status > 0 and admin_team_code = ? " +
|
|
|
|
" limit " + start + "," + pagesize;
|
|
|
|
|
|
|
|
args = new Object[]{doctor, teamCode};
|
|
|
|
|
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<SignPatientLabelInfo> labels = labelInfoDao.findByPatientAndStatus(sign.get("patient").toString(), 1);
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
|
|
|
// 设置患者标识
|
|
|
|
json.put("code", p.getCode());
|
|
|
|
// 设置患者姓名
|
|
|
|
json.put("name", p.getName());
|
|
|
|
// 设置患者头像
|
|
|
|
json.put("photo", p.getPhoto());
|
|
|
|
// 设置患者年龄
|
|
|
|
json.put("age", DateUtil.getAgeByBirthday(p.getBirthday()));
|
|
|
|
// 设置患者性别
|
|
|
|
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("labels", labels == null ? "" : labels);
|
|
|
|
|
|
|
|
result.put(p.getCode(), json);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result.size() > 0 ? new JSONArray(result.values()) : new JSONArray();
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询某个标签类型的所有标签居民数统计
|
|
* 查询某个标签类型的所有标签居民数统计
|
|
*
|
|
*
|
|
@ -481,7 +560,8 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
public JSONArray searchPatientByNameOrLabel(String doctor, String filter, String labelCode, String labelType) throws Exception {
|
|
|
|
|
|
public JSONArray searchPatientByNameOrLabel(String doctor, String filter,
|
|
|
|
String labelCode, String labelType, long teamCode) throws Exception {
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
Doctor doc = doctorDao.findByCode(doctor);
|
|
|
|
|
|
if (doc == null) {
|
|
if (doc == null) {
|
|
@ -493,7 +573,8 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
Object[] args = null;
|
|
Object[] args = null;
|
|
String sql = "select a.*" +
|
|
String sql = "select a.*" +
|
|
" from" +
|
|
" from" +
|
|
" (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0) a" +
|
|
|
|
|
|
" (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
|
|
|
|
(teamCode > 0 ? (" and admin_team_code = " + teamCode) : "") + " ) a" +
|
|
" left join" +
|
|
" left join" +
|
|
" (select * from wlyy_sign_patient_label_info where status = 1 " +
|
|
" (select * from wlyy_sign_patient_label_info where status = 1 " +
|
|
(StringUtils.isNotEmpty(labelCode) ? " and label = ? " : "") +
|
|
(StringUtils.isNotEmpty(labelCode) ? " and label = ? " : "") +
|
|
@ -651,7 +732,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
* @param labelType
|
|
* @param labelType
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public int deltePatientsLabel(String patients, String labelCode, String labelType){
|
|
|
|
|
|
public int deltePatientsLabel(String patients, String labelCode, String labelType) {
|
|
if (StringUtils.isNotEmpty(patients)) {
|
|
if (StringUtils.isNotEmpty(patients)) {
|
|
String[] patientArr = patients.split(",");
|
|
String[] patientArr = patients.split(",");
|
|
|
|
|