|
@ -505,6 +505,14 @@ public class DailyReportUploadService {
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BaseDailyReportUploadDO verifiedItem(String doctorId,String reportId,List<BaseDailyReportDetailDO> detailDOList) throws Exception {
|
|
|
String doubtSql = " select dict_value from wlyy_hospital_sys_dict where dict_name='healthUpload' and dict_code='healthUpload' ";
|
|
|
List<String> dictValues = jdbcTemplate.queryForList(doubtSql,String.class);
|
|
|
JSONObject doubtTypeObj = new JSONObject();
|
|
|
if (dictValues.size()>0){
|
|
|
JSONObject tmp = JSONObject.parseObject(dictValues.get(0));
|
|
|
doubtTypeObj = tmp.getJSONObject("dailyReportDoubtTypeName");
|
|
|
}
|
|
|
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
|
|
|
String nowDate = DateUtil.getStringDateShort();
|
|
|
if (null==doctorDO){
|
|
@ -518,11 +526,15 @@ public class DailyReportUploadService {
|
|
|
if (DateUtil.getDays(nowDate,dailyReportUploadDO.getReportDate())>7){
|
|
|
throw new Exception("上传记录已超过7天无法再次操作");
|
|
|
}
|
|
|
Set<String> doubtTypeName = new HashSet<>();
|
|
|
if(detailDOList.size()>0){//无完成事项内容
|
|
|
boolean doubt =false;
|
|
|
for (BaseDailyReportDetailDO tmp:detailDOList){
|
|
|
if (1==tmp.getDoubt()&&(null==tmp.getDoubtState()||0==tmp.getDoubtState())){
|
|
|
doubt = true;
|
|
|
if(0!=tmp.getDoubtType()&&doubtTypeObj.containsKey(tmp.getDoubtType())){
|
|
|
doubtTypeName.add(doubtTypeObj.getString(tmp.getDoubtType()+""));
|
|
|
}
|
|
|
}
|
|
|
tmp.setVerificationTime(new Date());
|
|
|
tmp.setVerificationUser(doctorId);
|
|
@ -556,7 +568,7 @@ public class DailyReportUploadService {
|
|
|
logger.info("该用户"+doctorDO.getName()+"没有企业微信手机号,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
|
|
|
}else{
|
|
|
String title = "待办事项";
|
|
|
String des = "您好,"+doctorDO.getName()+"对"+dailyReportUploadDO.getDoctorName()+"已提交的每日日报有存疑,请点击前往审核。";
|
|
|
String des = "您好,"+doctorDO.getName()+"对"+dailyReportUploadDO.getDoctorName()+"已提交的每日日报提出"+doubtTypeName.stream().map(String::valueOf).collect(Collectors.joining("'、'"))+",请点击进行审核";
|
|
|
String url = "https://ehr.yihu.com/hlwyy/zjxl/dailyReport/#/workSummary/commit?mode=verify&id="+dailyReportUploadDO.getId();
|
|
|
String res = enterpriseService.sendTWMesByDoctor(wechatId,remindDoctorDO.getId(),title,des,url);
|
|
|
}
|
|
@ -1447,7 +1459,7 @@ public class DailyReportUploadService {
|
|
|
JSONObject doubtTypeObj = new JSONObject();
|
|
|
if (dictValues.size()>0){
|
|
|
JSONObject tmp = JSONObject.parseObject(dictValues.get(0));
|
|
|
doubtTypeObj = tmp.getJSONObject("dailyReportDoubtType");
|
|
|
doubtTypeObj = tmp.getJSONObject("dailyReportDoubtTypeName");
|
|
|
}
|
|
|
JSONArray array = new JSONArray();
|
|
|
for (i = 0; i < list.size(); i++) {
|
|
@ -1763,8 +1775,6 @@ public class DailyReportUploadService {
|
|
|
Integer weishangbaoTotal = 0;
|
|
|
Integer verifiedTotal = 0;
|
|
|
Integer notVerifiedTotal = 0;
|
|
|
Integer baoheDoubt = 0;
|
|
|
Integer xiaolvDoubt = 0;
|
|
|
//已上传
|
|
|
Map<String, Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
|
|
|
if (yishangchaungMap != null) {
|
|
@ -1827,46 +1837,57 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//不饱和存疑
|
|
|
String baoheTotalSql = "select COUNT(de.id) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 inner join base_daily_report_detail de " +
|
|
|
" on de.report_id = d.id where de.doubt_type=1 ";
|
|
|
//各类存疑
|
|
|
String doubtTypeSql = "select COUNT(de.id) as 'total',de.doubt_type from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 inner join base_daily_report_detail de " +
|
|
|
" on de.report_id = d.id where de.state=1 ";
|
|
|
String doubtTotalSql = "select COUNT(DISTINCT de.id) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 inner join base_daily_report_detail de " +
|
|
|
" on de.report_id = d.id where de.state=1 ";
|
|
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
|
baoheTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
|
doubtTypeSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
|
doubtTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
|
}
|
|
|
if (level==2){
|
|
|
baoheTotalSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
|
doubtTypeSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
|
doubtTotalSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
|
}
|
|
|
Map<String, Object> baoheMap = jdbcTemplate.queryForMap(baoheTotalSql);
|
|
|
if (baoheMap != null) {
|
|
|
if (baoheMap.get("total") != null) {
|
|
|
baoheDoubt = Integer.parseInt(baoheMap.get("total").toString());
|
|
|
}
|
|
|
}
|
|
|
//效率存疑
|
|
|
String xiaolvTotalSql = "select COUNT(de.id) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 inner join base_daily_report_detail de " +
|
|
|
" on de.report_id = d.id where de.doubt_type=2 ";
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
|
xiaolvTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
|
doubtTypeSql += " group by de.doubt_type ";
|
|
|
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");
|
|
|
}
|
|
|
if (level==2){
|
|
|
xiaolvTotalSql +=" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
|
|
|
|
List<Map<String,Object>> doubtDoubtList = jdbcTemplate.queryForList(doubtTypeSql);
|
|
|
for (Map<String,Object>tmp:doubtDoubtList){
|
|
|
String doubtType = tmp.get("doubt_type").toString();
|
|
|
if(doubtTypeObj.containsKey(doubtType)){
|
|
|
tmp.put("doubtTypeName",doubtTypeObj.get(doubtType));
|
|
|
}else {
|
|
|
tmp.put("doubtTypeName","其他");
|
|
|
}
|
|
|
}
|
|
|
Map<String, Object> xiaolvMap = jdbcTemplate.queryForMap(xiaolvTotalSql);
|
|
|
if (xiaolvMap != null) {
|
|
|
if (xiaolvMap.get("total") != null) {
|
|
|
xiaolvDoubt = Integer.parseInt(xiaolvMap.get("total").toString());
|
|
|
List<String> doubtListStr = doubtDoubtList.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);
|
|
|
doubtDoubtList.add(tmp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
doubtDoubtList.sort(Comparator.comparing(e->e.get("doubt_type").toString()));
|
|
|
Long doubtTotal = jdbcTemplate.queryForObject(doubtTotalSql,Long.class);
|
|
|
object.put("total", total);//总人次
|
|
|
object.put("yishangbaoTotal", yishangbaoTotal);//已上报
|
|
|
object.put("weishangbaoTotal", weishangbaoTotal);//未上报
|
|
|
object.put("verifiedTotal", verifiedTotal);//已核实
|
|
|
object.put("notVerifiedTotal", notVerifiedTotal);//未核实
|
|
|
object.put("shangchuanTotal", shangchuanTotal);//上传总次数
|
|
|
object.put("baoheDoubt", baoheDoubt);//不饱和存疑数量
|
|
|
object.put("xiaolvDoubt", xiaolvDoubt);//效率存疑数量
|
|
|
object.put("doubtTotal", baoheDoubt+xiaolvDoubt);//存疑总数
|
|
|
object.put("doubtList", doubtDoubtList);//各存疑次数
|
|
|
object.put("doubtTotal", doubtTotal);//存疑总数
|
|
|
return object;
|
|
|
}
|
|
|
|
|
@ -1907,14 +1928,6 @@ public class DailyReportUploadService {
|
|
|
doctorSql += " and d.name like '%" + name + "%' ";
|
|
|
}
|
|
|
|
|
|
// if (StringUtils.isNoneBlank(status)) {
|
|
|
// if (status.equalsIgnoreCase("1")) {//已上报
|
|
|
// doctorSql += " and d.id in(select d1.doctor_id from base_doctor_daily_report_upload d1 where 1=1 and d1.report_date >='" + startDate + "' and d1.report_date<='" + endDate + "' ) ";
|
|
|
// } else if (status.equalsIgnoreCase("2")) {//未上报
|
|
|
// doctorSql += " and d.id not in(select d1.doctor_id from base_doctor_daily_report_upload d1 where 1=1 and d1.report_date >='" + startDate + "' and d1.report_date<='" + endDate + "' ) ";
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
Integer doctorTotal = jdbcTemplate.queryForObject(doctorSql,Integer.class);
|
|
|
|
|
|
total = doctorTotal * (Integer.parseInt(day));
|
|
@ -1924,8 +1937,6 @@ public class DailyReportUploadService {
|
|
|
Integer notVerified=0;//未核实
|
|
|
Integer verified=0;//已核实
|
|
|
Integer shangchuanTotal=0;//上传总次数
|
|
|
Integer baoheDoubt=0;//饱和度存疑次数
|
|
|
Integer xiaolvDoubt=0;//效益存疑数量
|
|
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
|
sql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
@ -1963,47 +1974,82 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
|
|
|
//未核实数量
|
|
|
String notVerifiedSql = "select COUNT(DISTINCT d.id) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 inner join base_daily_report_detail de " +
|
|
|
" on d.id = de.report_id where de.state=0 ";
|
|
|
String notVerifiedSql = "select COUNT(DISTINCT d.id) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 Left join base_daily_report_detail de " +
|
|
|
" on d.id = de.report_id where d.state=0 ";
|
|
|
|
|
|
//已核实数量
|
|
|
String verifiedSql = "select COUNT(DISTINCT d.id) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 inner join base_daily_report_detail de " +
|
|
|
String verifiedSql = "select COUNT(DISTINCT d.id) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 Left join base_daily_report_detail de " +
|
|
|
" on d.id = de.report_id where d.state=1 ";
|
|
|
|
|
|
//各存疑类型
|
|
|
String doubtTypeSql = "select COUNT(DISTINCT de.id) as 'total',de.doubt_type from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 Left join base_daily_report_detail de " +
|
|
|
" on d.id = de.report_id where de.state=1 ";
|
|
|
//不饱和存疑
|
|
|
String bubaoheSql = "select COUNT(DISTINCT de.id) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 inner join base_daily_report_detail de " +
|
|
|
" on d.id = de.report_id where de.state=1 and de.doubt_type=1 ";
|
|
|
//效率存疑
|
|
|
String xiaolvSql = "select COUNT(DISTINCT de.id) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 inner join base_daily_report_detail de " +
|
|
|
" on d.id = de.report_id where de.state=1 and de.doubt_type=2 ";
|
|
|
sql = " select dict_value from wlyy_hospital_sys_dict where dict_name='healthUpload' and dict_code='healthUpload' ";
|
|
|
|
|
|
//存疑总数
|
|
|
String doubtTotalSql = "select COUNT(DISTINCT de.id) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 Left join base_daily_report_detail de " +
|
|
|
" on d.id = de.report_id where de.state=1 and de.doubt_type<>0 ";
|
|
|
|
|
|
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");
|
|
|
}
|
|
|
|
|
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
|
notVerifiedSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
|
verifiedSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
|
bubaoheSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
|
xiaolvSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
|
doubtTypeSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
|
doubtTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(deptCondition)) {
|
|
|
notVerifiedSql += " and d.doctor_id IN " + deptCondition;
|
|
|
verifiedSql += " and d.doctor_id IN " + deptCondition;
|
|
|
bubaoheSql += " and d.doctor_id IN " + deptCondition;
|
|
|
xiaolvSql += " and d.doctor_id IN " + deptCondition;
|
|
|
doubtTypeSql += " and d.doctor_id IN " + deptCondition;
|
|
|
doubtTotalSql += " and d.doctor_id IN " + deptCondition;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(idTypeCondition)) {
|
|
|
notVerifiedSql += " and d.doctor_id IN " + idTypeCondition;
|
|
|
verifiedSql += " and d.doctor_id IN " + idTypeCondition;
|
|
|
bubaoheSql += " and d.doctor_id IN " + idTypeCondition;
|
|
|
xiaolvSql += " and d.doctor_id IN " + idTypeCondition;
|
|
|
doubtTypeSql += " and d.doctor_id IN " + idTypeCondition;
|
|
|
doubtTotalSql += " and d.doctor_id IN " + idTypeCondition;
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
notVerifiedSql += " and d.doctor_name like '%" + name + "%'";
|
|
|
verifiedSql += " and d.doctor_name like '%" + name + "%'";
|
|
|
bubaoheSql += " and d.doctor_name like '%" + name + "%'";
|
|
|
xiaolvSql += " and d.doctor_name like '%" + name + "%'";
|
|
|
doubtTypeSql += " and d.doctor_name like '%" + name + "%'";
|
|
|
doubtTotalSql += " and d.doctor_name like '%" + name + "%'";
|
|
|
}
|
|
|
doubtTypeSql += " group by de.doubt_type ";
|
|
|
notVerified = jdbcTemplate.queryForObject(notVerifiedSql,Integer.class);
|
|
|
verified = jdbcTemplate.queryForObject(verifiedSql,Integer.class);
|
|
|
baoheDoubt = jdbcTemplate.queryForObject(bubaoheSql,Integer.class);
|
|
|
xiaolvDoubt = jdbcTemplate.queryForObject(xiaolvSql,Integer.class);
|
|
|
|
|
|
List<Map<String,Object>> doubtDoubtList = jdbcTemplate.queryForList(doubtTypeSql);
|
|
|
for (Map<String,Object>tmp:doubtDoubtList){
|
|
|
String doubtType = tmp.get("doubt_type").toString();
|
|
|
if(doubtTypeObj.containsKey(doubtType)){
|
|
|
tmp.put("doubtTypeName",doubtTypeObj.get(doubtType));
|
|
|
}else {
|
|
|
tmp.put("doubtTypeName","其他");
|
|
|
}
|
|
|
}
|
|
|
List<String> doubtListStr = doubtDoubtList.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);
|
|
|
doubtDoubtList.add(tmp);
|
|
|
}
|
|
|
}
|
|
|
doubtDoubtList.sort(Comparator.comparing(e->e.get("doubt_type").toString()));
|
|
|
|
|
|
Long doubtTotal = jdbcTemplate.queryForObject(doubtTotalSql,Long.class);
|
|
|
|
|
|
//上传总次数
|
|
|
shangchuanTotal = jdbcTemplate.queryForObject(shangchuanTotalSql,Integer.class);
|
|
@ -2014,9 +2060,8 @@ public class DailyReportUploadService {
|
|
|
object.put("notVerified", notVerified);//未核实数量
|
|
|
object.put("verified", verified);//已核实数量
|
|
|
object.put("shangchuanTotal", shangchuanTotal);//上传总次数
|
|
|
object.put("baoheDoubt", baoheDoubt);//饱和度存疑次数
|
|
|
object.put("xiaolvDoubt", xiaolvDoubt);//效率存疑次数
|
|
|
object.put("doubtTotal", baoheDoubt+xiaolvDoubt);//存疑总数
|
|
|
object.put("doubtList", doubtDoubtList);//各存疑次数
|
|
|
object.put("doubtTotal", doubtTotal);//存疑总数
|
|
|
return object;
|
|
|
}
|
|
|
|
|
@ -2748,6 +2793,9 @@ public class DailyReportUploadService {
|
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
|
sqlCondition += " and up.report_date<='"+endDate+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(dept)){
|
|
|
sqlCondition += " and i.dept='"+dept+"' ";
|
|
|
}
|
|
|
String groupTimeFormat = "";
|
|
|
String uploadTimeFormat = "";
|
|
|
if(0==type){//全部
|
|
@ -2768,13 +2816,16 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
String projectSql = " select dict.dict_code project_code,dict.dict_value projectName " +
|
|
|
" from wlyy_hospital_sys_dict dict INNER JOIN base_daily_report_item i on i.project_code = dict.dict_code " +
|
|
|
" where dict.dict_name='daily_report_project' and i.dept='"+dept+"'" +
|
|
|
"GROUP BY dict.dict_code ";
|
|
|
" where dict.dict_name='daily_report_project' ";
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
projectSql += " and i.dept='"+dept+"'";
|
|
|
}
|
|
|
projectSql +="GROUP BY dict.dict_code ";
|
|
|
List<Map<String,Object>> deptProjectList = jdbcTemplate.queryForList(projectSql);
|
|
|
String sqlList = " select i.project_code,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour, " +
|
|
|
" count(distinct up.doctor_id) as doctorTotal, "+uploadTimeFormat+" as '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 where i.del=1 and i.dept='"+dept+"' and i.project_code='{project_code}' "+sqlCondition+
|
|
|
" 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 where i.del=1 and i.project_code='{project_code}' "+sqlCondition+
|
|
|
" GROUP BY "+groupTimeFormat+" order by time asc";
|
|
|
for (Map<String,Object>tmp:deptProjectList){
|
|
|
String project_code = tmp.get("project_code").toString();
|
|
@ -2820,6 +2871,9 @@ public class DailyReportUploadService {
|
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
|
sqlCondition += " and up.report_date<='"+endDate+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(dept)){
|
|
|
sqlCondition+= " and i.dept='"+dept+"' ";
|
|
|
}
|
|
|
String groupTimeFormat = "";
|
|
|
String uploadTimeFormat = "";
|
|
|
if(0==type){//全部
|
|
@ -2840,13 +2894,16 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
String projectSql = " select i.id,CONCAT(i.title,'(',i.dept_name,')') title,i.content,i.state,i.begin_time beginTime, " +
|
|
|
" i.end_time endTime, i.create_user_name createUserName " +
|
|
|
" from base_daily_report_item i where i.project_code='"+projectCode+"' and i.dept='"+dept+"' " +
|
|
|
" GROUP BY i.id ";
|
|
|
" from base_daily_report_item i where i.project_code='"+projectCode+"' " ;
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
projectSql+=" and i.dept='"+dept+"' ";
|
|
|
}
|
|
|
projectSql +=" GROUP BY i.id ";
|
|
|
List<Map<String,Object>> deptProjectItemList = jdbcTemplate.queryForList(projectSql);
|
|
|
String sqlList = " select i.project_code,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour, " +
|
|
|
" count(distinct up.doctor_id) as doctorTotal, "+uploadTimeFormat+" as '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 where i.del=1 and i.dept='"+dept+"' and i.id='{itemId}' "+sqlCondition+
|
|
|
" 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 where i.del=1 and i.id='{itemId}' "+sqlCondition+
|
|
|
" GROUP BY "+groupTimeFormat+" order by time asc";
|
|
|
for (Map<String,Object>tmp:deptProjectItemList){
|
|
|
String itemId = tmp.get("id").toString();
|
|
@ -3048,7 +3105,7 @@ public class DailyReportUploadService {
|
|
|
JSONObject doubtTypeObj = new JSONObject();
|
|
|
if (dictValues.size()>0){
|
|
|
JSONObject tmp = JSONObject.parseObject(dictValues.get(0));
|
|
|
doubtTypeObj = tmp.getJSONObject("dailyReportDoubtType");
|
|
|
doubtTypeObj = tmp.getJSONObject("dailyReportDoubtTypeName");
|
|
|
}
|
|
|
|
|
|
|
|
@ -3089,35 +3146,42 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
String sqlWhere = " ";
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
|
sqlWhere += " and it.project_code='"+projectCode+"' ";
|
|
|
sqlWhere += " and rd.project_code='"+projectCode+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(item_id)){
|
|
|
sqlWhere += " and it.id='"+item_id+"' ";
|
|
|
sqlWhere += " and rd.report_item_id='"+item_id+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
sqlWhere +=" and it.dept='"+dept+"' ";
|
|
|
sqlWhere +=" and dh.dept_code='"+dept+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(memberId)){
|
|
|
sqlWhere +=" and up.doctor_id='"+memberId+"' ";
|
|
|
}
|
|
|
sqlWhere += " and rd.create_time>='"+startDate+"' and rd.create_time<='"+endDate+"' ";
|
|
|
|
|
|
Long workDays = DateUtil.getWorkDays(startDate,endDate);
|
|
|
Long members = 0l;
|
|
|
|
|
|
|
|
|
String shangchuanSql = " select count(distinct rd.report_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 " +
|
|
|
"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 where 1=1"+sqlWhere;
|
|
|
Long shangchuanTotal = jdbcTemplate.queryForObject(shangchuanSql,Long.class);
|
|
|
|
|
|
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_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 where 1=1 "+sqlWhere;
|
|
|
"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);
|
|
|
|
|
|
sqlWhere += " and up.report_date>='"+startDate+"' and up.report_date<='"+endDate+"' ";
|
|
|
|
|
|
Long workDays = DateUtil.getWorkDays(startDate,endDate);
|
|
|
|
|
|
|
|
|
|
|
|
String shangchuanSql = " select count(distinct up.id) 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 where 1=1 " +
|
|
|
" and DATE_FORMAT(up.report_date,'%w') BETWEEN 1 and 5 "+sqlWhere;
|
|
|
//只计算出周一到周五上传的数量去求未上传
|
|
|
|
|
|
Long shangchuanTotal = jdbcTemplate.queryForObject(shangchuanSql,Long.class);
|
|
|
|
|
|
|
|
|
Long acWorkHours = 0l;
|
|
|
Long needWorkHours = workDays*members*8;
|
|
@ -3138,23 +3202,27 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
urgingTotal = jdbcTemplate.queryForObject(urgingSql,Long.class);
|
|
|
|
|
|
String acWorkHoursSql = " select sum(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0))) 'completion_hour' 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 " +
|
|
|
"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 where 1=1 "+sqlWhere;
|
|
|
String acWorkHoursSql = " select sum(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0))) '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 where 1=1 " +
|
|
|
" "+sqlWhere;
|
|
|
acWorkHours = jdbcTemplate.queryForObject(acWorkHoursSql,Long.class);
|
|
|
|
|
|
String doubtTypeSql = " select count(distinct rd.id) as total,rd.doubt_type 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 " +
|
|
|
"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 where 1=1 "+sqlWhere+" and rd.doubt_type is not null group by rd.doubt_type";
|
|
|
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 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","未知存疑类型");
|
|
|
tmp.put("doubtTypeName","其他");
|
|
|
}
|
|
|
}
|
|
|
List<String> doubtListStr = doubtTypeList.stream().map(e -> e.get("doubt_type").toString()).collect(Collectors.toList());
|
|
@ -3170,12 +3238,24 @@ public class DailyReportUploadService {
|
|
|
doubtTypeList.sort(Comparator.comparing(e->e.get("doubt_type").toString()));
|
|
|
|
|
|
//员工离职or中途加入到项目中的会导致统计出来的数据发生变化
|
|
|
result.put("weishangbao",workDays*members-shangchuanTotal);//未上报 工作日次数-总上报次数
|
|
|
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 doctorTypeSql = " select sum(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0))) '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 where 1=1 " +
|
|
|
" "+sqlWhere+" group by doctor_duty_code ";
|
|
|
|
|
|
List<Map<String,Object>> doctorTypeHourList = jdbcTemplate.queryForList(doctorTypeSql);
|
|
|
result.put("doctorTypeHourList",doctorTypeHourList);//按人员统计总用时与参与人数
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@ -3187,13 +3267,13 @@ public class DailyReportUploadService {
|
|
|
}
|
|
|
String sqlWhere = " ";
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
|
sqlWhere += " and it.project_code='"+projectCode+"' ";
|
|
|
sqlWhere += " and rd.project_code='"+projectCode+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(item_id)){
|
|
|
sqlWhere += " and it.id='"+item_id+"' ";
|
|
|
sqlWhere += " and rd.report_item_id='"+item_id+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
sqlWhere +=" and it.dept='"+dept+"' ";
|
|
|
sqlWhere +=" and dh.dept_code='"+dept+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(memberId)){
|
|
|
sqlWhere +=" and up.doctor_id='"+memberId+"' ";
|
|
@ -3204,14 +3284,100 @@ public class DailyReportUploadService {
|
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
|
sqlWhere +=" and up.report_date<='"+endDate+"' ";
|
|
|
}
|
|
|
sql = " select sum(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0))) 'completion_hour',rd.work_type_name 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 " +
|
|
|
"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 where 1=1 "+sqlWhere+" group by rd.work_type_name ";
|
|
|
sql = " select sum(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0))) 'completion_hour',rd.work_type_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 where 1=1 " +
|
|
|
" "+sqlWhere+" group by rd.work_type_name ";
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
|
|
|
|
|
|
public PageEnvelop searchReportDetailListInfo(String user,String projectCode,String item_id,String dept,String memberName,
|
|
|
String workTypeName,String doubt,Integer urgeFlag,String startDate,String endDate,Integer page,Integer pageSize) throws Exception {
|
|
|
page = page>0?page-1:0;
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
if (userRoles.size()==0){
|
|
|
throw new Exception("您无权限操作");
|
|
|
}
|
|
|
|
|
|
String sqlWhere = " ";
|
|
|
String sqlUrgeWhere = " ";
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
|
sqlWhere += " and rd.project_code='"+projectCode+"' ";
|
|
|
sqlUrgeWhere += " and ur.project_code='"+projectCode+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(item_id)){
|
|
|
sqlWhere += " and rd.report_item_id='"+item_id+"' ";
|
|
|
sqlUrgeWhere += " and ur.report_item_id='"+item_id+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
sqlWhere +=" and dh.dept_code='"+dept+"' ";
|
|
|
sqlUrgeWhere +=" and ur.dept='"+dept+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(memberName)){
|
|
|
sqlWhere +=" and doc.name like '%"+memberName+"%' ";
|
|
|
sqlUrgeWhere +=" and doc.name like '%"+memberName+"%' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(workTypeName)){
|
|
|
sqlWhere +=" and rd.work_type_name='"+workTypeName+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(doubt)){
|
|
|
sqlWhere +=" and rd.doubt='"+doubt+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
|
sqlWhere +=" and up.report_date>='"+startDate+"' ";
|
|
|
sqlUrgeWhere +=" and ur.create_time>='"+startDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
|
sqlWhere +=" and up.report_date<='"+endDate+"' ";
|
|
|
sqlUrgeWhere +=" and ur.create_time<='"+endDate+"' ";
|
|
|
}
|
|
|
|
|
|
String reportSql = " select dh.dept_name,doc.id doctorCode,doc.name,CONCAT(rd.project_name,'(',rd.report_item_name,')') as 'projectNameStr', " +
|
|
|
" rd.project_name,rd.report_item_name,CONCAT(rd.work_type_name,'(',rd.report_content,')') as 'workContent', " +
|
|
|
" rd.work_type_name,rd.report_content,up.report_date,IFNULL(rd.actual_completion_hour,rd.completion_hour) 'completionHour', " +
|
|
|
" rd.doubt,rd.doubt_type,rd.verification_user_name,rd.remark " +
|
|
|
"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 where 1=1 "+sqlWhere+" ";
|
|
|
String reportSqlCount = " select count(*) as total " +
|
|
|
"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 where 1=1 "+sqlWhere+" ";
|
|
|
|
|
|
String urgeSql = " select dh.dept_name,doc.id doctorCode,doc.name,CONCAT(ur.project_name,'(',ur.report_item_name,')') as 'projectNameStr', " +
|
|
|
" ur.project_name,ur.report_item_name,'启动催促' as 'workContent', " +
|
|
|
" '' as 'work_type_name','' as 'rd.report_content',date_format(ur.create_time,'%Y-%m-%d' ) as 'report_date','' as 'completionHour', " +
|
|
|
" '' as 'doubt', '' as 'doubt_type' , ur.create_user_name as 'verification_user_name' , ur.remark " +
|
|
|
" from base_daily_urging_record ur " +
|
|
|
" INNER JOIN base_doctor doc on ur.receive_doctor = doc.id and doc.del=1 " +
|
|
|
"Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 "+sqlUrgeWhere;
|
|
|
String urgeSqlCount = " select count(*) as total " +
|
|
|
" from base_daily_urging_record ur " +
|
|
|
" INNER JOIN base_doctor doc on ur.receive_doctor = doc.id and doc.del=1 " +
|
|
|
"Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 "+sqlUrgeWhere;
|
|
|
List<Map<String,Object>> result = new ArrayList<>();
|
|
|
String sqlCount = " ";
|
|
|
if (null==urgeFlag||0==urgeFlag){
|
|
|
sql = reportSql+" UNION " +urgeSql;
|
|
|
sqlCount = reportSqlCount+" UNION ALL " +urgeSqlCount;
|
|
|
}else if (1==urgeFlag){
|
|
|
sql = reportSql;
|
|
|
sqlCount = reportSqlCount;
|
|
|
}else if (2==urgeFlag){
|
|
|
sql = urgeSql;
|
|
|
sqlCount = urgeSqlCount;
|
|
|
}else {
|
|
|
throw new Exception("传参错误");
|
|
|
}
|
|
|
sql += " order by report_date desc,doctorCode desc limit "+page*pageSize+","+pageSize;
|
|
|
result = jdbcTemplate.queryForList(sql);
|
|
|
Long count = jdbcTemplate.queryForObject(" select sum(total) from ("+sqlCount+")A ",Long.class);
|
|
|
return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导出项目计划周报月报用时情况
|
|
|
* @param user
|
|
@ -3243,8 +3409,8 @@ public class DailyReportUploadService {
|
|
|
startTime = DateUtil.getMondayOfThisWeek(DateUtil.strToDate(date))+" 00:00:00";
|
|
|
endTime = DateUtil.getSundayOfThisWeek(DateUtil.strToDate(date))+" 23:59:59";
|
|
|
}else if (2==type){//月报
|
|
|
startTime = DateUtil.getFristDayOfMonthThisDate(new Date())+" 00:00:00";
|
|
|
endTime = DateUtil.getLastDayOfMonthThisDate(new Date())+" 23:59:59";
|
|
|
startTime = DateUtil.getFristDayOfMonthThisDate(DateUtil.strToDate(date))+" 00:00:00";
|
|
|
endTime = DateUtil.getLastDayOfMonthThisDate(DateUtil.strToDate(date))+" 23:59:59";
|
|
|
}else {
|
|
|
throw new Exception("导出失败,请检查传入参数");
|
|
|
}
|
|
@ -3314,8 +3480,8 @@ public class DailyReportUploadService {
|
|
|
startTime = DateUtil.getMondayOfThisWeek(DateUtil.strToDate(date))+" 00:00:00";
|
|
|
endTime = DateUtil.getSundayOfThisWeek(DateUtil.strToDate(date))+" 23:59:59";
|
|
|
}else if (2==type){//月报
|
|
|
startTime = DateUtil.getFristDayOfMonthThisDate(new Date())+" 00:00:00";
|
|
|
endTime = DateUtil.getLastDayOfMonthThisDate(new Date())+" 23:59:59";
|
|
|
startTime = DateUtil.getFristDayOfMonthThisDate(DateUtil.strToDate(date))+" 00:00:00";
|
|
|
endTime = DateUtil.getLastDayOfMonthThisDate(DateUtil.strToDate(date))+" 23:59:59";
|
|
|
}else {
|
|
|
throw new Exception("导出失败,请检查传入参数");
|
|
|
}
|
|
@ -3493,7 +3659,7 @@ public class DailyReportUploadService {
|
|
|
JSONObject doubtTypeObj = new JSONObject();
|
|
|
if (dictValues.size()>0){
|
|
|
JSONObject tmp = JSONObject.parseObject(dictValues.get(0));
|
|
|
doubtTypeObj = tmp.getJSONObject("dailyReportDoubtType");
|
|
|
doubtTypeObj = tmp.getJSONObject("dailyReportDoubtTypeName");
|
|
|
}
|
|
|
|
|
|
WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
|