|
@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.yihu.jw.care.dao.pushLog.*;
|
|
import com.yihu.jw.care.dao.pushLog.*;
|
|
import com.yihu.jw.care.service.device.PatientDeviceService;
|
|
import com.yihu.jw.care.service.device.PatientDeviceService;
|
|
|
|
import com.yihu.jw.care.util.DingdingUtil;
|
|
import com.yihu.jw.care.util.MessageUtil;
|
|
import com.yihu.jw.care.util.MessageUtil;
|
|
import com.yihu.jw.dict.service.BaseCopywritingService;
|
|
import com.yihu.jw.dict.service.BaseCopywritingService;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
@ -62,6 +63,8 @@ public class ZhaohuiDailyService {
|
|
private ZhaohuifireGasSecDao zhaohuifireGasSecDao;
|
|
private ZhaohuifireGasSecDao zhaohuifireGasSecDao;
|
|
@Autowired
|
|
@Autowired
|
|
private BaseCopywritingService dictService;
|
|
private BaseCopywritingService dictService;
|
|
|
|
@Autowired
|
|
|
|
private DingdingUtil dingdingUtil;
|
|
|
|
|
|
|
|
|
|
public void allRound() {
|
|
public void allRound() {
|
|
@ -164,7 +167,7 @@ public class ZhaohuiDailyService {
|
|
}*/
|
|
}*/
|
|
|
|
|
|
|
|
|
|
zhaohuiDailyEntity.setMessage(old.getName()+sex+","+message);
|
|
|
|
|
|
zhaohuiDailyEntity.setMessage("【"+old.getName()+"】"+sex+","+message);
|
|
|
|
|
|
|
|
|
|
String lifeSql = "select count(id) from base_life_care_order where patient = '" + oldId + "' and status = 1 and create_time>= '" + stateDate + "' and create_time<= '" + endDate + "' and status <> -1";
|
|
String lifeSql = "select count(id) from base_life_care_order where patient = '" + oldId + "' and status = 1 and create_time>= '" + stateDate + "' and create_time<= '" + endDate + "' and status <> -1";
|
|
@ -436,25 +439,51 @@ public class ZhaohuiDailyService {
|
|
String secMessage = "";
|
|
String secMessage = "";
|
|
String deviceMessage = "";
|
|
String deviceMessage = "";
|
|
//判断是否存在预警
|
|
//判断是否存在预警
|
|
secSql = "select serve_desc,status total,serve_desc from base_security_monitoring_order where patient= '" + oldId + "' and create_time>='" + stateDate + "' and create_time<='" + endDate + "' and status <> -1 order by create_time DESC ";
|
|
|
|
|
|
//secSql = "select ,status total,serve_desc from base_emergency_assistance_order where patient= '" + oldId + "' and create_time>='" + stateDate + "' and create_time<='" + endDate + "' and status <> -1 order by create_time DESC ";
|
|
|
|
|
|
|
|
secSql = "SELECT sum(a.total) total FROM (\n" +
|
|
|
|
"SELECT count(id) total FROM base_emergency_assistance_order WHERE patient ='"+oldId+"' and create_time>='" + stateDate + "' and create_time<='" + endDate + "' and status <> -1 \n" +
|
|
|
|
"UNION ALL \n" +
|
|
|
|
"SELECT count(id) total FROM base_security_monitoring_order WHERE patient ='"+oldId+"' and create_time>='" + stateDate + "' and create_time<='" + endDate + "' and status <> -1 \n" +
|
|
|
|
") a ";
|
|
|
|
|
|
|
|
String emeSecstatusSql = "SELECT count(a.total) total, a.`status`,a.serve_desc FROM (\n" +
|
|
|
|
" SELECT '紧急预警' as serve_desc,count(o.id) total ,o.`status` AS `status` FROM base_emergency_assistance_order o WHERE o.patient ='"+oldId+"' and o.status <> -1 AND o.create_time >='"+stateDate+"' AND o.create_time<='"+endDate+"' GROUP BY o.`status`\n" +
|
|
|
|
" UNION ALL\n" +
|
|
|
|
" SELECT o.serve_desc as serve_desc,count(o.id) total ,o.`status` AS `status` FROM base_security_monitoring_order o WHERE o.patient ='"+oldId+"' and o.status <> -1 AND o.create_time >='"+stateDate+"' AND o.create_time<='"+endDate+"' GROUP BY o.`status`\n" +
|
|
|
|
" ) a GROUP BY a.`status`";
|
|
|
|
|
|
list = jdbcTemplate.queryForList(secSql);
|
|
list = jdbcTemplate.queryForList(secSql);
|
|
if (list.size() > 0) {
|
|
|
|
|
|
List<Map<String, Object>> emeSecStatusList = jdbcTemplate.queryForList(emeSecstatusSql);
|
|
|
|
|
|
|
|
Integer statusNUm = 0;
|
|
|
|
if (emeSecStatusList.size() > 0) {
|
|
|
|
for (Map<String, Object> stringObjectMap : emeSecStatusList) {
|
|
|
|
Integer.parseInt(stringObjectMap.get("status").toString());
|
|
|
|
if (0 == Integer.parseInt(stringObjectMap.get("status").toString())) {
|
|
|
|
statusNUm += Integer.parseInt(stringObjectMap.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Integer secemeTotal = Integer.parseInt(list.get(0).get("total").toString());
|
|
|
|
if (secemeTotal>0&&statusNUm >= 0) {
|
|
secMessage = dictService.findCopywriting("zhaohui_dailyReport", "family_eme1");
|
|
secMessage = dictService.findCopywriting("zhaohui_dailyReport", "family_eme1");
|
|
secMessage = secMessage.replace("<serve>",list.get(0).get("serve_desc").toString()).replace("<status>","");
|
|
|
|
|
|
secMessage = secMessage.replace("<serve>",emeSecStatusList.get(0).get("serve_desc").toString()).replace("<status>",(secemeTotal-statusNUm)>0?"未处理完":"已处理完");
|
|
}else {
|
|
}else {
|
|
secMessage = dictService.findCopywriting("zhaohui_dailyReport", "family_eme2");
|
|
secMessage = dictService.findCopywriting("zhaohui_dailyReport", "family_eme2");
|
|
}
|
|
}
|
|
|
|
|
|
if (deviceTotal>0) {
|
|
if (deviceTotal>0) {
|
|
deviceMessage = dictService.findCopywriting("zhaohui_dailyReport", "family_device1");
|
|
deviceMessage = dictService.findCopywriting("zhaohui_dailyReport", "family_device1");
|
|
deviceMessage.replace("<deviceName>",deviceName.replace(",",""));
|
|
|
|
|
|
deviceMessage = deviceMessage.replace("<deviceName>", deviceName.substring(1));
|
|
}else {
|
|
}else {
|
|
deviceMessage = dictService.findCopywriting("zhaohui_dailyReport", "family_device2");
|
|
deviceMessage = dictService.findCopywriting("zhaohui_dailyReport", "family_device2");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zhaohuiDailyEntity.setMessage(old.getName()+sex+secMessage+deviceMessage);
|
|
|
|
|
|
zhaohuiDailyEntity.setMessage("【"+old.getName()+"】"+sex+secMessage+","+deviceMessage);
|
|
zhaohuiDailyDao.save(zhaohuiDailyEntity);
|
|
zhaohuiDailyDao.save(zhaohuiDailyEntity);
|
|
|
|
|
|
|
|
|
|
@ -469,7 +498,7 @@ public class ZhaohuiDailyService {
|
|
messageUtil.putTemplateWxMessage(wxId,"template_zhrb","zhrb","123456",first,null,null,1,null,"",key2+"",liftOlderTotal+"","【推送完成】",DateUtil.getStringDate());
|
|
messageUtil.putTemplateWxMessage(wxId,"template_zhrb","zhrb","123456",first,null,null,1,null,"",key2+"",liftOlderTotal+"","【推送完成】",DateUtil.getStringDate());
|
|
*/
|
|
*/
|
|
|
|
|
|
wxPush(old.getName(),familyCode, zhaohuiDailyEntity.getService(), emeTotal);
|
|
|
|
|
|
//wxPush(old.getName(),familyCode, zhaohuiDailyEntity.getService(), emeTotal);
|
|
|
|
|
|
zhaohuiDailySleepDao.save(zhaohuiDailySleepList);
|
|
zhaohuiDailySleepDao.save(zhaohuiDailySleepList);
|
|
zhaohuiDailyWatchDao.save(zhaohuiDailyWatchList);
|
|
zhaohuiDailyWatchDao.save(zhaohuiDailyWatchList);
|
|
@ -521,7 +550,10 @@ public class ZhaohuiDailyService {
|
|
List<ZhaohuiDailyEntity> zhaohuiDailyEntityList = new ArrayList<>();
|
|
List<ZhaohuiDailyEntity> zhaohuiDailyEntityList = new ArrayList<>();
|
|
for (Map<String, Object> map : orgList) {
|
|
for (Map<String, Object> map : orgList) {
|
|
ZhaohuiDailyEntity zhaohuiDailyEntity = new ZhaohuiDailyEntity();
|
|
ZhaohuiDailyEntity zhaohuiDailyEntity = new ZhaohuiDailyEntity();
|
|
String dailySql = "SELECT count(d.id) as total ,GROUP_CONCAT(patient_name) as patientName,sum(eme_num) as emeNum,SUM(service) as serviceNum FROM base_zhaohui_daily d INNER JOIN base_team t ON d.org_code = t.id where d.org_code = '"+map.get("id")+"' and d.user_type = 1 and d.create_time >= '"+stateDate+"' and d.create_time<= '"+endDate+"' GROUP BY d.org_code ";
|
|
|
|
|
|
//String dailySql = "SELECT DISTINCT d.patient ,count(d.id) as total,GROUP_CONCAT(patient_name) as patientName,sum(eme_num) as emeNum,SUM(service) as serviceNum FROM base_zhaohui_daily d INNER JOIN base_team t ON d.org_code = t.id where d.org_code = '"+map.get("id")+"' and d.user_type = 1 and d.create_time >= '"+stateDate+"' and d.create_time<= '"+endDate+"' GROUP BY d.org_code ";
|
|
|
|
|
|
|
|
String dailySql = "SELECT count( DISTINCT a.patient ) AS total,GROUP_CONCAT(DISTINCT a.patient ) patientS , GROUP_CONCAT(DISTINCT a.patient_name ) AS patientName,sum( a.eme_num ) AS emeNum, SUM( a.service ) AS serviceNum FROM (\n" +
|
|
|
|
"SELECT DISTINCT patient,patient_name,service,eme_num,org_code FROM base_zhaohui_daily WHERE org_code = '"+map.get("id")+"' AND user_type = 1 AND create_time >= '"+stateDate+"' AND create_time <= '"+endDate+"') a GROUP BY org_code";
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(dailySql);
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(dailySql);
|
|
if (list.size()>0) {
|
|
if (list.size()>0) {
|
|
String message = "";
|
|
String message = "";
|
|
@ -549,22 +581,27 @@ public class ZhaohuiDailyService {
|
|
zhaohuiDailyEntity.setCreateTime(new Date());
|
|
zhaohuiDailyEntity.setCreateTime(new Date());
|
|
zhaohuiDailyEntity.setServiceTime(stateDate+","+endDate);
|
|
zhaohuiDailyEntity.setServiceTime(stateDate+","+endDate);
|
|
if (flag) {
|
|
if (flag) {
|
|
|
|
String[] patientS = list.get(0).get("patientS").toString().split(",");
|
|
|
|
Integer statusNUm = 0;
|
|
|
|
for (String patient : patientS) {
|
|
String emeSecstatusSql = "SELECT count(a.total) total, a.`status` FROM (\n" +
|
|
String emeSecstatusSql = "SELECT count(a.total) total, a.`status` FROM (\n" +
|
|
"SELECT count(o.id) total ,o.`status` AS `status` FROM base_team t INNER JOIN base_service_package_sign_record r ON t.leader_code = r.sign_doctor INNER JOIN base_emergency_assistance_order o ON o.patient = r.patient WHERE t.id = '" + map.get("id") + "' and o.status <> -1 AND o.create_time >='" + stateDate + "' AND o.create_time<='" + endDate + "' GROUP BY o.`status`\n" +
|
|
|
|
"UNION ALL\n" +
|
|
|
|
"SELECT count(o.id) total ,o.`status` AS `status` FROM base_team t INNER JOIN base_service_package_sign_record r ON t.leader_code = r.sign_doctor INNER JOIN base_security_monitoring_order o ON o.patient = r.patient WHERE t.id = '" + map.get("id") + "' and o.status <> -1 AND o.create_time >='" + stateDate + "' AND o.create_time<='" + endDate + "' GROUP BY o.`status`\n" +
|
|
|
|
") a GROUP BY a.`status`";
|
|
|
|
|
|
" SELECT count(o.id) total ,o.`status` AS `status` FROM base_emergency_assistance_order o WHERE o.patient ='"+patient+"' and o.status <> -1 AND o.create_time >='"+stateDate+"' AND o.create_time<='"+endDate+"' GROUP BY o.`status`\n" +
|
|
|
|
" UNION ALL\n" +
|
|
|
|
" SELECT count(o.id) total ,o.`status` AS `status` FROM base_security_monitoring_order o WHERE o.patient ='"+patient+"' and o.status <> -1 AND o.create_time >='"+stateDate+"' AND o.create_time<='"+endDate+"' GROUP BY o.`status`\n" +
|
|
|
|
" ) a GROUP BY a.`status`";
|
|
List<Map<String, Object>> emeSecStatusList = jdbcTemplate.queryForList(emeSecstatusSql);
|
|
List<Map<String, Object>> emeSecStatusList = jdbcTemplate.queryForList(emeSecstatusSql);
|
|
Integer statusNUm = 0;
|
|
|
|
if (emeSecStatusList.size() > 0) {
|
|
|
|
for (Map<String, Object> stringObjectMap : emeSecStatusList) {
|
|
|
|
Integer.parseInt(stringObjectMap.get("status").toString());
|
|
|
|
if (0 == Integer.parseInt(stringObjectMap.get("status").toString())) {
|
|
|
|
statusNUm = Integer.parseInt(stringObjectMap.get("total").toString());
|
|
|
|
|
|
|
|
|
|
if (emeSecStatusList.size() > 0) {
|
|
|
|
for (Map<String, Object> stringObjectMap : emeSecStatusList) {
|
|
|
|
Integer.parseInt(stringObjectMap.get("status").toString());
|
|
|
|
if (0 == Integer.parseInt(stringObjectMap.get("status").toString())) {
|
|
|
|
statusNUm += Integer.parseInt(stringObjectMap.get("total").toString());
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (statusNUm == emeNum||statusNUm<emeNum) {
|
|
|
|
|
|
|
|
|
|
if (statusNUm == emeNum||statusNUm>emeNum) {
|
|
message += ","+dictService.findCopywriting("zhaohui_dailyReport", "doctor_emeStatus2");
|
|
message += ","+dictService.findCopywriting("zhaohui_dailyReport", "doctor_emeStatus2");
|
|
}else {
|
|
}else {
|
|
message += ","+dictService.findCopywriting("zhaohui_dailyReport", "doctor_emeStatus1").replace("<num>",(emeNum-statusNUm)+"");
|
|
message += ","+dictService.findCopywriting("zhaohui_dailyReport", "doctor_emeStatus1").replace("<num>",(emeNum-statusNUm)+"");
|
|
@ -576,6 +613,24 @@ public class ZhaohuiDailyService {
|
|
}
|
|
}
|
|
|
|
|
|
zhaohuiDailyDao.save(zhaohuiDailyEntityList);
|
|
zhaohuiDailyDao.save(zhaohuiDailyEntityList);
|
|
|
|
|
|
|
|
|
|
|
|
String sql = "SELECT d.id AS doctorId ,d.ykt_doctor_id as yktDoctorId,t.id FROM base_doctor d INNER JOIN base_team_member m ON d.id = m.doctor_code INNER JOIN base_team t ON m.team_code = t.id " +
|
|
|
|
" WHERE d.doctor_level = 2 AND t.org_code = 'zdjsylfwyxgszhfgs' AND d.ykt_doctor_id IS NOT NULL";
|
|
|
|
List<Map<String, Object>> doctorList = jdbcTemplate.queryForList(sql);
|
|
|
|
//社区
|
|
|
|
for (Map<String, Object> map : doctorList) {
|
|
|
|
for (ZhaohuiDailyEntity zhaohuiDailyEntity : zhaohuiDailyEntityList) {
|
|
|
|
if (zhaohuiDailyEntity.getOrgCode().equals(map.get("doctorId"))) {
|
|
|
|
dingdingUtil.sendP2pMsg(zhaohuiDailyEntity.getMessage(),map.get("yktDoctorId").toString());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|