|
@ -1,4 +1,5 @@
|
|
package com.yihu.jw.healthUpload.service;
|
|
package com.yihu.jw.healthUpload.service;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
|
@ -16,9 +17,11 @@ import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
|
|
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
|
|
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
|
|
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
|
|
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
|
|
import com.yihu.jw.entity.hospital.DmHospitalDO;
|
|
import com.yihu.jw.entity.hospital.DmHospitalDO;
|
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
import com.yihu.jw.entity.hospital.dict.BaseDeptDict;
|
|
import com.yihu.jw.entity.hospital.dict.BaseDeptDict;
|
|
import com.yihu.jw.healthUpload.dao.BaseDoctorHealthUploadDao;
|
|
import com.yihu.jw.healthUpload.dao.BaseDoctorHealthUploadDao;
|
|
import com.yihu.jw.healthUpload.dao.BaseDoctorMemberDao;
|
|
import com.yihu.jw.healthUpload.dao.BaseDoctorMemberDao;
|
|
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
|
|
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
import com.yihu.jw.util.common.PwdUtil;
|
|
import com.yihu.jw.util.common.PwdUtil;
|
|
@ -78,6 +81,8 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
private HibenateUtils hibenateUtils;
|
|
private HibenateUtils hibenateUtils;
|
|
@Value("${wechat.id}")
|
|
@Value("${wechat.id}")
|
|
private String wechatId;
|
|
private String wechatId;
|
|
|
|
@Autowired
|
|
|
|
private WlyyHospitalSysDictDao hospitalSysDictDao;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 新增医生成员关系
|
|
* 新增医生成员关系
|
|
@ -201,36 +206,94 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
for (BaseDoctorRoleDO roleDO : roleDOS) {
|
|
for (BaseDoctorRoleDO roleDO : roleDOS) {
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(roleDO.getDoctorCode());
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(roleDO.getDoctorCode());
|
|
if (doctorDO != null) {
|
|
if (doctorDO != null) {
|
|
if (!StringUtils.isNoneBlank(doctorDO.getOpenid())) {
|
|
|
|
logger.info("该用户" + doctorDO.getName() + "没有openid,无法推送模版消息,用户ID:" + doctorDO.getId() + "wechatId:xm_mlwyy_wx");
|
|
|
|
} else {
|
|
|
|
WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus("xm_mlwyy_wx", "template_unusual_notice", "jkzlyctxtz", 1);
|
|
|
|
WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
|
|
|
|
BeanUtils.copyProperties(config, newConfig);
|
|
|
|
if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
|
|
|
|
newConfig.setFirst(config.getFirst().replace("key1", doctorHospitalDOS.get(0).getDeptName()).replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
|
|
|
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isYichangRemind");
|
|
|
|
if (hospitalSysDictDO!=null){
|
|
|
|
String value = hospitalSysDictDO.getDictValue();
|
|
|
|
if (StringUtils.isNoneBlank(value)){
|
|
|
|
JSONObject object = JSONObject.parseObject(value);
|
|
|
|
String close = object.getString("close");
|
|
|
|
String time = object.getString("time");
|
|
|
|
String count =object.getString("count");
|
|
|
|
if (!close.equalsIgnoreCase("1")){
|
|
|
|
String startEnd = DateUtil.getPreTime(DateUtil.getStringDate(),time);
|
|
|
|
String sql = "select count(1) as total from wx_push_log where create_time >='"+startEnd+"' ";
|
|
|
|
Map<String,Object> map = jdbcTemplate.queryForMap(sql);
|
|
|
|
Integer total = 0;
|
|
|
|
|
|
|
|
if (map!=null){
|
|
|
|
if (map.get("total")!=null){
|
|
|
|
total = Integer.parseInt(map.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("startEnd:"+startEnd+total);
|
|
|
|
if (StringUtils.isNoneBlank(count)){
|
|
|
|
if (total<Integer.parseInt(count)){
|
|
|
|
if (!StringUtils.isNoneBlank(doctorDO.getOpenid())) {
|
|
|
|
logger.info("该用户" + doctorDO.getName() + "没有openid,无法推送模版消息,用户ID:" + doctorDO.getId() + "wechatId:xm_mlwyy_wx");
|
|
|
|
} else {
|
|
|
|
WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus("xm_mlwyy_wx", "template_unusual_notice", "jkzlyctxtz", 1);
|
|
|
|
WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
|
|
|
|
BeanUtils.copyProperties(config, newConfig);
|
|
|
|
if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
|
|
|
|
newConfig.setFirst(config.getFirst().replace("key1", doctorHospitalDOS.get(0).getDeptName()).replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
|
|
|
|
} else {
|
|
|
|
newConfig.setFirst(config.getFirst().replace("key1的", "").replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
|
|
|
|
}
|
|
|
|
newConfig.setKeyword2(baseDoctorHealthUploadDO.getDoctorName());
|
|
|
|
newConfig.setKeyword3(DateUtil.getStringDate());
|
|
|
|
newConfig.setUrl("https://ehr.yihu.com/hlwyy/healthMonitoring/#/health/commit?id=" + baseDoctorHealthUploadDO.getId() + "&docCode=" + baseDoctorHealthUploadDO.getDoctorId() + "");
|
|
|
|
WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById("xm_mlwyy_wx");
|
|
|
|
logger.info("=======setUrl========" + newConfig.getUrl());
|
|
|
|
weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), doctorDO.getOpenid(), newConfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
//保存发送模板记录,
|
|
|
|
WxPushLogDO wxPushLogDO = new WxPushLogDO();
|
|
|
|
wxPushLogDO.setCreateTime(new Date());
|
|
|
|
wxPushLogDO.setOpenid(doctorDO.getOpenid());
|
|
|
|
wxPushLogDO.setReceiver(doctorDO.getId());
|
|
|
|
wxPushLogDO.setWechatId("xm_mlwyy_wx");
|
|
|
|
wxPushLogDO.setReceiverName(doctorDO.getName());
|
|
|
|
wxPushLogDO.setScene("jkzlyctxtz");
|
|
|
|
wxPushLogDao.save(wxPushLogDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
if (!StringUtils.isNoneBlank(doctorDO.getOpenid())) {
|
|
|
|
logger.info("该用户" + doctorDO.getName() + "没有openid,无法推送模版消息,用户ID:" + doctorDO.getId() + "wechatId:xm_mlwyy_wx");
|
|
} else {
|
|
} else {
|
|
newConfig.setFirst(config.getFirst().replace("key1的", "").replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
|
|
|
|
|
|
WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus("xm_mlwyy_wx", "template_unusual_notice", "jkzlyctxtz", 1);
|
|
|
|
WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
|
|
|
|
BeanUtils.copyProperties(config, newConfig);
|
|
|
|
if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
|
|
|
|
newConfig.setFirst(config.getFirst().replace("key1", doctorHospitalDOS.get(0).getDeptName()).replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
|
|
|
|
} else {
|
|
|
|
newConfig.setFirst(config.getFirst().replace("key1的", "").replace("key2", baseDoctorHealthUploadDO.getDoctorName()));
|
|
|
|
}
|
|
|
|
newConfig.setKeyword2(baseDoctorHealthUploadDO.getDoctorName());
|
|
|
|
newConfig.setKeyword3(DateUtil.getStringDate());
|
|
|
|
newConfig.setUrl("https://ehr.yihu.com/hlwyy/healthMonitoring/#/health/commit?id=" + baseDoctorHealthUploadDO.getId() + "&docCode=" + baseDoctorHealthUploadDO.getDoctorId() + "");
|
|
|
|
WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById("xm_mlwyy_wx");
|
|
|
|
logger.info("=======setUrl========" + newConfig.getUrl());
|
|
|
|
weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), doctorDO.getOpenid(), newConfig);
|
|
}
|
|
}
|
|
newConfig.setKeyword2(baseDoctorHealthUploadDO.getDoctorName());
|
|
|
|
newConfig.setKeyword3(DateUtil.getStringDate());
|
|
|
|
newConfig.setUrl("https://ehr.yihu.com/hlwyy/healthMonitoring/#/health/commit?id=" + baseDoctorHealthUploadDO.getId() + "&docCode=" + baseDoctorHealthUploadDO.getDoctorId() + "");
|
|
|
|
WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById("xm_mlwyy_wx");
|
|
|
|
logger.info("=======setUrl========" + newConfig.getUrl());
|
|
|
|
weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), doctorDO.getOpenid(), newConfig);
|
|
|
|
|
|
|
|
|
|
//保存发送模板记录,
|
|
|
|
WxPushLogDO wxPushLogDO = new WxPushLogDO();
|
|
|
|
wxPushLogDO.setCreateTime(new Date());
|
|
|
|
wxPushLogDO.setOpenid(doctorDO.getOpenid());
|
|
|
|
wxPushLogDO.setReceiver(doctorDO.getId());
|
|
|
|
wxPushLogDO.setWechatId("xm_mlwyy_wx");
|
|
|
|
wxPushLogDO.setReceiverName(doctorDO.getName());
|
|
|
|
wxPushLogDO.setScene("jkzlyctxtz");
|
|
|
|
wxPushLogDao.save(wxPushLogDO);
|
|
}
|
|
}
|
|
//保存发送模板记录,
|
|
|
|
WxPushLogDO wxPushLogDO = new WxPushLogDO();
|
|
|
|
wxPushLogDO.setCreateTime(new Date());
|
|
|
|
wxPushLogDO.setOpenid(doctorDO.getOpenid());
|
|
|
|
wxPushLogDO.setReceiver(doctorDO.getId());
|
|
|
|
wxPushLogDO.setWechatId("xm_mlwyy_wx");
|
|
|
|
wxPushLogDO.setReceiverName(doctorDO.getName());
|
|
|
|
wxPushLogDO.setScene("jkzlyctxtz");
|
|
|
|
wxPushLogDao.save(wxPushLogDO);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@ -414,14 +477,24 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
//今日上报人次
|
|
//今日上报人次
|
|
sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' ";
|
|
sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' ";
|
|
//今日异常人次
|
|
//今日异常人次
|
|
yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR d.is_symptoms=1 OR d.is_epidemic=1)";
|
|
|
|
|
|
yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from ( SELECT\n" +
|
|
|
|
"\td3.*\n" +
|
|
|
|
"FROM\n" +
|
|
|
|
"\t( SELECT *,MAX(d1.create_time) as createTime FROM base_doctor_health_upload d1 GROUP BY\n" +
|
|
|
|
"\td1.doctor_id ) d2\n" +
|
|
|
|
"LEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id=d3.doctor_id AND d2.createTime = d3.create_time ) d where 1=1 and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR d.is_symptoms=1 OR d.is_epidemic=1)";
|
|
} else if (level == 2) {
|
|
} else if (level == 2) {
|
|
//总人次
|
|
//总人次
|
|
doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 and id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
|
|
doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 and id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
|
|
//今日上报人次
|
|
//今日上报人次
|
|
sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59'";
|
|
sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59'";
|
|
//今日异常人次
|
|
//今日异常人次
|
|
yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR d.is_symptoms=1 OR d.is_epidemic=1)";
|
|
|
|
|
|
yichangSql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from ( SELECT\n" +
|
|
|
|
"\td3.*\n" +
|
|
|
|
"FROM\n" +
|
|
|
|
"\t( SELECT *,MAX(d1.create_time) as createTime FROM base_doctor_health_upload d1 GROUP BY\n" +
|
|
|
|
"\td1.doctor_id ) d2\n" +
|
|
|
|
"LEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id=d3.doctor_id AND d2.createTime = d3.create_time ) d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) and d.create_time >='" + nowDate + " 00:00:00' and d.create_time<='" + nowDate + " 23:59:59' and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR d.is_symptoms=1 OR d.is_epidemic=1)";
|
|
}
|
|
}
|
|
//今日提交
|
|
//今日提交
|
|
int personTotal = 0;
|
|
int personTotal = 0;
|
|
@ -670,7 +743,137 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public List<Map<String, Object>> selectHeaderList(String dept, String idType, String status, String state, String startDate, String endDate, String name) {
|
|
public List<Map<String, Object>> selectHeaderList(String dept, String idType, String status, String state, String startDate, String endDate, String name) {
|
|
String deptSql = " select code,name from dict_hospital_dept hd where hd.consult_dept_flag=1 ";
|
|
|
|
|
|
String condition = "";
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
|
|
condition += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
|
|
|
|
}
|
|
|
|
String doctorSql = "";
|
|
|
|
if (StringUtils.isNoneBlank(idType)) {
|
|
|
|
doctorSql += " and d.id_type = '" + idType + "' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
|
doctorSql += " and d.name like '%" + name + "%' ";
|
|
|
|
}
|
|
|
|
String sql = "";
|
|
|
|
if (StringUtils.isNoneBlank(state)) {
|
|
|
|
if (state.equalsIgnoreCase("1")) {
|
|
|
|
sql += " and (d.health_code not in(2,3) and CAST(d.temperature as DECIMAL)<37.3 and d.is_symptoms=2 and d.is_epidemic=2) ";
|
|
|
|
} else if (state.equalsIgnoreCase("2")) {
|
|
|
|
sql += " and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR d.is_symptoms=1 OR d.is_epidemic=1) ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String idTypeCondition = " ";
|
|
|
|
if (StringUtils.isNoneBlank(idType)) {
|
|
|
|
idTypeCondition += " (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '" + idType + "')";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(idTypeCondition)) {
|
|
|
|
sql += " and d.doctor_id IN " + idTypeCondition;
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
|
sql += " and d.doctor_name like '%" + name + "%'";
|
|
|
|
}
|
|
|
|
String ycandzcSql = "";
|
|
|
|
if (StringUtils.isNoneBlank(idTypeCondition)) {
|
|
|
|
ycandzcSql += " and d.doctor_id IN " + idTypeCondition;
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
|
ycandzcSql += " and d.doctor_name like '%" + name + "%'";
|
|
|
|
}
|
|
|
|
String deptSql = "SELECT\n" +
|
|
|
|
"\tcode,\n" +
|
|
|
|
"\tname,\n" +
|
|
|
|
"\tdh1.total,\n" +
|
|
|
|
"\tdh2.total as yishangbaoTotal,\n" +
|
|
|
|
"\tdh3.total as shangchuanTotal,\n" +
|
|
|
|
"\tdh4.total as zhengchangTotal,\n" +
|
|
|
|
"\tdh5.total as yichangTotal,\n" +
|
|
|
|
"\tdh6.total as yichangPersonTotal\n" +
|
|
|
|
"FROM\n" +
|
|
|
|
"\tdict_hospital_dept hd\n" +
|
|
|
|
"LEFT JOIN (\n" +
|
|
|
|
"\tSELECT\n" +
|
|
|
|
"\t\tdh.dept_code,\n" +
|
|
|
|
"\t\tCOUNT(1) AS \"total\"\n" +
|
|
|
|
"\tFROM\n" +
|
|
|
|
"\t\tbase_doctor d\n" +
|
|
|
|
"\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id\n" +
|
|
|
|
"\tWHERE\n" +
|
|
|
|
"\t\td.del = 1\n" +
|
|
|
|
"\tAND dh.del = 1\n" +
|
|
|
|
doctorSql+
|
|
|
|
"\tGROUP BY\n" +
|
|
|
|
"\t\tdh.dept_code\n" +
|
|
|
|
") dh1 ON hd. CODE = dh1.dept_code\n" +
|
|
|
|
"LEFT JOIN (\n" +
|
|
|
|
"\tSELECT\n" +
|
|
|
|
"\t\tdh.dept_code,\n" +
|
|
|
|
"\t\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
|
|
|
|
"\tFROM\n" +
|
|
|
|
"\t\tbase_doctor_health_upload d\n" +
|
|
|
|
"\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" +
|
|
|
|
"\tWHERE\n" +
|
|
|
|
"\t\t1 = 1\n" +
|
|
|
|
condition+ sql+
|
|
|
|
"\tGROUP BY\n" +
|
|
|
|
"\t\tdh.dept_code\n" +
|
|
|
|
")dh2 ON dh2.dept_code=hd.code\n" +
|
|
|
|
"LEFT JOIN (\n" +
|
|
|
|
"\tSELECT\n" +
|
|
|
|
"\t\tdh.dept_code,\n" +
|
|
|
|
"\t\tCOUNT(1) AS total\n" +
|
|
|
|
"\tFROM\n" +
|
|
|
|
"\t\tbase_doctor_health_upload d\n" +
|
|
|
|
"\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" +
|
|
|
|
"\tWHERE\n" +
|
|
|
|
"\t\t1 = 1\n" +
|
|
|
|
condition+ sql+
|
|
|
|
"\tGROUP BY\n" +
|
|
|
|
"\t\tdh.dept_code\n" +
|
|
|
|
")dh3 ON dh3.dept_code=hd.code\n" +
|
|
|
|
"LEFT JOIN (\n" +
|
|
|
|
"\tSELECT\n" +
|
|
|
|
"\t\tdh.dept_code,\n" +
|
|
|
|
"\t\tCOUNT(1) AS total\n" +
|
|
|
|
"\tFROM\n" +
|
|
|
|
"\t\tbase_doctor_health_upload d\n" +
|
|
|
|
"\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" +
|
|
|
|
"\tWHERE\n" +
|
|
|
|
"\t\t1 = 1\n" +
|
|
|
|
"\tand (d.health_code not in(2,3) AND CAST(d.temperature as DECIMAL)<37.3 AND d.is_symptoms=2 and d.is_epidemic=2)\n" +
|
|
|
|
condition+ycandzcSql+
|
|
|
|
"\tGROUP BY\n" +
|
|
|
|
"\t\tdh.dept_code\n" +
|
|
|
|
")dh4 ON dh4.dept_code=hd.code\n" +
|
|
|
|
"LEFT JOIN (\n" +
|
|
|
|
"\tSELECT\n" +
|
|
|
|
"\t\tdh.dept_code,\n" +
|
|
|
|
"\t\tCOUNT(1) AS total\n" +
|
|
|
|
"\tFROM\n" +
|
|
|
|
"\t\tbase_doctor_health_upload d\n" +
|
|
|
|
"\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" +
|
|
|
|
"\tWHERE\n" +
|
|
|
|
"\t\t1 = 1\n" +
|
|
|
|
"\tand (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR d.is_symptoms=1 OR d.is_epidemic=1)\n" +
|
|
|
|
condition+ycandzcSql+
|
|
|
|
"\tGROUP BY\n" +
|
|
|
|
"\t\tdh.dept_code\n" +
|
|
|
|
")dh5 ON dh5.dept_code=hd.code\n" +
|
|
|
|
"LEFT JOIN (\n" +
|
|
|
|
"\tSELECT\n" +
|
|
|
|
"\t\tdh.dept_code,\n" +
|
|
|
|
"\t\tCOUNT(DISTINCT d.doctor_id) AS total\n" +
|
|
|
|
"\tFROM\n" +
|
|
|
|
"\t\tbase_doctor_health_upload d\n" +
|
|
|
|
"\tLEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.doctor_id\n" +
|
|
|
|
"\tWHERE\n" +
|
|
|
|
"\t\t1 = 1\n" +
|
|
|
|
"\tand (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR d.is_symptoms=1 OR d.is_epidemic=1)\n" +
|
|
|
|
condition+ycandzcSql+
|
|
|
|
"\tGROUP BY\n" +
|
|
|
|
"\t\tdh.dept_code\n" +
|
|
|
|
")dh6 ON dh6.dept_code=hd.code\n" +
|
|
|
|
"WHERE\n" +
|
|
|
|
"\thd.consult_dept_flag = 1 ";
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
deptSql += " and hd.code IN(SELECT dha.dept_code FROM base_doctor_hospital dha LEFT JOIN base_doctor da ON da.id=dha.doctor_code where da.name LIKE '%" + name + "%') ";
|
|
deptSql += " and hd.code IN(SELECT dha.dept_code FROM base_doctor_hospital dha LEFT JOIN base_doctor da ON da.id=dha.doctor_code where da.name LIKE '%" + name + "%') ";
|
|
}
|
|
}
|
|
@ -678,6 +881,62 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
deptSql += " and hd.code = '" + dept + "' ";
|
|
deptSql += " and hd.code = '" + dept + "' ";
|
|
}
|
|
}
|
|
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql);
|
|
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql);
|
|
|
|
for (Map<String,Object> deptMap:mapList){
|
|
|
|
String day = DateUtil.getTwoDay(endDate, startDate);
|
|
|
|
Integer total = 0;
|
|
|
|
Integer yishangbaoTotal = 0;
|
|
|
|
Integer weishangbaoTotal = 0;
|
|
|
|
Integer zhengchangTotal = 0;
|
|
|
|
Integer yichangTotal = 0;
|
|
|
|
Integer shangchuanTotal = 0;
|
|
|
|
Integer yichangPersonTotal = 0;
|
|
|
|
if (deptMap.get("total")!=null){
|
|
|
|
String doctorTotal = deptMap.get("total").toString();
|
|
|
|
//总人次
|
|
|
|
if (!day.equalsIgnoreCase("0")) {
|
|
|
|
total = Integer.parseInt(doctorTotal) * Integer.parseInt(day);
|
|
|
|
} else {
|
|
|
|
total = Integer.parseInt(doctorTotal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (deptMap.get("yishangbaoTotal")!=null){
|
|
|
|
yishangbaoTotal = Integer.parseInt(deptMap.get("yishangbaoTotal").toString());
|
|
|
|
}
|
|
|
|
//未上报
|
|
|
|
weishangbaoTotal = total - yishangbaoTotal;
|
|
|
|
if (deptMap.get("zhengchangTotal")!=null){
|
|
|
|
zhengchangTotal = Integer.parseInt(deptMap.get("zhengchangTotal").toString());
|
|
|
|
}
|
|
|
|
if (deptMap.get("yichangTotal")!=null){
|
|
|
|
yichangTotal = Integer.parseInt(deptMap.get("yichangTotal").toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (deptMap.get("yichangPersonTotal")!=null){
|
|
|
|
yichangPersonTotal = Integer.parseInt(deptMap.get("yichangPersonTotal").toString());
|
|
|
|
}
|
|
|
|
if (deptMap.get("shangchuanTotal")!=null){
|
|
|
|
shangchuanTotal = Integer.parseInt(deptMap.get("shangchuanTotal").toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
object.put("total", total);//总人次
|
|
|
|
object.put("yishangbaoTotal", yishangbaoTotal);//已上报
|
|
|
|
object.put("weishangbaoTotal", weishangbaoTotal);//未上报
|
|
|
|
object.put("zhengchangTotal", zhengchangTotal);//上报正常
|
|
|
|
object.put("yichangTotal", yichangTotal);//上报异常
|
|
|
|
object.put("yichangPersonTotal", yichangPersonTotal);//上报人异常
|
|
|
|
object.put("shangchuanTotal", shangchuanTotal);//上传总次数
|
|
|
|
deptMap.put("tongyishuju", object);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* String deptSql = " select code,name from dict_hospital_dept hd where hd.consult_dept_flag=1 ";
|
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
|
deptSql += " and hd.code IN(SELECT dha.dept_code FROM base_doctor_hospital dha LEFT JOIN base_doctor da ON da.id=dha.doctor_code where da.name LIKE '%" + name + "%') ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
|
|
deptSql += " and hd.code = '" + dept + "' ";
|
|
|
|
}*/
|
|
|
|
/* List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql);
|
|
for (Map<String, Object> deptmap : mapList) {
|
|
for (Map<String, Object> deptmap : mapList) {
|
|
String deptCode = deptmap.get("code").toString();
|
|
String deptCode = deptmap.get("code").toString();
|
|
JSONObject object = new JSONObject();
|
|
JSONObject object = new JSONObject();
|
|
@ -810,21 +1069,49 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
sqlYichang += " and d.doctor_name like '%" + name + "%'";
|
|
sqlYichang += " and d.doctor_name like '%" + name + "%'";
|
|
}
|
|
}
|
|
//正常
|
|
|
|
|
|
//异常
|
|
Map<String, Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang);
|
|
Map<String, Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang);
|
|
if (yichangMap != null) {
|
|
if (yichangMap != null) {
|
|
if (yichangMap.get("total") != null) {
|
|
if (yichangMap.get("total") != null) {
|
|
yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
|
|
yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
String sqlDistintYichang = "select COUNT(DISTINCT doctor_id) as \"total\" from (SELECT\n" +
|
|
|
|
"\td3.*\n" +
|
|
|
|
"FROM\n" +
|
|
|
|
"\t( SELECT *,MAX(d1.create_time) as createTime FROM base_doctor_health_upload d1 GROUP BY\n" +
|
|
|
|
"\td1.doctor_id ) d2\n" +
|
|
|
|
"LEFT JOIN base_doctor_health_upload d3 ON d2.doctor_id=d3.doctor_id AND d2.createTime = d3.create_time ) d where 1=1 and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR d.is_symptoms=1 OR d.is_epidemic=1) ";
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
|
|
sqlDistintYichang += " and d.create_time >='" + startDate + " 00:00:00' and d.create_time<='" + endDate + " 23:59:59' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(deptCondition)) {
|
|
|
|
sqlDistintYichang += " and d.doctor_id IN " + deptCondition;
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(idTypeCondition)) {
|
|
|
|
sqlDistintYichang += " and d.doctor_id IN " + idTypeCondition;
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
|
sqlDistintYichang += " and d.doctor_name like '%" + name + "%'";
|
|
|
|
}
|
|
|
|
Integer yichangPersonTotal =0;
|
|
|
|
//异常
|
|
|
|
Map<String, Object> sqlDistintYichangMap = jdbcTemplate.queryForMap(sqlDistintYichang);
|
|
|
|
if (sqlDistintYichangMap != null) {
|
|
|
|
if (sqlDistintYichangMap.get("total") != null) {
|
|
|
|
yichangPersonTotal = Integer.parseInt(sqlDistintYichangMap.get("total").toString());
|
|
|
|
}
|
|
|
|
}
|
|
object.put("total", total);//总人次
|
|
object.put("total", total);//总人次
|
|
object.put("yishangbaoTotal", yishangbaoTotal);//已上报
|
|
object.put("yishangbaoTotal", yishangbaoTotal);//已上报
|
|
object.put("weishangbaoTotal", weishangbaoTotal);//未上报
|
|
object.put("weishangbaoTotal", weishangbaoTotal);//未上报
|
|
object.put("zhengchangTotal", zhengchangTotal);//上报正常
|
|
object.put("zhengchangTotal", zhengchangTotal);//上报正常
|
|
object.put("yichangTotal", yichangTotal);//上报异常
|
|
object.put("yichangTotal", yichangTotal);//上报异常
|
|
|
|
object.put("yichangPersonTotal", yichangPersonTotal);//上报人异常
|
|
object.put("shangchuanTotal", shangchuanTotal);//上传总次数
|
|
object.put("shangchuanTotal", shangchuanTotal);//上传总次数
|
|
deptmap.put("tongyishuju", object);
|
|
deptmap.put("tongyishuju", object);
|
|
}
|
|
|
|
|
|
}*/
|
|
|
|
|
|
return mapList;
|
|
return mapList;
|
|
}
|
|
}
|