|
@ -39,6 +39,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@ -75,6 +76,8 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
private WxPushLogDao wxPushLogDao;
|
|
|
@Autowired
|
|
|
private HibenateUtils hibenateUtils;
|
|
|
@Value("${wechat.id}")
|
|
|
private String wechatId;
|
|
|
|
|
|
/**
|
|
|
* 新增医生成员关系
|
|
@ -211,7 +214,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
}
|
|
|
newConfig.setKeyword2(baseDoctorHealthUploadDO.getDoctorName());
|
|
|
newConfig.setKeyword3(DateUtil.getStringDate());
|
|
|
newConfig.setUrl("https://www.cityihealth.com/hlwyy/healthMonitoring/#/health/commit?id=" + baseDoctorHealthUploadDO.getId() + "&docCode=" + baseDoctorHealthUploadDO.getDoctorId() + "");
|
|
|
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);
|
|
@ -385,7 +388,15 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject selectHealthByRole(String dept, int level, String doctorId) {
|
|
|
|
|
|
String nowDate = DateUtil.getStringDateShort();
|
|
|
Date startDate = DateUtil.strToDateLong(nowDate + " 00:00:00'");
|
|
|
Date endDate = DateUtil.strToDateLong(nowDate + " 23:59:59'");
|
|
|
BaseDoctorHealthUploadDO healthUploadDO = new BaseDoctorHealthUploadDO();
|
|
|
List<BaseDoctorHealthUploadDO> healthUploadDOList = baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorIdAndStartAndEnd(doctorId,startDate,endDate);
|
|
|
if (healthUploadDOList!=null&&healthUploadDOList.size()!=0){
|
|
|
healthUploadDO = healthUploadDOList.get(0);
|
|
|
}
|
|
|
//今日本人提交
|
|
|
String benrenSql = "select count(1) as total from base_doctor_health_upload where consumer='" + doctorId + "' and consumer in(doctor_id) and create_time >='" + nowDate + " 00:00:00' and create_time<='" + nowDate + " 23:59:59'";
|
|
|
//今日提交
|
|
@ -396,16 +407,21 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
String benrenshangbaoSql = "select count(1) as total from base_doctor_health_upload where consumer='" + doctorId + "' and consumer in(doctor_id)";
|
|
|
String doctorSql = "";
|
|
|
String sql = "";
|
|
|
String yichangSql = "";
|
|
|
if (level == 1) {
|
|
|
//总人次
|
|
|
doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
|
|
|
//今日上报人次
|
|
|
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)";
|
|
|
} 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 )";
|
|
|
//今日上报人次
|
|
|
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)";
|
|
|
}
|
|
|
//今日提交
|
|
|
int personTotal = 0;
|
|
@ -419,6 +435,8 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
int sqlTotal = 0;
|
|
|
//今日未上报人次
|
|
|
int notUploadTotal = 0;
|
|
|
//
|
|
|
int yichangTotal = 0;
|
|
|
Map<String, Object> personMap = jdbcTemplate.queryForMap(personSql);
|
|
|
if (personMap != null) {
|
|
|
if (personMap.get("total") != null) {
|
|
@ -460,6 +478,13 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Map<String, Object> yichangMap = jdbcTemplate.queryForMap(yichangSql);
|
|
|
if (yichangMap != null) {
|
|
|
if (yichangMap.get("total") != null) {
|
|
|
yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("personTotal", personTotal);//今日上报人数
|
|
@ -469,6 +494,8 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
object.put("sqlTotal", sqlTotal);//今日上报人数
|
|
|
object.put("notUploadTotal", doctorTotal - sqlTotal);//今日未上报人数
|
|
|
object.put("benrenTotal", benrenTotal);//今日本人提交
|
|
|
object.put("healthUploadDO",healthUploadDO);
|
|
|
object.put("yichangTotal",yichangTotal);//今日异常
|
|
|
return object;
|
|
|
}
|
|
|
|
|
@ -1145,12 +1172,20 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
isOutsideName = "否";
|
|
|
}
|
|
|
String isNucleateName = "";
|
|
|
if (object.getString("isNucleate").equalsIgnoreCase("1")) {
|
|
|
isNucleateName = "未做";
|
|
|
} else if (object.getString("isNucleate").equalsIgnoreCase("2")) {
|
|
|
isNucleateName = "已做(院内)";
|
|
|
} else if (object.getString("isNucleate").equalsIgnoreCase("3")) {
|
|
|
isNucleateName = "已做(院外)";
|
|
|
if (wechatId.equalsIgnoreCase("xm_zjxl_wx")){
|
|
|
if (object.getString("isNucleate").equalsIgnoreCase("1")) {
|
|
|
isNucleateName = "未做";
|
|
|
} else if (object.getString("isNucleate").equalsIgnoreCase("2")) {
|
|
|
isNucleateName = "已做";
|
|
|
}
|
|
|
}else {
|
|
|
if (object.getString("isNucleate").equalsIgnoreCase("1")) {
|
|
|
isNucleateName = "未做";
|
|
|
} else if (object.getString("isNucleate").equalsIgnoreCase("2")) {
|
|
|
isNucleateName = "已做(院内)";
|
|
|
} else if (object.getString("isNucleate").equalsIgnoreCase("3")) {
|
|
|
isNucleateName = "已做(院外)";
|
|
|
}
|
|
|
}
|
|
|
String isOutsideHighName = "";
|
|
|
if (object.getString("isOutsideHigh").equalsIgnoreCase("1")) {
|
|
@ -1271,14 +1306,6 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
if (StringUtils.isNotBlank(key)) {
|
|
|
sql += " AND (h.dept_name like '%" + key + "%' OR d.name like '%" + key + "%' OR d.expertise like '%" + key + "%') ";
|
|
|
}
|
|
|
|
|
|
if (flag!=null){
|
|
|
if (flag==1){
|
|
|
sql += " and d.id IN (select d.doctor_id from base_doctor_health_upload d1 where 1=1 and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR d1.is_symptoms=1 OR d1.is_epidemic=1) and d1.create_time >='"+DateUtil.getStringDateShort()+" 00:00:00"+"' and d1.create_time <='"+DateUtil.getStringDateShort()+" 23:59:59"+"')";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params);
|
|
|
for (Map<String,Object> map:list){
|
|
|
String id = map.get("id").toString();
|
|
@ -1286,7 +1313,16 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
Date endTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" 23:59:59");
|
|
|
List<BaseDoctorHealthUploadDO> healthUploadDOS = baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorIdAndStartAndEnd(id,startTime,endTime);
|
|
|
if (healthUploadDOS!=null&&healthUploadDOS.size()!=0){
|
|
|
map.put("healthUpload",healthUploadDOS.get(0));
|
|
|
BaseDoctorHealthUploadDO healthUploadDO = healthUploadDOS.get(0);
|
|
|
String healthStateName = "";
|
|
|
if (healthUploadDO.getHealthCode()==2 ||healthUploadDO.getHealthCode()==3||Double.parseDouble(healthUploadDO.getTemperature())>=37.3
|
|
|
|| healthUploadDO.getIsSymptoms()==1 || healthUploadDO.getIsEpidemic()==1) {
|
|
|
healthStateName = "异常";
|
|
|
} else {
|
|
|
healthStateName = "正常";
|
|
|
}
|
|
|
map.put("healthStateName",healthStateName);
|
|
|
map.put("healthUpload",healthUploadDO);
|
|
|
}else {
|
|
|
map.put("healthUpload",null);
|
|
|
}
|