|
@ -10,6 +10,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
|
|
|
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
|
|
|
import com.yihu.jw.entity.hospital.DmHospitalDO;
|
|
|
import com.yihu.jw.entity.hospital.dict.BaseDeptDict;
|
|
|
import com.yihu.jw.healthUpload.dao.BaseDoctorHealthUploadDao;
|
|
|
import com.yihu.jw.healthUpload.dao.BaseDoctorMemberDao;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
@ -226,6 +227,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
baseDoctorHospitalDO.setDeptCode(deptCode);
|
|
|
baseDoctorHospitalDO.setDeptName(deptName);
|
|
|
baseDoctorHospitalDO.setDel("1");
|
|
|
baseDoctorHospitalDO.setCreateTime(new Date());
|
|
|
baseDoctorHospitalDao.save(baseDoctorHospitalDO);
|
|
|
}else {
|
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
|
|
@ -235,6 +237,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
baseDoctorHospitalDO.setDeptCode(deptCode);
|
|
|
baseDoctorHospitalDO.setDeptName(deptName);
|
|
|
baseDoctorHospitalDO.setDel("1");
|
|
|
baseDoctorHospitalDO.setCreateTime(new Date());
|
|
|
baseDoctorHospitalDao.save(baseDoctorHospitalDO);
|
|
|
}
|
|
|
} else {
|
|
@ -280,6 +283,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
baseDoctorHospitalDO.setDeptCode(deptCode);
|
|
|
baseDoctorHospitalDO.setDeptName(deptName);
|
|
|
baseDoctorHospitalDO.setDel("1");
|
|
|
baseDoctorHospitalDO.setCreateTime(new Date());
|
|
|
baseDoctorHospitalDao.save(baseDoctorHospitalDO);
|
|
|
}else {
|
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
|
|
@ -289,6 +293,7 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
baseDoctorHospitalDO.setDeptCode(deptCode);
|
|
|
baseDoctorHospitalDO.setDeptName(deptName);
|
|
|
baseDoctorHospitalDO.setDel("1");
|
|
|
baseDoctorHospitalDO.setCreateTime(new Date());
|
|
|
baseDoctorHospitalDao.save(baseDoctorHospitalDO);
|
|
|
}
|
|
|
|
|
@ -550,6 +555,179 @@ public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHeal
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 首页按照科室列表统计
|
|
|
*
|
|
|
* @param dept
|
|
|
* @param idType
|
|
|
* @param status 上报状态
|
|
|
* @param state 健康状态
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @return
|
|
|
*/
|
|
|
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 ";
|
|
|
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){
|
|
|
String deptCode = deptmap.get("code").toString();
|
|
|
JSONObject object =new JSONObject();
|
|
|
String day = DateUtil.getTwoDay(endDate,startDate);
|
|
|
String doctorSql =" select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
|
|
|
Integer total = 0;//总人次
|
|
|
String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 ";
|
|
|
String deptCondition = "";
|
|
|
if (StringUtils.isNoneBlank(deptCode)){
|
|
|
deptCondition +=" (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '"+deptCode+"' and dh.del=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(deptCondition)){
|
|
|
doctorSql+=" and d.id IN "+deptCondition;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(idTypeCondition)){
|
|
|
doctorSql+=" and d.id IN "+idTypeCondition ;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
doctorSql+=" and d.name like '%"+name+"%' " ;
|
|
|
}
|
|
|
Map<String,Object> map = jdbcTemplate.queryForMap(doctorSql);
|
|
|
String doctorTotal = "";
|
|
|
if (map!=null){
|
|
|
doctorTotal = map.get("total").toString();
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(doctorTotal)){
|
|
|
//总人次
|
|
|
if (!day.equalsIgnoreCase("0")){
|
|
|
total = Integer.parseInt(doctorTotal)*Integer.parseInt(day);
|
|
|
}else {
|
|
|
total= Integer.parseInt(doctorTotal);
|
|
|
}
|
|
|
}
|
|
|
Integer yishangbaoTotal = 0;
|
|
|
Integer weishangbaoTotal =0;
|
|
|
Integer zhengchangTotal = 0;
|
|
|
Integer yichangTotal = 0;
|
|
|
if (StringUtils.isNoneBlank(startDate)){
|
|
|
sql +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
|
|
|
}
|
|
|
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) ";
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(deptCondition)){
|
|
|
sql+=" and d.doctor_id IN "+deptCondition;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(idTypeCondition)){
|
|
|
sql+=" and d.doctor_id IN "+idTypeCondition ;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and d.doctor_name like '%"+name+"%'" ;
|
|
|
}
|
|
|
//已上传
|
|
|
Map<String,Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
|
|
|
if (yishangchaungMap!=null){
|
|
|
if (yishangchaungMap.get("total")!=null){
|
|
|
yishangbaoTotal = Integer.parseInt(yishangchaungMap.get("total").toString());
|
|
|
}
|
|
|
}
|
|
|
//未上报
|
|
|
weishangbaoTotal=total-yishangbaoTotal;
|
|
|
|
|
|
|
|
|
|
|
|
//上传总次数
|
|
|
Integer shangchuanTotal= 0;
|
|
|
|
|
|
String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 ";
|
|
|
|
|
|
if (StringUtils.isNoneBlank(startDate)){
|
|
|
shangchuanTotalSql +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(deptCondition)){
|
|
|
shangchuanTotalSql +=" and d.doctor_id IN "+deptCondition;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(idTypeCondition)){
|
|
|
shangchuanTotalSql +=" and d.doctor_id IN "+idTypeCondition ;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
shangchuanTotalSql+=" and d.doctor_name like '%"+name+"%'" ;
|
|
|
}
|
|
|
Map<String,Object> shangchuanMap = jdbcTemplate.queryForMap(shangchuanTotalSql);
|
|
|
if (shangchuanMap!=null){
|
|
|
if (shangchuanMap.get("total")!=null){
|
|
|
shangchuanTotal = Integer.parseInt(shangchuanMap.get("total").toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//正常、异常
|
|
|
String sqlZhengchang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 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) ";
|
|
|
|
|
|
if (StringUtils.isNoneBlank(startDate)){
|
|
|
sqlZhengchang +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(deptCondition)){
|
|
|
sqlZhengchang +=" and d.doctor_id IN "+deptCondition;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(idTypeCondition)){
|
|
|
sqlZhengchang +=" and d.doctor_id IN "+idTypeCondition ;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sqlZhengchang+=" and d.doctor_name like '%"+name+"%'" ;
|
|
|
}
|
|
|
//正常
|
|
|
Map<String,Object> zhengchangMap = jdbcTemplate.queryForMap(sqlZhengchang);
|
|
|
if (zhengchangMap!=null){
|
|
|
if (zhengchangMap.get("total")!=null){
|
|
|
zhengchangTotal = Integer.parseInt(zhengchangMap.get("total").toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String sqlYichang = "select COUNT(1) as \"total\" from base_doctor_health_upload 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)){
|
|
|
sqlYichang +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(deptCondition)){
|
|
|
sqlYichang +=" and d.doctor_id IN "+deptCondition;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(idTypeCondition)){
|
|
|
sqlYichang +=" and d.doctor_id IN "+idTypeCondition ;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sqlYichang+=" and d.doctor_name like '%"+name+"%'" ;
|
|
|
}
|
|
|
//正常
|
|
|
Map<String,Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang);
|
|
|
if (yichangMap!=null){
|
|
|
if (yichangMap.get("total")!=null){
|
|
|
yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
|
|
|
}
|
|
|
}
|
|
|
object.put("total",total);//总人次
|
|
|
object.put("yishangbaoTotal",yishangbaoTotal);//已上报
|
|
|
object.put("weishangbaoTotal",weishangbaoTotal);//未上报
|
|
|
object.put("zhengchangTotal",zhengchangTotal);//上报正常
|
|
|
object.put("yichangTotal",yichangTotal);//上报异常
|
|
|
object.put("shangchuanTotal",shangchuanTotal);//上传总次数
|
|
|
deptmap.put("tongyishuju",object);
|
|
|
}
|
|
|
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 具体每一个统计时间列表
|
|
|
*
|