|
@ -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;
|
|
@ -307,20 +308,15 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" OR t1.doctor_health = ? " +
|
|
|
" ) " +
|
|
|
" AND t1. STATUS > 0 " +
|
|
|
" AND t1.admin_team_code = ?" +
|
|
|
" ) f " +
|
|
|
"WHERE " +
|
|
|
" f. CODE = s.sign_code " +
|
|
|
" AND s.server_type ='"+labelCode+"' ";
|
|
|
" AND t1.admin_team_code = ?" ;
|
|
|
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 + " AND p.disease_condition ="+diseaseCondition;
|
|
|
}
|
|
|
|
|
|
sql = sql + " ORDER BY " +
|
|
|
" f.ptOpenid DESC";
|
|
|
sql = sql +" ) f " +
|
|
|
"WHERE " +
|
|
|
" f. CODE = s.sign_code " +
|
|
|
" AND s.server_type ='"+labelCode+"' ORDER BY f.ptOpenid DESC";
|
|
|
args = new Object[]{doctor, doctor, teamCode};
|
|
|
} else {
|
|
|
if (labelCode.equals("0")) {
|
|
|
sql = "SELECT " +
|
|
@ -360,9 +356,16 @@ 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,floor(sum(category_code)) deviceType FROM wlyy_patient_device GROUP BY user";
|
|
|
List<Map<String,Object>> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql);
|
|
|
|
|
|
if(!patientCodeDeviceTypes.isEmpty()){
|
|
|
for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
String user = String.valueOf(patientCodeDeviceType.get("user"));
|
|
|
String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
|
|
|
System.out.println(user+sum);
|
|
|
patientDeviceTypeMap.put(user,sum);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
@ -508,26 +511,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 +3578,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
* @param teamCode
|
|
|
* @param page
|
|
|
* @param pagesize
|
|
|
* @param sortByStandardStatus 是否根据预警状态排序,如果true, 需要附带查询患者设备绑定情况
|
|
|
* @param isSlowDisease 是否是慢病管理,如果true
|
|
|
* @param diseaseCondition
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@ -3618,7 +3638,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" AND t1. STATUS > 0 " +
|
|
|
" AND t1.admin_team_code = ?";
|
|
|
if(StringUtils.isNotBlank(diseaseCondition)){
|
|
|
sql = sql + " AND p.diseaseCondition = ?";
|
|
|
sql = sql + " AND p.disease_condition = ?";
|
|
|
args = new Object[]{teamCode,diseaseCondition};
|
|
|
}else{
|
|
|
args = new Object[]{teamCode};
|
|
@ -3679,12 +3699,18 @@ 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<Map<String,Object>> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql);
|
|
|
|
|
|
if(!patientCodeDeviceTypes.isEmpty()){
|
|
|
for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
String user = String.valueOf(patientCodeDeviceType.get("user"));
|
|
|
String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
|
|
|
System.out.println(user+sum);
|
|
|
patientDeviceTypeMap.put(user,sum);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
|
for (Map<String, Object> sign : signList) {
|
|
|
Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
|
|
@ -3830,27 +3856,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,17 +4130,26 @@ 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<Map<String,Object>> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql);
|
|
|
|
|
|
if(!patientCodeDeviceTypes.isEmpty()){
|
|
|
for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
String user = String.valueOf(patientCodeDeviceType.get("user"));
|
|
|
String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
|
|
|
System.out.println(user+sum);
|
|
|
patientDeviceTypeMap.put(user,sum);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
|
for (Map<String, Object> sign : signList) {
|
|
@ -4296,11 +4347,23 @@ 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;
|
|
|
sqlTemp = sqlTemp + " AND p.disease_condition = "+diseaseCondition;
|
|
|
|
|
|
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<Map<String,Object>> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql);
|
|
|
|
|
|
if(!patientCodeDeviceTypes.isEmpty()){
|
|
|
for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
String user = String.valueOf(patientCodeDeviceType.get("user"));
|
|
|
String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
|
|
|
System.out.println(user+sum);
|
|
|
patientDeviceTypeMap.put(user,sum);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
|
for (Map<String, Object> sign : signList) {
|