|
@ -902,7 +902,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
|
return result;
|
|
|
}
|
|
|
//紧急救助编辑服务小结前不会有医生
|
|
|
if(!permissionService.isOlderServerDoctor(doctor,assistanceDO.getPatient())){
|
|
|
if(permissionService.isOlderServerDoctor(doctor,assistanceDO.getPatient())){
|
|
|
String failMsg = "该操作没有权限";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg,failMsg);
|
|
@ -1285,7 +1285,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
|
if (orderTypes.contains("20")){
|
|
|
sql += "select '20' as OrderType,ord.id,ord.patient,ord.patient_name patientName,ord.doctor,ord.status,ord.doctor_name," +
|
|
|
"'紧急呼叫' as serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time ,case p.sex when 1 then '男' when 2 then '女' else p.sex end as sex," +
|
|
|
" TIMESTAMPDIFF(YEAR,p.birthday,now()) as age,ord.order_source orderSource,p.mobile,p.photo " +
|
|
|
" TIMESTAMPDIFF(YEAR,p.birthday,now()) as age,ord.order_source orderSource,p.mobile,p.photo,ord.session_id sessionId " +
|
|
|
"from base_emergency_assistance_order ord INNER JOIN base_patient p on ord.patient = p.id INNER JOIN base_patient_helper ph on p.id = ph.patient and ph.del=1 " +
|
|
|
" where ph.doctor='"+doctor+"' "+filter;
|
|
|
}
|
|
@ -1295,7 +1295,8 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
|
if (orderTypes.contains("22")){
|
|
|
sql += " select '22' as 'OrderType',ord.id,ord.patient,ord.patient_name patientName,ord.doctor,ord.status,ord.doctor_name," +
|
|
|
"ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time ,case p.sex when 1 then '男' when 2 then '女' else p.sex end as sex, " +
|
|
|
"TIMESTAMPDIFF(YEAR,p.birthday,now()) as age,ord.order_source orderSource,p.mobile,p.photo from base_security_monitoring_order ord " +
|
|
|
"TIMESTAMPDIFF(YEAR,p.birthday,now()) as age,ord.order_source orderSource,p.mobile,p.photo,CONCAT(ord.patient,'_22') sessionId " +
|
|
|
" from base_security_monitoring_order ord " +
|
|
|
" INNER JOIN base_patient p on ord.patient = p.id INNER JOIN base_patient_helper ph on p.id = ph.patient and ph.del=1 " +
|
|
|
" where ph.doctor='"+doctor+"' "+filter;
|
|
|
if(StringUtils.isNotBlank(svrDesc)){
|
|
@ -1308,69 +1309,84 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public JSONObject getEmeAndSecuOrderTab(String orderType,String doctor){
|
|
|
public JSONObject getEmeAndSecuOrderTab(String doctor,String status){
|
|
|
JSONObject result = new JSONObject();
|
|
|
if ("20".equals(orderType)){
|
|
|
result.put("status_-2",0);//误报警
|
|
|
result.put("status_-1",0);//已取消
|
|
|
result.put("status_0",0);//已完成
|
|
|
result.put("status_1",0);//预警中
|
|
|
String sql = " select ord.status,count(distinct ord.id) count from base_emergency_assistance_order ord INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 " +
|
|
|
" where ph.doctor='"+doctor+"' group by ord.status " ;
|
|
|
List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
for (Map<String,Object> map:sqlResult){
|
|
|
result.put("status_"+map.get("status"),map.get("count"));
|
|
|
}
|
|
|
Integer All = 0;
|
|
|
Set<String> keySet = result.keySet();
|
|
|
for (String key : keySet){
|
|
|
All+=result.getInteger(key);
|
|
|
}
|
|
|
result.put("all",All);
|
|
|
}
|
|
|
else if("22".equals(orderType)){
|
|
|
result.put("status_-2", 0);//误报警
|
|
|
result.put("status_-1", 0);//已取消
|
|
|
result.put("status_0", 0);//已完成
|
|
|
result.put("status_1", 0);//预警中
|
|
|
result.put("status_all", 0);//
|
|
|
result.put("svr_all", 0);//
|
|
|
|
|
|
Map<String, String> serverTmp = new HashMap<>();
|
|
|
|
|
|
String sql = " select py_code,dict_value from wlyy_hospital_sys_dict where dict_name='security_server_dict' ";
|
|
|
List<Map<String, Object>> servers = jdbcTemplate.queryForList(sql);
|
|
|
for (Map<String, Object> server : servers) {
|
|
|
result.put("svr_" + server.get("py_code").toString(), 0);
|
|
|
serverTmp.put(server.get("dict_value").toString(), server.get("py_code").toString());
|
|
|
}
|
|
|
sql = "select ord.status,ord.serve_desc,count(distinct ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
|
|
|
" INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 where ph.doctor='"+doctor+"' ";
|
|
|
String fliter = " ";
|
|
|
fliter += " group by ord.status,ord.serve_desc ";
|
|
|
List<Map<String, Object>> sqlResult = jdbcTemplate.queryForList(sql + fliter);
|
|
|
String pyCode = "";
|
|
|
for (Map<String, Object> map : sqlResult) {
|
|
|
result.put("status_" + map.get("status"), result.getInteger("status_" + map.get("status")) + Integer.parseInt(map.get("count").toString()));
|
|
|
pyCode = serverTmp.get(map.get("serve_desc")) == null ? null : serverTmp.get(map.get("serve_desc")).toString();
|
|
|
if (StringUtils.isNotBlank(pyCode)) {
|
|
|
result.put("svr_" + pyCode, result.getInteger("svr_" + pyCode) + Integer.parseInt(map.get("count").toString()));
|
|
|
result.put("status_all", result.getInteger("status_all") + Integer.parseInt(map.get("count").toString()));
|
|
|
result.put("svr_all", result.getInteger("svr_all") + Integer.parseInt(map.get("count").toString()));
|
|
|
}
|
|
|
JSONObject eme = new JSONObject();
|
|
|
JSONObject secu = new JSONObject();
|
|
|
JSONObject emeAndSecu = new JSONObject();
|
|
|
|
|
|
/************************紧急********/
|
|
|
eme.put("status_-2",0);//误报警
|
|
|
eme.put("status_-1",0);//已取消
|
|
|
eme.put("status_0",0);//已完成
|
|
|
eme.put("status_1",0);//预警中
|
|
|
String sql = " select ord.status,count(distinct ord.id) count from base_emergency_assistance_order ord INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 " ;
|
|
|
if (StringUtils.isNotBlank(status)){
|
|
|
sql += " and ord.status='"+status+"' ";
|
|
|
}
|
|
|
sql += " where ph.doctor='"+doctor+"' group by ord.status " ;
|
|
|
List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
for (Map<String,Object> map:sqlResult){
|
|
|
eme.put("status_"+map.get("status"),map.get("count"));
|
|
|
}
|
|
|
Integer All = 0;
|
|
|
Set<String> keySet = eme.keySet();
|
|
|
for (String key : keySet){
|
|
|
All+=eme.getInteger(key);
|
|
|
}
|
|
|
eme.put("all",All);
|
|
|
result.put("eme",eme);
|
|
|
|
|
|
/************************ 安防********/
|
|
|
secu.put("status_-2", 0);//误报警
|
|
|
secu.put("status_-1", 0);//已取消
|
|
|
secu.put("status_0", 0);//已完成
|
|
|
secu.put("status_1", 0);//预警中
|
|
|
secu.put("status_all", 0);//
|
|
|
secu.put("svr_all", 0);//
|
|
|
Map<String, String> serverTmp = new HashMap<>();
|
|
|
sql = " select py_code,dict_value from wlyy_hospital_sys_dict where dict_name='security_server_dict' ";
|
|
|
List<Map<String, Object>> servers = jdbcTemplate.queryForList(sql);
|
|
|
for (Map<String, Object> server : servers) {
|
|
|
secu.put("svr_" + server.get("py_code").toString(), 0);
|
|
|
serverTmp.put(server.get("dict_value").toString(), server.get("py_code").toString());
|
|
|
}
|
|
|
sql = "select ord.status,ord.serve_desc,count(distinct ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
|
|
|
" INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 where ph.doctor='"+doctor+"' ";
|
|
|
String fliter = " ";
|
|
|
fliter += " group by ord.status";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql + fliter);
|
|
|
|
|
|
for (Map<String, Object> map : sqlResult) {
|
|
|
secu.put("status_" + map.get("status"), secu.getInteger("status_" + map.get("status")) + Integer.parseInt(map.get("count").toString()));
|
|
|
secu.put("status_all", secu.getInteger("status_all") + Integer.parseInt(map.get("count").toString()));
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(status)){
|
|
|
sql += " and ord.status='"+status+"' ";
|
|
|
}
|
|
|
sqlResult = jdbcTemplate.queryForList(sql + fliter);
|
|
|
|
|
|
String pyCode = "";
|
|
|
for (Map<String, Object> map : sqlResult) {
|
|
|
pyCode = serverTmp.get(map.get("serve_desc")) == null ? null : serverTmp.get(map.get("serve_desc")).toString();
|
|
|
if (StringUtils.isNotBlank(pyCode)) {
|
|
|
secu.put("svr_" + pyCode, secu.getInteger("svr_" + pyCode) + Integer.parseInt(map.get("count").toString()));
|
|
|
secu.put("svr_all", secu.getInteger("svr_all") + Integer.parseInt(map.get("count").toString()));
|
|
|
}
|
|
|
return result;
|
|
|
}else {
|
|
|
String sql = " select count(distinct ord.id) from base_emergency_assistance_order ord INNER JOIN base_patient p on ord.patient = p.id and p.del=1 INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 " +
|
|
|
" where ph.doctor='"+doctor+"' " ;
|
|
|
Long emeCount = jdbcTemplate.queryForObject(sql,Long.class);
|
|
|
result.put("emeAll",emeCount);
|
|
|
sql = "select count(distinct ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = p.id and p.del=1 " +
|
|
|
" INNER JOIN base_patient_helper ph on p.id = ph.patient and ph.del=1 where ph.doctor='"+doctor+"' ";
|
|
|
String fliter = " ";
|
|
|
Long secuCount = jdbcTemplate.queryForObject(sql,Long.class);
|
|
|
result.put("secuAll",secuCount);
|
|
|
}
|
|
|
result.put("secu",secu);
|
|
|
|
|
|
/************************ 安防、紧急总数********/
|
|
|
sql = " select count(distinct ord.id) from base_emergency_assistance_order ord INNER JOIN base_patient p on ord.patient = p.id and p.del=1 INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 " +
|
|
|
" where ph.doctor='"+doctor+"' " ;
|
|
|
Long emeCount = jdbcTemplate.queryForObject(sql,Long.class);
|
|
|
emeAndSecu.put("emeAll",emeCount);
|
|
|
sql = "select count(distinct ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = p.id and p.del=1 " +
|
|
|
" INNER JOIN base_patient_helper ph on p.id = ph.patient and ph.del=1 where ph.doctor='"+doctor+"' ";
|
|
|
fliter = " ";
|
|
|
Long secuCount = jdbcTemplate.queryForObject(sql,Long.class);
|
|
|
emeAndSecu.put("secuAll",secuCount);
|
|
|
result.put("emeAndSecu",emeAndSecu);
|
|
|
return result;
|
|
|
}
|
|
|
|