|
@ -8,6 +8,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.PatientDisease;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.vo.PatientCodeDeviceType;
|
|
|
import com.yihu.wlyy.logs.BusinessLogs;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
|
|
@ -360,9 +361,13 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
|
//查询患者设备绑定情况
|
|
|
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);
|
|
|
String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
|
|
|
List<PatientCodeDeviceType> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql,PatientCodeDeviceType.class);
|
|
|
|
|
|
if(!patientCodeDeviceTypes.isEmpty()){
|
|
|
for (PatientCodeDeviceType patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
patientDeviceTypeMap.put(patientCodeDeviceType.getUser(),patientCodeDeviceType.getDeviceType());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
@ -508,26 +513,43 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
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 = 0;
|
|
|
|
|
|
//是否根据预警字段优先排序
|
|
|
if(isSlowDisease){
|
|
|
int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
|
|
|
int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
|
|
|
//患者預警狀態
|
|
|
int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
|
|
|
int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
|
|
|
|
|
|
//疾病种类
|
|
|
int disease1 = o1.has("disease")?o1.getInt("disease"):0;
|
|
|
int disease2 = o2.has("disease")?o2.getInt("disease"):0;
|
|
|
|
|
|
//颜色标签
|
|
|
int diseaseCondition1 = o1.has("diseaseCondition")?o1.getInt("diseaseCondition"):0;
|
|
|
int diseaseCondition2 = o2.has("diseaseCondition")?o2.getInt("diseaseCondition"):0;
|
|
|
|
|
|
//判断预警状态
|
|
|
if(standardStatus1 == standardStatus2){
|
|
|
//判断病种种类
|
|
|
if(disease1 == disease2){
|
|
|
//判断颜色标签
|
|
|
if(diseaseCondition1 == diseaseCondition2){
|
|
|
//判断微信绑定情况
|
|
|
re = openid1.compareTo(openid2);
|
|
|
}else{
|
|
|
re = diseaseCondition1 - diseaseCondition2;
|
|
|
}
|
|
|
|
|
|
if(standardStatus1 == standardStatus2){
|
|
|
re = openid1.compareTo(openid2);
|
|
|
}else{
|
|
|
re = standardStatus1 - standardStatus1;
|
|
|
re = disease1 - disease2;
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
re = openid1.compareTo(openid2);
|
|
|
re = standardStatus1 - standardStatus2;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (re > 0) {
|
|
|
return -1;
|
|
|
} else if (re < 0) {
|
|
@ -3558,7 +3580,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
* @param teamCode
|
|
|
* @param page
|
|
|
* @param pagesize
|
|
|
* @param sortByStandardStatus 是否根据预警状态排序,如果true, 需要附带查询患者设备绑定情况
|
|
|
* @param isSlowDisease 是否是慢病管理,如果true
|
|
|
* @param diseaseCondition
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@ -3679,11 +3701,14 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
|
//查询患者设备绑定情况
|
|
|
if(sortByStandardStatus){
|
|
|
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);
|
|
|
}
|
|
|
String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
|
|
|
List<PatientCodeDeviceType> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql,PatientCodeDeviceType.class);
|
|
|
|
|
|
if(!patientCodeDeviceTypes.isEmpty()){
|
|
|
for (PatientCodeDeviceType patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
patientDeviceTypeMap.put(patientCodeDeviceType.getUser(),patientCodeDeviceType.getDeviceType());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
|
for (Map<String, Object> sign : signList) {
|
|
@ -3830,27 +3855,43 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
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 = 0;
|
|
|
|
|
|
//是否根据预警字段优先排序
|
|
|
if(sortByStandardStatus){
|
|
|
int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
|
|
|
int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
|
|
|
//患者預警狀態
|
|
|
int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
|
|
|
int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
|
|
|
|
|
|
//疾病种类
|
|
|
int disease1 = o1.has("disease")?o1.getInt("disease"):0;
|
|
|
int disease2 = o2.has("disease")?o2.getInt("disease"):0;
|
|
|
|
|
|
//颜色标签
|
|
|
int diseaseCondition1 = o1.has("diseaseCondition")?o1.getInt("diseaseCondition"):0;
|
|
|
int diseaseCondition2 = o2.has("diseaseCondition")?o2.getInt("diseaseCondition"):0;
|
|
|
|
|
|
//判断预警状态
|
|
|
if(standardStatus1 == standardStatus2){
|
|
|
//判断病种种类
|
|
|
if(disease1 == disease2){
|
|
|
//判断颜色标签
|
|
|
if(diseaseCondition1 == diseaseCondition2){
|
|
|
//判断微信绑定情况
|
|
|
re = openid1.compareTo(openid2);
|
|
|
}else{
|
|
|
re = diseaseCondition1 - diseaseCondition2;
|
|
|
}
|
|
|
|
|
|
if(standardStatus1 == standardStatus2){
|
|
|
re = openid1.compareTo(openid2);
|
|
|
}else{
|
|
|
re = standardStatus1 - standardStatus1;
|
|
|
re = disease1 - disease2;
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
re = openid1.compareTo(openid2);
|
|
|
re = standardStatus1 - standardStatus2;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (re > 0) {
|
|
|
return -1;
|
|
|
} else if (re < 0) {
|
|
@ -4088,18 +4129,23 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sql = sql + " order by t3.diseaseCondition,t3.openid desc limit " + page + "," + pagesize;
|
|
|
sql = sql + " order by t3.diseaseCondition,t3.disease,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;
|
|
|
sql = sql + " order by t3.diseaseCondition,t3.disease,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);
|
|
|
|
|
|
//查询患者设备绑定情况
|
|
|
String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
|
|
|
List<PatientCodeDeviceType> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql,PatientCodeDeviceType.class);
|
|
|
|
|
|
if(!patientCodeDeviceTypes.isEmpty()){
|
|
|
for (PatientCodeDeviceType patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
patientDeviceTypeMap.put(patientCodeDeviceType.getUser(),patientCodeDeviceType.getDeviceType());
|
|
|
}
|
|
|
}
|
|
|
if (signList != null && signList.size() > 0) {
|
|
|
for (Map<String, Object> sign : signList) {
|
|
|
Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
|
|
@ -4296,11 +4342,18 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" AND" +
|
|
|
(isIdcard ? " p.idcard like ? " : " t1.name like ? ");
|
|
|
|
|
|
String sql = sqlTemp + " order by t2.diseaseCondition,t2.openid desc limit " + page + "," + pagesize;
|
|
|
String sql = sqlTemp + " order by t2.diseaseCondition,t2.disease,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);
|
|
|
//查询患者设备绑定情况
|
|
|
String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
|
|
|
List<PatientCodeDeviceType> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql,PatientCodeDeviceType.class);
|
|
|
|
|
|
if(!patientCodeDeviceTypes.isEmpty()){
|
|
|
for (PatientCodeDeviceType patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
patientDeviceTypeMap.put(patientCodeDeviceType.getUser(),patientCodeDeviceType.getDeviceType());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
|
for (Map<String, Object> sign : signList) {
|