|
@ -340,10 +340,9 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (StringUtil.isBlank(report_date)){
|
|
|
report_date = DateUtil.getStringDateShort();
|
|
|
week_name = DateUtil.getWeekStr(report_date);
|
|
|
}
|
|
|
report_date = DateUtil.getStringDateShort();
|
|
|
week_name = DateUtil.getWeekStr(report_date);
|
|
|
|
|
|
BaseDailyReportUploadDO dailyReportUploadDO = dailyReportUploadDao.findByDoctorIdAndReportDate(doctorId,report_date);
|
|
|
if (null==dailyReportUploadDO){
|
|
|
dailyReportUploadDO = new BaseDailyReportUploadDO();
|
|
@ -543,6 +542,7 @@ public class DailyReportUploadService {
|
|
|
for (BaseDailyReportDetailDO tmp:detailDOList){
|
|
|
if (1==tmp.getDoubt()&&(null==tmp.getDoubtState()||0==tmp.getDoubtState())){
|
|
|
doubt = true;
|
|
|
tmp.setDoubtRead(0);
|
|
|
if(0!=tmp.getDoubtType()&&doubtTypeObj.containsKey(tmp.getDoubtType()+"")){
|
|
|
doubtTypeName.add(doubtTypeObj.getString(tmp.getDoubtType()+""));
|
|
|
}
|
|
@ -629,6 +629,45 @@ public class DailyReportUploadService {
|
|
|
return dailyReportUploadDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 点赞项目
|
|
|
* @param id
|
|
|
* @param niceWorkType
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean thumbsUpDailyReport(String id,Integer niceWorkType) throws Exception {
|
|
|
BaseDailyReportUploadDO dailyReportUploadDO = dailyReportUploadDao.findOne(id);
|
|
|
if (null == dailyReportUploadDO) {
|
|
|
throw new Exception("日报记录未查询到");
|
|
|
}
|
|
|
dailyReportUploadDO.setNiceWorkType(niceWorkType);
|
|
|
|
|
|
try {
|
|
|
BaseDoctorDO remindDoctorDO = baseDoctorDao.findById(dailyReportUploadDO.getDoctorId());
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(dailyReportUploadDO.getDoctorId());
|
|
|
if (remindDoctorDO != null) {
|
|
|
try {
|
|
|
WxEnterpriseUserDO enterpriseUserDO = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(wechatId,remindDoctorDO.getMobile());
|
|
|
if(enterpriseUserDO==null){
|
|
|
logger.info("该用户"+doctorDO.getName()+"没有企业微信手机号,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
|
|
|
}else{
|
|
|
String title = "日报反馈";
|
|
|
String des = "您好,鉴于您今日的工作表现,上级给予了肯定,点击查看详情。";
|
|
|
String url = "https://ehr.yihu.com/hlwyy/zjxl/dailyReport/#/workSummary/commit?id="+dailyReportUploadDO.getId();
|
|
|
String res = enterpriseService.sendTWMesByDoctor(wechatId,remindDoctorDO.getId(),title,des,url);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*核实每日报表疑惑
|
|
|
*/
|
|
@ -746,27 +785,45 @@ public class DailyReportUploadService {
|
|
|
return urgingRecordDOS;
|
|
|
}
|
|
|
|
|
|
public List<BaseDailyUrgingRecordDO> getUrgingList(String code,String doctor,String reportId,String createUser,String startTime,String endTime){
|
|
|
String sql = " select ur.* from base_daily_urging_record ur where 1=1 ";
|
|
|
public List<BaseDailyUrgingRecordDO> getUrgingList(String user,String dept,String code,String doctor,String reportId,String createUser,String startTime,String endTime){
|
|
|
String sql = " select dict_value from wlyy_hospital_sys_dict where dict_name='BOOS_ADMIN_SENDER' ";
|
|
|
String sqlCondition = " ";
|
|
|
String boosID = "";
|
|
|
List<String> boosSenderIds = jdbcTemplate.queryForList(sql, String.class);
|
|
|
if (boosSenderIds.size() > 0) {
|
|
|
boosID = boosSenderIds.get(0);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(code)){
|
|
|
sql +=" and ur.code='"+code+"' ";
|
|
|
sqlCondition +=" and ur.code='"+code+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
sqlCondition += " and dept ='"+dept+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(doctor)){
|
|
|
sql +=" and ur.receive_doctor='"+doctor+"' ";
|
|
|
sqlCondition +=" and ur.receive_doctor='"+doctor+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(reportId)){
|
|
|
sql +=" and ur.report_id='"+reportId+"' ";
|
|
|
sqlCondition +=" and ur.report_id='"+reportId+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(createUser)){
|
|
|
sql +=" and ur.create_user='"+createUser+"' ";
|
|
|
sqlCondition +=" and ur.create_user='"+createUser+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(startTime)){
|
|
|
sql +=" and ur.create_time>='"+startTime+"' ";
|
|
|
sqlCondition +=" and ur.create_time>='"+startTime+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endTime)){
|
|
|
sql +=" and ur.create_time<='"+endTime+"' ";
|
|
|
sqlCondition +=" and ur.create_time<='"+endTime+"' ";
|
|
|
}
|
|
|
sql +=" group by ur.code order by ur.create_time desc ";
|
|
|
|
|
|
|
|
|
sql = " select ur.* from base_daily_urging_record ur where 1=1 "+sqlCondition+"";
|
|
|
if (StringUtils.isNotBlank(user)){
|
|
|
if (StringUtils.isNotBlank(user)&&!boosID.equals(user)){
|
|
|
sql +="UNION " +
|
|
|
" select ur.* from base_daily_urging_record ur where ur.receive_doctor='"+user+"' "+sqlCondition+" ";
|
|
|
}
|
|
|
}
|
|
|
sql +=" order by create_time desc ";
|
|
|
|
|
|
return jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseDailyUrgingRecordDO.class));
|
|
|
}
|
|
@ -844,9 +901,13 @@ public class DailyReportUploadService {
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public BaseDailyReportUploadDO selectReportById(String reportId) throws Exception {
|
|
|
public BaseDailyReportUploadDO selectReportById(String doctor,String reportId) throws Exception {
|
|
|
String nowDate = DateUtil.getStringDateShort();
|
|
|
BaseDailyReportUploadDO reportUploadDO = dailyReportUploadDao.findOne(reportId);
|
|
|
if(reportUploadDO.getDoctorId().equals(doctor)){
|
|
|
String sql = " update base_daily_report_detail set doubt_read=1 where id='"+reportId+"' ";
|
|
|
jdbcTemplate.execute(sql);
|
|
|
}
|
|
|
if (null==reportUploadDO){
|
|
|
throw new Exception("未找到日报记录");
|
|
|
}else {
|
|
@ -904,7 +965,7 @@ public class DailyReportUploadService {
|
|
|
String notVerifiedSql = "";
|
|
|
if (level == 1) {
|
|
|
//总人数
|
|
|
doctorTotalSql = " select COUNT(1) as 'total' from base_doctor d where d.del=1 ";
|
|
|
doctorTotalSql = " select COUNT(1) as 'total' from base_doctor d where d.del=1 and d.identity=0 ";
|
|
|
//今日上报人数
|
|
|
sqlTotalSql = " select count(up.id) from base_doctor_daily_report_upload up INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1" +
|
|
|
" where up.report_date>='"+nowDate+"' and up.report_date<='"+nowDate+"' ";
|
|
@ -935,7 +996,23 @@ public class DailyReportUploadService {
|
|
|
" where de.state=0 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' " +
|
|
|
" and up.doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
|
}
|
|
|
|
|
|
if (1==level||2==level){
|
|
|
Integer doctorTotal = jdbcTemplate.queryForObject(doctorTotalSql,Integer.class);
|
|
|
Integer sqlTotal = jdbcTemplate.queryForObject(sqlTotalSql,Integer.class);
|
|
|
Integer verified = jdbcTemplate.queryForObject(verifiedSql,Integer.class);
|
|
|
Integer notVerified = jdbcTemplate.queryForObject(notVerifiedSql,Integer.class);
|
|
|
result.put("doctorTotal", doctorTotal);//科室总人次
|
|
|
result.put("sqlTotal", sqlTotal);//科室今日上报人数
|
|
|
result.put("notUploadTotal", doctorTotal - sqlTotal);//今日未上报人数
|
|
|
result.put("verified",verified);//科室未核实
|
|
|
result.put("notVerified",notVerified);//科室已核实
|
|
|
}else {
|
|
|
result.put("doctorTotal", 0);//科室总人次
|
|
|
result.put("sqlTotal", 0);//科室今日上报人数
|
|
|
result.put("notUploadTotal", 0);//今日未上报人数
|
|
|
result.put("verified",0);//科室未核实
|
|
|
result.put("notVerified",0);//科室已核实
|
|
|
}
|
|
|
|
|
|
Integer benrenTotal = jdbcTemplate.queryForObject(benrenTotalSql,Integer.class);
|
|
|
Integer benrenshangbaoTotal = jdbcTemplate.queryForObject(benrenshangbaoTotalSql,Integer.class);
|
|
@ -946,15 +1023,9 @@ public class DailyReportUploadService {
|
|
|
result.put("benrenVerified",benrenVerified);//本人上级未核实
|
|
|
result.put("benrenNotVerified",benrenNotVerified);//本人上级已核实
|
|
|
|
|
|
Integer doctorTotal = jdbcTemplate.queryForObject(doctorTotalSql,Integer.class);
|
|
|
Integer sqlTotal = jdbcTemplate.queryForObject(sqlTotalSql,Integer.class);
|
|
|
Integer verified = jdbcTemplate.queryForObject(verifiedSql,Integer.class);
|
|
|
Integer notVerified = jdbcTemplate.queryForObject(notVerifiedSql,Integer.class);
|
|
|
result.put("doctorTotal", doctorTotal);//科室总人次
|
|
|
result.put("sqlTotal", sqlTotal);//科室今日上报人数
|
|
|
result.put("notUploadTotal", doctorTotal - sqlTotal);//今日未上报人数
|
|
|
result.put("verified",verified);//科室未核实
|
|
|
result.put("notVerified",notVerified);//科室已核实
|
|
|
result.put("notVerifiedTotal",selectListInfoByTotal2(doctorId,dept,"0",null,null,null,null,null).size());//未核实数量(本人+管辖部门)
|
|
|
result.put("doubtTotal",selectListInfoByTotal2(doctorId,dept,null,null,null,null,1,null).size());//效能异常(本人+管辖部门)
|
|
|
result.put("urgingTotal",getUrgingList(doctorId,dept,null,null,null,null,null,null).size());//催促数量(本人+管辖部门)
|
|
|
result.put("reportUploadDO",reportUploadDO);
|
|
|
return result;
|
|
|
}
|
|
@ -1381,6 +1452,70 @@ public class DailyReportUploadService {
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param user
|
|
|
* @param dept
|
|
|
* @param state 0未核实 1已核实
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @param name
|
|
|
* @param doubtState 存疑0无存疑1存疑
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> selectListInfoByTotal2(String user,String dept,String state,String startDate,String endDate,String name,Integer doubtState,Integer readState) {
|
|
|
String sqlCondition = " ";
|
|
|
String boosID = "";
|
|
|
|
|
|
String sql = " select dict_value from wlyy_hospital_sys_dict where dict_name='BOOS_ADMIN_SENDER' ";
|
|
|
List<String> boosSenderIds = jdbcTemplate.queryForList(sql, String.class);
|
|
|
if (boosSenderIds.size() > 0) {
|
|
|
boosID = boosSenderIds.get(0);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
sqlCondition += " and dh.dept_code='"+dept+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(state)){
|
|
|
sqlCondition += " and d1.state='"+state+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
|
sqlCondition +=" and d1.report_date>='"+startDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
|
sqlCondition += " and d1.report_date<='"+endDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(name)){
|
|
|
sqlCondition += " and doc.name like '%"+name+"%'";
|
|
|
}
|
|
|
if (null!=doubtState){
|
|
|
if (0==doubtState){
|
|
|
sqlCondition +=" and de.doubt=0 ";
|
|
|
}if (1==doubtState){
|
|
|
sqlCondition +=" and de.doubt=1 ";
|
|
|
}
|
|
|
}
|
|
|
if (null!=readState){
|
|
|
sqlCondition += " and de.doubt_read='"+readState+"' ";
|
|
|
}
|
|
|
|
|
|
sql = " select doc.name,dh.dept_code,dh.dept_name,d1.id,doc.job_title_name as jobTitleName,doc.photo,report_date reportDate,d1.state,total_hour,IF(SUM(de.doubt)>0,1,0) as doubt,de.doubt_read " +
|
|
|
"from base_doctor_daily_report_upload d1 INNER JOIN base_doctor doc on d1.doctor_id = doc.id " +
|
|
|
"INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_daily_report_detail de on d1.id = de.report_id " +
|
|
|
"where doc.del=1 and doc.identity=0 "+sqlCondition+" GROUP BY d1.id ";
|
|
|
if (StringUtils.isNotBlank(user)&&!boosID.equals(user)){
|
|
|
sql +=" UNION " +
|
|
|
"select doc.name,dh.dept_code,dh.dept_name,d1.id,doc.job_title_name as jobTitleName,doc.photo,report_date reportDate,d1.state,total_hour,IF(SUM(de.doubt)>0,1,0) as doubt,de.doubt_read " +
|
|
|
"from base_doctor_daily_report_upload d1 INNER JOIN base_doctor doc on d1.doctor_id = doc.id " +
|
|
|
"INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_daily_report_detail de on d1.id = de.report_id " +
|
|
|
"where doc.del=1 and doc.identity=0 and doc.id='"+user+"' " +sqlCondition +" GROUP BY d1.id ";
|
|
|
}
|
|
|
sql += " order by reportDate desc ";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取存疑列表列表的时间及数量
|
|
|
* @param dept
|
|
@ -1779,6 +1914,7 @@ public class DailyReportUploadService {
|
|
|
Integer weishangbaoTotal = 0;
|
|
|
Integer verifiedTotal = 0;
|
|
|
Integer notVerifiedTotal = 0;
|
|
|
Long urgingTotal = 0l;
|
|
|
//已上传
|
|
|
Map<String, Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
|
|
|
if (yishangchaungMap != null) {
|
|
@ -1885,6 +2021,15 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
doubtDoubtList.sort(Comparator.comparing(e->e.get("doubt_type").toString()));
|
|
|
Long doubtTotal = jdbcTemplate.queryForObject(doubtTotalSql,Long.class);
|
|
|
|
|
|
//项目催出
|
|
|
//项目催出数量
|
|
|
String urgingSql = " select count(id) from base_daily_urging_record where create_time>='"+startDate+"' and create_time<='"+endDate+"' ";
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
urgingSql +=" and dept='"+dept+"' ";
|
|
|
}
|
|
|
urgingTotal = jdbcTemplate.queryForObject(urgingSql,Long.class);
|
|
|
|
|
|
object.put("total", total);//总人次
|
|
|
object.put("yishangbaoTotal", yishangbaoTotal);//已上报
|
|
|
object.put("weishangbaoTotal", weishangbaoTotal);//未上报
|
|
@ -1893,6 +2038,7 @@ public class DailyReportUploadService {
|
|
|
object.put("shangchuanTotal", shangchuanTotal);//上传总次数
|
|
|
object.put("doubtList", doubtDoubtList);//各存疑次数
|
|
|
object.put("doubtTotal", doubtTotal);//存疑总数
|
|
|
object.put("urgingTotal", urgingTotal);//项目催出
|
|
|
return object;
|
|
|
}
|
|
|
|
|
@ -1942,6 +2088,7 @@ public class DailyReportUploadService {
|
|
|
Integer notVerified=0;//未核实
|
|
|
Integer verified=0;//已核实
|
|
|
Integer shangchuanTotal=0;//上传总次数
|
|
|
Long urgingTotal=0l;//项目催促
|
|
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
|
sql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
@ -2059,6 +2206,17 @@ public class DailyReportUploadService {
|
|
|
//上传总次数
|
|
|
shangchuanTotal = jdbcTemplate.queryForObject(shangchuanTotalSql,Integer.class);
|
|
|
|
|
|
//项目催出数量
|
|
|
String urgingSql = " select count(id) from base_daily_urging_record where create_time>='"+startDate+"' and create_time<='"+endDate+"' ";
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
urgingSql +=" and dept='"+dept+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(name)){
|
|
|
urgingSql += " and doctor_name like '%"+name+"%' ";
|
|
|
}
|
|
|
urgingTotal = jdbcTemplate.queryForObject(urgingSql,Long.class);
|
|
|
|
|
|
|
|
|
object.put("total", total);//总人次
|
|
|
object.put("yishangbaoTotal", yishangbaoTotal);//已上报
|
|
|
object.put("weishangbaoTotal", weishangbaoTotal);//未上报
|
|
@ -2067,6 +2225,7 @@ public class DailyReportUploadService {
|
|
|
object.put("shangchuanTotal", shangchuanTotal);//上传总次数
|
|
|
object.put("doubtList", doubtDoubtList);//各存疑次数
|
|
|
object.put("doubtTotal", doubtTotal);//存疑总数
|
|
|
object.put("urgingTotal", urgingTotal);//项目催出
|
|
|
return object;
|
|
|
}
|
|
|
|
|
@ -3509,7 +3668,7 @@ public class DailyReportUploadService {
|
|
|
Long needWorkHours = workDays*members*8;
|
|
|
Long urgingTotal=0l;
|
|
|
|
|
|
String urgingSql = " select count(id) from base_daily_urging_record where create_time>='"+startDate+"' and create_time<='endDate' ";
|
|
|
String urgingSql = " select count(distinct code) from base_daily_urging_record where create_time>='"+startDate+"' ";
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
|
urgingSql += " and project_code='"+projectCode+"' ";
|
|
|
}
|
|
@ -3564,7 +3723,7 @@ public class DailyReportUploadService {
|
|
|
//员工离职or中途加入到项目中的会导致统计出来的数据发生变化
|
|
|
result.put("weishangbao",((workDays*members-shangchuanTotal))<0?0:(workDays*members-shangchuanTotal));//未上报 工作日次数-总上报次数
|
|
|
result.put("doubtList",doubtTypeList);
|
|
|
result.put("urgingTotal",urgingTotal);//启动催出
|
|
|
result.put("urgingTotal",urgingTotal);//项目催促
|
|
|
result.put("acWorkHours",acWorkHours);//实际工作时长
|
|
|
result.put("needWorkHours",needWorkHours);//应工作时长
|
|
|
|
|
@ -3578,9 +3737,6 @@ public class DailyReportUploadService {
|
|
|
|
|
|
List<Map<String,Object>> doctorTypeHourList = jdbcTemplate.queryForList(doctorTypeSql);
|
|
|
result.put("doctorTypeHourList",doctorTypeHourList);//按人员统计总用时与参与人数
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@ -3753,6 +3909,451 @@ public class DailyReportUploadService {
|
|
|
return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 周效能头部信息
|
|
|
* @param user
|
|
|
* @param projectCode
|
|
|
* @param item_id
|
|
|
* @param dept
|
|
|
* @param memberId
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject weekReportHeaderInfo(String user,String projectCode,String item_id,String dept,String memberId,String startDate,String endDate) throws Exception {
|
|
|
|
|
|
//判断导出人权限
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
}else {
|
|
|
String role_code = userRoles.get(0).get("role_code").toString();
|
|
|
if ("admin".equals(role_code)){
|
|
|
|
|
|
} else if ("deptAdmin".equals(role_code)) {//查询出管理员所在部门
|
|
|
if(StringUtils.isBlank(dept)){
|
|
|
sql = " select dh.dept_code from base_doctor doc INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code " +
|
|
|
" and doc.del=1 and dh.del=1 where doc.id='"+user+"' ";
|
|
|
List<String> userDept = jdbcTemplate.queryForList(sql,String.class);
|
|
|
if (userDept.size()>0){
|
|
|
dept = userDept.get(0);
|
|
|
}else {
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sql = " select dict_value from wlyy_hospital_sys_dict where dict_name='healthUpload' and dict_code='healthUpload' ";
|
|
|
List<String> dictValues = jdbcTemplate.queryForList(sql,String.class);
|
|
|
JSONObject doubtTypeObj = new JSONObject();
|
|
|
if (dictValues.size()>0){
|
|
|
JSONObject tmp = JSONObject.parseObject(dictValues.get(0));
|
|
|
doubtTypeObj = tmp.getJSONObject("dailyReportDoubtTypeName");
|
|
|
}
|
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
if (StringUtils.isBlank(endDate)){
|
|
|
endDate = DateUtil.dateToStrLong(DateUtil.getDateEnd());
|
|
|
}
|
|
|
String sqlWhere = " ";
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
|
sqlWhere += " and rd.project_code='"+projectCode+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(item_id)){
|
|
|
sqlWhere += " and rd.report_item_id='"+item_id+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
sqlWhere +=" and dh.dept_code='"+dept+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(memberId)){
|
|
|
sqlWhere +=" and up.doctor_id='"+memberId+"' ";
|
|
|
}
|
|
|
|
|
|
Long members = 0l;
|
|
|
String memberSql = " select count(distinct mem.user_id) from base_daily_report_item it " +
|
|
|
"inner join base_daily_report_item_members mem on it.id = mem.report_item_id and mem.del=1 " +
|
|
|
"INNER JOIN base_doctor doc on mem.user_id = doc.id and doc.del=1 " +
|
|
|
"INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_doctor_daily_report_upload up on doc.id = up.doctor_id " +
|
|
|
"LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id and rd.report_item_id = it.id where 1=1 "+sqlWhere;
|
|
|
members = jdbcTemplate.queryForObject(memberSql,Long.class);
|
|
|
|
|
|
if (StringUtils.isNotBlank(startDate)) {
|
|
|
sqlWhere += " and up.report_date>='"+DateUtil.strToStrShort(startDate) +"' ";
|
|
|
}if (StringUtils.isNotBlank(endDate)){
|
|
|
sqlWhere += " and up.report_date<='"+DateUtil.strToStrShort(endDate)+"' ";
|
|
|
}
|
|
|
|
|
|
Long workDays=0l;
|
|
|
if (StringUtils.isNotBlank(startDate)&&StringUtils.isNotBlank(endDate)) {
|
|
|
workDays = DateUtil.getWorkDays(startDate, endDate);
|
|
|
}
|
|
|
|
|
|
String shangchuanSql = " select distinct up.report_date from base_doctor_daily_report_upload up " +
|
|
|
" INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
|
|
|
"Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id " +
|
|
|
"LEFT join base_daily_report_item i on i.id = rd.report_item_id and i.del=1 where 1=1 " +
|
|
|
" "+sqlWhere;
|
|
|
//只计算出工作日上传的数量去求未上传
|
|
|
List<String> upLoadTimes = jdbcTemplate.queryForList(shangchuanSql,String.class);
|
|
|
Long shangchuanTotal = 0l;
|
|
|
for (String tmp:upLoadTimes){
|
|
|
if (!DateUtil.isHoliday(DateUtil.strToDate(tmp))){
|
|
|
shangchuanTotal++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Double acWorkHours = 0d;
|
|
|
Long needWorkHours = workDays*members*8;
|
|
|
Long urgingTotal=0l;
|
|
|
|
|
|
String urgingSql = " select count(id) from base_daily_urging_record where create_time>='"+startDate+"' and create_time<='"+startDate+"' ";
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
|
urgingSql += " and project_code='"+projectCode+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(item_id)){
|
|
|
urgingSql += " and report_item_id='"+item_id+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
urgingSql +=" and dept='"+dept+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(memberId)){
|
|
|
urgingSql +=" and receive_doctor='"+memberId+"' ";
|
|
|
}
|
|
|
urgingTotal = jdbcTemplate.queryForObject(urgingSql,Long.class);
|
|
|
|
|
|
String acWorkHoursSql = " select sum(cast(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) as decimal(18,2))) 'completion_hour' " +
|
|
|
" from base_doctor_daily_report_upload up " +
|
|
|
"INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
|
|
|
"Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id " +
|
|
|
" LEFT join base_daily_report_item i on i.id = rd.report_item_id and i.del=1 where 1=1 " +
|
|
|
" "+sqlWhere;
|
|
|
acWorkHours = jdbcTemplate.queryForObject(acWorkHoursSql,Double.class);
|
|
|
|
|
|
String doubtTypeSql = " select count(distinct rd.id) as total,rd.doubt_type " +
|
|
|
" from base_doctor_daily_report_upload up " +
|
|
|
"INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
|
|
|
"Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id " +
|
|
|
"LEFT join base_daily_report_item i on i.id = rd.report_item_id and i.del=1 where 1=1 " +
|
|
|
" "+sqlWhere+" and rd.doubt_type is not null group by rd.doubt_type";
|
|
|
List<Map<String,Object>> doubtTypeList = jdbcTemplate.queryForList(doubtTypeSql);
|
|
|
for (Map<String,Object>tmp:doubtTypeList){
|
|
|
String doubtType = tmp.get("doubt_type").toString();
|
|
|
if(doubtTypeObj.containsKey(doubtType)){
|
|
|
tmp.put("doubtTypeName",doubtTypeObj.get(doubtType));
|
|
|
}else {
|
|
|
tmp.put("doubtTypeName","其他");
|
|
|
}
|
|
|
}
|
|
|
List<String> doubtListStr = doubtTypeList.stream().map(e -> e.get("doubt_type").toString()).collect(Collectors.toList());
|
|
|
for (String key:doubtTypeObj.keySet()){
|
|
|
if (!doubtListStr.contains(key)){
|
|
|
Map<String,Object>tmp = new HashMap<>();
|
|
|
tmp.put("doubt_type",key);
|
|
|
tmp.put("doubtTypeName",doubtTypeObj.get(key));
|
|
|
tmp.put("total",0);
|
|
|
doubtTypeList.add(tmp);
|
|
|
}
|
|
|
}
|
|
|
doubtTypeList.sort(Comparator.comparing(e->e.get("doubt_type").toString()));
|
|
|
|
|
|
//员工离职or中途加入到项目中的会导致统计出来的数据发生变化
|
|
|
result.put("weishangbao",((workDays*members-shangchuanTotal))<0?0:(workDays*members-shangchuanTotal));//未上报 工作日次数-总上报次数
|
|
|
result.put("doubtList",doubtTypeList);
|
|
|
result.put("urgingTotal",urgingTotal);//项目催促
|
|
|
result.put("acWorkHours",acWorkHours);//实际工作时长
|
|
|
result.put("needWorkHours",needWorkHours);//应工作时长
|
|
|
|
|
|
//项目启动、完成、启动超时、完成超时、催促数量
|
|
|
String projectItemSql = " select count(id) from base_daily_report_item where del=1 ";
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
projectItemSql += " and dept='"+dept+"' ";
|
|
|
}
|
|
|
//项目启动
|
|
|
String projectItemSqlCondition = " and ac_begin_time>='"+startDate+" 00:00:00' and ac_begin_time<='"+endDate+" 23:59:59' ";
|
|
|
result.put("projectItemStart",jdbcTemplate.queryForObject(projectItemSql+projectItemSqlCondition,Integer.class));
|
|
|
//项目完成
|
|
|
projectItemSqlCondition = " and state=1 and completion_time>='"+startDate+" 00:00:00' and completion_time<='"+endDate+" 23:59:59' ";
|
|
|
result.put("projectItemComplete",jdbcTemplate.queryForObject(projectItemSql+projectItemSqlCondition,Integer.class));
|
|
|
//启动超时
|
|
|
projectItemSqlCondition = " and begin_time>='"+startDate+" 00:00:00' and begin_time<='"+endDate+" 23:59:59' and (ac_begin_time is null or DATE_FORMAT(ac_begin_time,'%Y-%m-%d')>begin_time ) ";
|
|
|
result.put("projectItemStartOverTime",jdbcTemplate.queryForObject(projectItemSql+projectItemSqlCondition,Integer.class));
|
|
|
//完成超时
|
|
|
projectItemSqlCondition = " and (state=1 and completion_time>='"+startDate+" 00:00:00' and completion_time<='"+endDate+" 23:59:59' and DATE_FORMAT(end_time,'%Y-%m-%d')>end_time )" +
|
|
|
" or ( state =0 and end_time<'"+endDate+" 23:59:59' ) ";
|
|
|
result.put("projectItemCompleteOverTime",jdbcTemplate.queryForObject(projectItemSql+projectItemSqlCondition,Integer.class));
|
|
|
//催促数量
|
|
|
urgingSql = " select count(distinct project_code) from base_daily_urging_record where create_time>='"+startDate+"' and create_time<='"+startDate+"' ";
|
|
|
result.put("projectUrgingTotal",jdbcTemplate.queryForObject(urgingSql,Integer.class));
|
|
|
|
|
|
String doctorTypeSql = " select sum(cast(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) as decimal(18,2))) 'completion_hour',count(distinct doc.id) as doctorTotal,IFNULL(dh.doctor_duty_name,'其他') as 'doctor_duty_name' " +
|
|
|
" from base_doctor_daily_report_upload up " +
|
|
|
"INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
|
|
|
"Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id " +
|
|
|
"LEFT join base_daily_report_item i on i.id = rd.report_item_id and i.del=1 where 1=1 " +
|
|
|
" "+sqlWhere+" group by doctor_duty_code ";
|
|
|
|
|
|
List<Map<String,Object>> doctorTypeHourList = jdbcTemplate.queryForList(doctorTypeSql);
|
|
|
result.put("doctorTypeHourList",doctorTypeHourList);//按人员统计总用时与参与人数
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 周效能列表信息
|
|
|
* @param user
|
|
|
* @param projectCode
|
|
|
* @param item_id
|
|
|
* @param dept
|
|
|
* @param memberId
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @return
|
|
|
*/
|
|
|
public Map<String,Object> weekReportListInfo(String user,String projectCode,String item_id,String dept,String memberId,String startDate,String endDate) throws Exception {
|
|
|
Map<String,Object> result = new HashMap<>();
|
|
|
String sql = " select dict_value from wlyy_hospital_sys_dict where dict_name='healthUpload' and dict_code='healthUpload' ";
|
|
|
List<String> dictValues = jdbcTemplate.queryForList(sql,String.class);
|
|
|
JSONObject doubtTypeObj = new JSONObject();
|
|
|
if (dictValues.size()>0){
|
|
|
JSONObject tmp = JSONObject.parseObject(dictValues.get(0));
|
|
|
doubtTypeObj = tmp.getJSONObject("dailyReportDoubtTypeName");
|
|
|
}
|
|
|
//判断导出人权限
|
|
|
sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
}else {
|
|
|
String role_code = userRoles.get(0).get("role_code").toString();
|
|
|
if ("admin".equals(role_code)){
|
|
|
|
|
|
} else if ("deptAdmin".equals(role_code)) {//查询出管理员所在部门
|
|
|
if(StringUtils.isBlank(dept)){
|
|
|
sql = " select dh.dept_code from base_doctor doc INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code " +
|
|
|
" and doc.del=1 and dh.del=1 where doc.id='"+user+"' ";
|
|
|
List<String> userDept = jdbcTemplate.queryForList(sql,String.class);
|
|
|
if (userDept.size()>0){
|
|
|
dept = userDept.get(0);
|
|
|
}else {
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
}
|
|
|
String sqlCondition = " ";
|
|
|
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
|
sqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
|
sqlCondition += " and up.report_date<='"+endDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
|
sqlCondition += " and i.project_code='"+projectCode+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){//查询指定部门
|
|
|
sqlCondition += " and dh.dept_code='"+dept+"' ";
|
|
|
}
|
|
|
|
|
|
//部门效能
|
|
|
String deptListSql = " select distinct code,name from dict_hospital_dept ";
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
deptListSql+=" and code='"+dept+"' ";
|
|
|
}
|
|
|
deptListSql += " order by code asc";
|
|
|
List<Map<String,Object>> deptList = jdbcTemplate.queryForList(deptListSql);
|
|
|
for (Map<String,Object>deptTmp:deptList){
|
|
|
String deptCodeTmp = deptTmp.get("code").toString();
|
|
|
String sqlWhere =" and dh.dept_code='"+deptCodeTmp+"' ";
|
|
|
Long members = 0l;
|
|
|
String memberSql = " select count(distinct mem.user_id) from base_daily_report_item it " +
|
|
|
"inner join base_daily_report_item_members mem on it.id = mem.report_item_id and mem.del=1 " +
|
|
|
"INNER JOIN base_doctor doc on mem.user_id = doc.id and doc.del=1 " +
|
|
|
"INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_doctor_daily_report_upload up on doc.id = up.doctor_id " +
|
|
|
"LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id and rd.report_item_id = it.id where 1=1 "+sqlWhere;
|
|
|
members = jdbcTemplate.queryForObject(memberSql,Long.class);
|
|
|
|
|
|
if (StringUtils.isNotBlank(startDate)) {
|
|
|
sqlWhere += " and up.report_date>='"+DateUtil.strToStrShort(startDate) +"' ";
|
|
|
}if (StringUtils.isNotBlank(endDate)){
|
|
|
sqlWhere += " and up.report_date<='"+DateUtil.strToStrShort(endDate)+"' ";
|
|
|
}
|
|
|
|
|
|
Long workDays=0l;
|
|
|
if (StringUtils.isNotBlank(startDate)&&StringUtils.isNotBlank(endDate)) {
|
|
|
workDays = DateUtil.getWorkDays(startDate, endDate);
|
|
|
}
|
|
|
|
|
|
String shangchuanSql = " select distinct up.report_date from base_doctor_daily_report_upload up " +
|
|
|
" INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
|
|
|
"Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id " +
|
|
|
"LEFT join base_daily_report_item i on i.id = rd.report_item_id and i.del=1 where 1=1 " +
|
|
|
" "+sqlWhere;
|
|
|
//只计算出工作日上传的数量去求未上传
|
|
|
List<String> upLoadTimes = jdbcTemplate.queryForList(shangchuanSql,String.class);
|
|
|
Long shangchuanTotal = 0l;
|
|
|
for (String tmp:upLoadTimes){
|
|
|
if (!DateUtil.isHoliday(DateUtil.strToDate(tmp))){
|
|
|
shangchuanTotal++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Double acWorkHours = 0d;
|
|
|
Long needWorkHours = workDays*members*8;
|
|
|
Long urgingTotal=0l;
|
|
|
|
|
|
String urgingSql = " select count(id) from base_daily_urging_record where create_time>='"+startDate+"' and create_time<='"+startDate+"' ";
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
|
urgingSql += " and project_code='"+projectCode+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(item_id)){
|
|
|
urgingSql += " and report_item_id='"+item_id+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
urgingSql +=" and dept='"+dept+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(memberId)){
|
|
|
urgingSql +=" and receive_doctor='"+memberId+"' ";
|
|
|
}
|
|
|
urgingTotal = jdbcTemplate.queryForObject(urgingSql,Long.class);
|
|
|
|
|
|
String acWorkHoursSql = " select sum(cast(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) as decimal(18,2))) 'completion_hour' " +
|
|
|
" from base_doctor_daily_report_upload up " +
|
|
|
"INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
|
|
|
"Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id " +
|
|
|
" LEFT join base_daily_report_item i on i.id = rd.report_item_id and i.del=1 where 1=1 " +
|
|
|
" "+sqlWhere;
|
|
|
acWorkHours = jdbcTemplate.queryForObject(acWorkHoursSql,Double.class);
|
|
|
|
|
|
String doubtTypeSql = " select count(distinct rd.id) as total,rd.doubt_type " +
|
|
|
" from base_doctor_daily_report_upload up " +
|
|
|
"INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
|
|
|
"Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id " +
|
|
|
"LEFT join base_daily_report_item i on i.id = rd.report_item_id and i.del=1 where 1=1 " +
|
|
|
" "+sqlWhere+" and rd.doubt_type is not null group by rd.doubt_type";
|
|
|
List<Map<String,Object>> doubtTypeList = jdbcTemplate.queryForList(doubtTypeSql);
|
|
|
for (Map<String,Object>tmp:doubtTypeList){
|
|
|
String doubtType = tmp.get("doubt_type").toString();
|
|
|
if(doubtTypeObj.containsKey(doubtType)){
|
|
|
tmp.put("doubtTypeName",doubtTypeObj.get(doubtType));
|
|
|
}else {
|
|
|
tmp.put("doubtTypeName","其他");
|
|
|
}
|
|
|
}
|
|
|
List<String> doubtListStr = doubtTypeList.stream().map(e -> e.get("doubt_type").toString()).collect(Collectors.toList());
|
|
|
for (String key:doubtTypeObj.keySet()){
|
|
|
if (!doubtListStr.contains(key)){
|
|
|
Map<String,Object>tmp = new HashMap<>();
|
|
|
tmp.put("doubt_type",key);
|
|
|
tmp.put("doubtTypeName",doubtTypeObj.get(key));
|
|
|
tmp.put("total",0);
|
|
|
doubtTypeList.add(tmp);
|
|
|
}
|
|
|
}
|
|
|
doubtTypeList.sort(Comparator.comparing(e->e.get("doubt_type").toString()));
|
|
|
//员工离职or中途加入到项目中的会导致统计出来的数据发生变化
|
|
|
deptTmp.put("weishangbao",((workDays*members-shangchuanTotal))<0?0:(workDays*members-shangchuanTotal));//未上报 工作日次数-总上报次数
|
|
|
deptTmp.put("doubtList",doubtTypeList);
|
|
|
deptTmp.put("urgingTotal",urgingTotal);//项目催促
|
|
|
result.put("acWorkHours",acWorkHours);//实际工作时长
|
|
|
result.put("needWorkHours",needWorkHours);//应工作时长
|
|
|
}
|
|
|
result.put("deptList",deptList);
|
|
|
//项目效能
|
|
|
String sqlList = " select dict.dict_code project_code,dict.dict_value projectName,IFNULL( A.completionHour,0) 'completionHour', " +
|
|
|
" IFNULL(A.doctorTotal,0) 'doctorTotal',B.dict_code 'categoryCode',B.dict_value 'categoryName',C.dict_code 'levelCode' ,C.dict_value 'levelName' from wlyy_hospital_sys_dict dict " +
|
|
|
" Left JOIN (" +
|
|
|
" select i.project_code,CAST((sum(cast(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')) as decimal(18,2)))) as char ) as completionHour, " +
|
|
|
" count(distinct up.doctor_id) as doctorTotal from base_daily_report_item i LEFT JOIN base_daily_report_detail de on i.id = de.report_item_id " +
|
|
|
" INNER JOIN base_doctor_daily_report_upload up on up.id = de.report_id INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
|
|
|
" INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 where i.del=1 "+sqlCondition+" GROUP BY i.project_code )A " +
|
|
|
"on A.project_code = dict.dict_code " +
|
|
|
" INNER JOIN ( select dict_code,dict_value,sort from wlyy_hospital_sys_dict where dict_name='daily_report_category' )B on dict.saas_id = B.dict_code " +
|
|
|
" INNER JOIN ( select dict_code,dict_value,sort from wlyy_hospital_sys_dict where dict_name='daily_report_level' )C on dict.py_code = C.dict_code " +
|
|
|
" where dict.dict_name='daily_report_project' ";
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
|
sqlList +=" and dict.dict_code='"+projectCode+"' ";
|
|
|
}
|
|
|
sqlList += " order by B.sort asc, c.sort asc,completionHour desc ";
|
|
|
List<Map<String,Object>> projectList = jdbcTemplate.queryForList(sqlList);//一级项目列表
|
|
|
for (Map<String,Object> tmp:projectList){
|
|
|
String projectCodeTmp = tmp.get("project_code").toString();//一级项目Code
|
|
|
String projectTmpSqlCondition = " ";
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
|
projectTmpSqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
|
projectTmpSqlCondition += " and up.report_date<='"+endDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){//查询指定部门
|
|
|
projectTmpSqlCondition += " and dh.dept_code='"+dept+"' ";
|
|
|
}
|
|
|
|
|
|
String projectItemSql = " select i.id,i.dept,i.dept_name deptName,i.project_code,CAST((sum(cast(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')) as decimal(18,2)))) as char ) as completionHour, " +
|
|
|
" count(distinct up.doctor_id) as doctorTotal,i.begin_time,i.end_time,i.ac_begin_time, DATE_FORMAT(i.completion_time,'%Y-%m-%d %H:%i:%S') completion_time from base_daily_report_item i LEFT JOIN base_daily_report_detail de on i.id = de.report_item_id " +
|
|
|
" INNER JOIN base_doctor_daily_report_upload up on up.id = de.report_id INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
|
|
|
" INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 where i.del=1 and i.project_code='"+projectCodeTmp+"' "+projectTmpSqlCondition+" GROUP BY i.id ";
|
|
|
|
|
|
projectItemSql += " order by completionHour desc ";
|
|
|
List<Map<String,Object>> projectItemList = jdbcTemplate.queryForList(projectItemSql);//二级项目列表
|
|
|
for (Map<String,Object>itemTmp:projectItemList){//未饱和、效率、效能、项目催出情况
|
|
|
String projectItemCode = itemTmp.get("id").toString();//二级项目code
|
|
|
String itemTmpSqlCondition = " ";
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
|
itemTmpSqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
|
itemTmpSqlCondition += " and up.report_date<='"+endDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){//查询指定部门
|
|
|
itemTmpSqlCondition += " and dh.dept_code='"+dept+"' ";
|
|
|
}
|
|
|
String doubtTypeSql = " select count(distinct rd.id) as total,rd.doubt_type " +
|
|
|
" from base_doctor_daily_report_upload up " +
|
|
|
"INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
|
|
|
"Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
"LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id " +
|
|
|
"LEFT join base_daily_report_item i on i.id = rd.report_item_id and i.del=1 where i.id='"+projectItemCode+"' " +
|
|
|
" "+itemTmpSqlCondition+" and rd.doubt_type is not null group by rd.doubt_type";
|
|
|
List<Map<String,Object>> doubtTypeList = jdbcTemplate.queryForList(doubtTypeSql);
|
|
|
for (Map<String,Object>doubtTmp:doubtTypeList){
|
|
|
String doubtType = doubtTmp.get("doubt_type").toString();
|
|
|
if(doubtTypeObj.containsKey(doubtType)){
|
|
|
doubtTmp.put("doubtTypeName",doubtTypeObj.get(doubtType));
|
|
|
}else {
|
|
|
doubtTmp.put("doubtTypeName","其他");
|
|
|
}
|
|
|
}
|
|
|
String urgingSql = " select count(id) from base_daily_urging_record where create_time>='"+startDate+"' and create_time<='"+startDate+"' " +
|
|
|
" and project_code='"+projectCodeTmp+"' and report_item_id='"+projectItemCode+"' ";
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
urgingSql +=" and dept='"+dept+"' ";
|
|
|
}
|
|
|
Long urgingTotal = jdbcTemplate.queryForObject(urgingSql,Long.class);
|
|
|
itemTmp.put("doubtList",doubtTypeList);//各存疑类型
|
|
|
itemTmp.put("urgingTotal",urgingTotal);//项目催促
|
|
|
}
|
|
|
tmp.put("projectItemList",projectItemList);
|
|
|
}
|
|
|
result.put("projectList",projectList);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 初始化项目成员
|
|
|
* @return
|