|
@ -77,8 +77,6 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
throw new Exception("patient info can not find");
|
|
throw new Exception("patient info can not find");
|
|
}
|
|
}
|
|
|
|
|
|
List<SignFamily> signs = signFamilyDao.findAllSignByPatient(patient);
|
|
|
|
|
|
|
|
// 设置患者标识
|
|
// 设置患者标识
|
|
json.put("code", p.getCode());
|
|
json.put("code", p.getCode());
|
|
// 设置患者姓名
|
|
// 设置患者姓名
|
|
@ -100,74 +98,65 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
// 社保号
|
|
// 社保号
|
|
json.put("ssc", p.getSsc());
|
|
json.put("ssc", p.getSsc());
|
|
|
|
|
|
if (signs != null && signs.size() > 0) {
|
|
|
|
SignFamily ssSign = null;
|
|
|
|
SignFamily familySign = null;
|
|
|
|
for (SignFamily sign : signs) {
|
|
|
|
if (sign.getType() == 1) {
|
|
|
|
ssSign = sign;
|
|
|
|
} else if (sign.getType() == 2) {
|
|
|
|
familySign = sign;
|
|
|
|
}
|
|
|
|
|
|
SignFamily ssSign = signFamilyDao.findSignByPatient(patient,1);
|
|
|
|
SignFamily familySign = signFamilyDao.findSignByPatient(patient,2);
|
|
|
|
|
|
|
|
if (ssSign != null) {
|
|
|
|
// 设置患者紧急联系人
|
|
|
|
json.put("emerMobile", StringUtils.isEmpty(ssSign.getEmerMobile()) ? "" : String.valueOf(ssSign.getEmerMobile()));
|
|
|
|
// 设置签约日期
|
|
|
|
json.put("qyrq", ssSign.getApplyDate() != null ? DateUtil.dateToStr((Date) ssSign.getApplyDate(), DateUtil.YYYY_MM_DD) : "");
|
|
|
|
// 设置签约类型
|
|
|
|
json.put("signType", 1);
|
|
|
|
// 设置签约状态
|
|
|
|
json.put("ssStatus", ssSign.getStatus());
|
|
|
|
|
|
|
|
json.put("ssDoctor", ssSign.getDoctor());
|
|
|
|
json.put("ssDoctorName", ssSign.getDoctorName());
|
|
|
|
json.put("ssDoctorHealth", ssSign.getDoctorHealth());
|
|
|
|
json.put("ssDoctorHealthName", ssSign.getDoctorHealthName());
|
|
|
|
json.put("ssAdminTeam", ssSign.getAdminTeamId());
|
|
|
|
}
|
|
|
|
if (familySign != null) {
|
|
|
|
// 设置患者紧急联系人
|
|
|
|
json.put("emerMobile", StringUtils.isEmpty(familySign.getEmerMobile()) ? "" : String.valueOf(familySign.getEmerMobile()));
|
|
|
|
// 设置签约日期
|
|
|
|
json.put("qyrq", familySign.getApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getApplyDate(), DateUtil.YYYY_MM_DD) : "");
|
|
|
|
// 设置签约日期
|
|
|
|
json.put("patientApplyDate", familySign.getPatientApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getPatientApplyDate(), DateUtil.YYYY_MM_DD) : "");
|
|
|
|
// 设置签约类型
|
|
|
|
json.put("signType", json.has("signType") ? 3 : 2);
|
|
|
|
// 缴费情况
|
|
|
|
json.put("expensesStatus", StringUtils.isNotEmpty(familySign.getExpensesStatus()) ? String.valueOf(familySign.getExpensesStatus()) : "0");
|
|
|
|
// 缴费时间
|
|
|
|
json.put("expensesTime", familySign.getExpensesTime() != null ? DateUtil.dateToStr((Date) familySign.getExpensesTime(), DateUtil.YYYY_MM_DD_HH_MM) : "");
|
|
|
|
// 缴费类型
|
|
|
|
json.put("expensesType", StringUtils.isNotEmpty(familySign.getExpensesType()) ? String.valueOf(familySign.getExpensesType()) : "");
|
|
|
|
// 设置签约状态
|
|
|
|
json.put("familyStatus", familySign.getStatus());
|
|
|
|
|
|
|
|
json.put("jtDoctor", familySign.getDoctor());
|
|
|
|
json.put("jtDoctorName", familySign.getDoctorName());
|
|
|
|
json.put("jtDoctorHealth", familySign.getDoctorHealth());
|
|
|
|
json.put("jtDoctorHealthName", familySign.getDoctorHealthName());
|
|
|
|
json.put("jtAdminTeam", familySign.getAdminTeamId());
|
|
|
|
|
|
|
|
if ("1".equals(familySign.getExpensesStatus())) {
|
|
|
|
json.put("qyrq", familySign.getExpensesTime() != null ? DateUtil.dateToStr((Date) familySign.getExpensesTime(), DateUtil.YYYY_MM_DD) : "");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if (ssSign != null) {
|
|
|
|
// 设置患者紧急联系人
|
|
|
|
json.put("emerMobile", StringUtils.isEmpty(ssSign.getEmerMobile()) ? "" : String.valueOf(ssSign.getEmerMobile()));
|
|
|
|
// 设置签约日期
|
|
|
|
json.put("qyrq", ssSign.getApplyDate() != null ? DateUtil.dateToStr((Date) ssSign.getApplyDate(), DateUtil.YYYY_MM_DD) : "");
|
|
|
|
// 设置签约类型
|
|
|
|
json.put("signType", 1);
|
|
|
|
// 设置签约状态
|
|
|
|
json.put("ssStatus", ssSign.getStatus());
|
|
|
|
|
|
|
|
json.put("ssDoctor",ssSign.getDoctor());
|
|
|
|
json.put("ssDoctorName",ssSign.getDoctorName());
|
|
|
|
json.put("ssDoctorHealth",ssSign.getDoctorHealth());
|
|
|
|
json.put("ssDoctorHealthName",ssSign.getDoctorHealthName());
|
|
|
|
json.put("ssAdminTeam",ssSign.getAdminTeamId());
|
|
|
|
}
|
|
|
|
if (familySign != null) {
|
|
|
|
// 设置患者紧急联系人
|
|
|
|
json.put("emerMobile", StringUtils.isEmpty(familySign.getEmerMobile()) ? "" : String.valueOf(familySign.getEmerMobile()));
|
|
|
|
// 设置签约日期
|
|
|
|
json.put("qyrq", familySign.getApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getApplyDate(), DateUtil.YYYY_MM_DD) : "");
|
|
|
|
// 设置签约日期
|
|
|
|
json.put("patientApplyDate", familySign.getPatientApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getPatientApplyDate(), DateUtil.YYYY_MM_DD) : "");
|
|
|
|
// 设置签约类型
|
|
|
|
json.put("signType", json.has("signType") ? 3 : 2);
|
|
|
|
// 缴费情况
|
|
|
|
json.put("expensesStatus", StringUtils.isNotEmpty(familySign.getExpensesStatus()) ? String.valueOf(familySign.getExpensesStatus()) : "0");
|
|
|
|
// 缴费时间
|
|
|
|
json.put("expensesTime", familySign.getExpensesTime() != null ? DateUtil.dateToStr((Date) familySign.getExpensesTime(), DateUtil.YYYY_MM_DD_HH_MM) : "");
|
|
|
|
// 缴费类型
|
|
|
|
json.put("expensesType", StringUtils.isNotEmpty(familySign.getExpensesType()) ? String.valueOf(familySign.getExpensesType()) : "");
|
|
|
|
// 设置签约状态
|
|
|
|
json.put("familyStatus", familySign.getStatus());
|
|
|
|
|
|
|
|
json.put("jtDoctor",familySign.getDoctor());
|
|
|
|
json.put("jtDoctorName",familySign.getDoctorName());
|
|
|
|
json.put("jtDoctorHealth",familySign.getDoctorHealth());
|
|
|
|
json.put("jtDoctorHealthName",familySign.getDoctorHealthName());
|
|
|
|
json.put("jtAdminTeam",familySign.getAdminTeamId());
|
|
|
|
|
|
|
|
if ("1".equals(familySign.getExpensesStatus())) {
|
|
|
|
json.put("qyrq", familySign.getExpensesTime() != null ? DateUtil.dateToStr((Date) familySign.getExpensesTime(), DateUtil.YYYY_MM_DD) : "");
|
|
|
|
}
|
|
|
|
|
|
if (json.has("expensesStatus") && (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0"))) {
|
|
|
|
String epTime = "";
|
|
|
|
try {
|
|
|
|
epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
|
|
if (json.has("expensesStatus") && (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0"))) {
|
|
|
|
String epTime = "";
|
|
|
|
try {
|
|
|
|
epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
if (StringUtils.isEmpty(epTime)) {
|
|
|
|
json.put("expensesRemindStatus", 0);
|
|
|
|
} else {
|
|
|
|
json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isEmpty(epTime)) {
|
|
|
|
json.put("expensesRemindStatus", 0);
|
|
|
|
} else {
|
|
|
|
json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -779,7 +768,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
sql = "select count(DISTINCT t.patient) count from (" + sql +") t";
|
|
|
|
|
|
sql = "select count(DISTINCT t.patient) count from (" + sql + ") t";
|
|
|
|
|
|
List<Map<String, Object>> count = jdbcTemplate.queryForList(sql, args);
|
|
List<Map<String, Object>> count = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
|
@ -839,8 +828,8 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
JSONArray teams = adminTeamService.findPatientDoctorTeam(patient, doctor);
|
|
JSONArray teams = adminTeamService.findPatientDoctorTeam(patient, doctor);
|
|
List<String> teamCodes = new ArrayList<>();
|
|
List<String> teamCodes = new ArrayList<>();
|
|
|
|
|
|
if(teams.length() > 0){
|
|
|
|
for(int i = 0; i < teams.length(); i++){
|
|
|
|
|
|
if (teams.length() > 0) {
|
|
|
|
for (int i = 0; i < teams.length(); i++) {
|
|
teamCodes.add(String.valueOf(teams.getJSONObject(i).getLong("id")));
|
|
teamCodes.add(String.valueOf(teams.getJSONObject(i).getLong("id")));
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@ -929,9 +918,9 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
|
|
|
for (SignPatientLabelInfo label : labels) {
|
|
for (SignPatientLabelInfo label : labels) {
|
|
labelMap.put(label.getLabel(), label);
|
|
labelMap.put(label.getLabel(), label);
|
|
SignPatientLabel lb = labelService.getLabelByCodeAndType(label.getLabel(),"4");
|
|
|
|
|
|
SignPatientLabel lb = labelService.getLabelByCodeAndType(label.getLabel(), "4");
|
|
|
|
|
|
if(!custList.contains(label.getLabel())) {
|
|
|
|
|
|
if (!custList.contains(label.getLabel())) {
|
|
if (lb.getLabelCode().equals("1") || lb.getLabelCode().equals("2") || teamCodes.contains(String.valueOf(lb.getTeamCode()))) {
|
|
if (lb.getLabelCode().equals("1") || lb.getLabelCode().equals("2") || teamCodes.contains(String.valueOf(lb.getTeamCode()))) {
|
|
label.setStatus(0);
|
|
label.setStatus(0);
|
|
labelInfoDao.save(label);
|
|
labelInfoDao.save(label);
|
|
@ -971,7 +960,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|| Arrays.asList(diseaseArr).contains("2"))) {
|
|
|| Arrays.asList(diseaseArr).contains("2"))) {
|
|
SignPatientLabelInfo mbEx = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(patient, "2", "1", 1);
|
|
SignPatientLabelInfo mbEx = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(patient, "2", "1", 1);
|
|
|
|
|
|
if(mbEx == null) {
|
|
|
|
|
|
if (mbEx == null) {
|
|
// 卫计委三大分组
|
|
// 卫计委三大分组
|
|
int wjwAmount = labelInfoDao.deleteByPatientAndLabelTypeAndStatus(patient, "1", 1);
|
|
int wjwAmount = labelInfoDao.deleteByPatientAndLabelTypeAndStatus(patient, "1", 1);
|
|
SignPatientLabelInfo disLabel = new SignPatientLabelInfo();
|
|
SignPatientLabelInfo disLabel = new SignPatientLabelInfo();
|
|
@ -988,8 +977,8 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
int age = IdCardUtil.getAgeForIdcard(idcard);
|
|
int age = IdCardUtil.getAgeForIdcard(idcard);
|
|
String lbCode = "",lbName = "";
|
|
|
|
if(age >= 65){
|
|
|
|
|
|
String lbCode = "", lbName = "";
|
|
|
|
if (age >= 65) {
|
|
lbCode = "3";
|
|
lbCode = "3";
|
|
lbName = "65岁以上人群";
|
|
lbName = "65岁以上人群";
|
|
} else {
|
|
} else {
|
|
@ -999,7 +988,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
|
|
|
SignPatientLabelInfo wjwEx = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(patient, lbCode, "1", 1);
|
|
SignPatientLabelInfo wjwEx = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(patient, lbCode, "1", 1);
|
|
|
|
|
|
if(wjwEx == null) {
|
|
|
|
|
|
if (wjwEx == null) {
|
|
// 卫计委三大分组
|
|
// 卫计委三大分组
|
|
int wjwAmount = labelInfoDao.deleteByPatientAndLabelTypeAndStatus(patient, "1", 1);
|
|
int wjwAmount = labelInfoDao.deleteByPatientAndLabelTypeAndStatus(patient, "1", 1);
|
|
SignPatientLabelInfo disLabel = new SignPatientLabelInfo();
|
|
SignPatientLabelInfo disLabel = new SignPatientLabelInfo();
|