|
@ -89,6 +89,8 @@ public class DailyReportUploadService {
|
|
private BaseDailyReportItemDao reportItemDao;
|
|
private BaseDailyReportItemDao reportItemDao;
|
|
@Autowired
|
|
@Autowired
|
|
private BaseDailyReportItemMembersDao reportItemMembersDao;
|
|
private BaseDailyReportItemMembersDao reportItemMembersDao;
|
|
|
|
@Autowired
|
|
|
|
private BaseDailyUrgingRecordDao urgingRecordDao;
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(DailyReportUploadService.class);
|
|
private static Logger logger = LoggerFactory.getLogger(DailyReportUploadService.class);
|
|
|
|
|
|
@ -406,6 +408,16 @@ public class DailyReportUploadService {
|
|
}
|
|
}
|
|
tmp.setReportItemId(reportItemDO.getId());
|
|
tmp.setReportItemId(reportItemDO.getId());
|
|
tmp.setReportItemName(title);
|
|
tmp.setReportItemName(title);
|
|
|
|
}else {
|
|
|
|
BaseDailyReportItemMembersDO membersDOTmp = reportItemMembersDao.findMembers(tmp.getReportItemId(),doctorId);
|
|
|
|
if (null==membersDOTmp){
|
|
|
|
membersDOTmp = new BaseDailyReportItemMembersDO();
|
|
|
|
membersDOTmp.setReportItemId(tmp.getReportItemId());
|
|
|
|
membersDOTmp.setUserId(doctorId);
|
|
|
|
membersDOTmp.setUserName(doctorDO.getName());
|
|
|
|
membersDOTmp.setDel(1);
|
|
|
|
reportItemMembersDao.save(membersDOTmp);
|
|
|
|
}
|
|
}
|
|
}
|
|
BaseDailyReportItemDO reportItemDO = reportItemDao.findOne(tmp.getReportItemId());
|
|
BaseDailyReportItemDO reportItemDO = reportItemDao.findOne(tmp.getReportItemId());
|
|
if (null!=reportItemDO){
|
|
if (null!=reportItemDO){
|
|
@ -493,6 +505,14 @@ public class DailyReportUploadService {
|
|
*/
|
|
*/
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public BaseDailyReportUploadDO verifiedItem(String doctorId,String reportId,List<BaseDailyReportDetailDO> detailDOList) throws Exception {
|
|
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);
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
|
|
String nowDate = DateUtil.getStringDateShort();
|
|
String nowDate = DateUtil.getStringDateShort();
|
|
if (null==doctorDO){
|
|
if (null==doctorDO){
|
|
@ -506,11 +526,15 @@ public class DailyReportUploadService {
|
|
if (DateUtil.getDays(nowDate,dailyReportUploadDO.getReportDate())>7){
|
|
if (DateUtil.getDays(nowDate,dailyReportUploadDO.getReportDate())>7){
|
|
throw new Exception("上传记录已超过7天无法再次操作");
|
|
throw new Exception("上传记录已超过7天无法再次操作");
|
|
}
|
|
}
|
|
|
|
Set<String> doubtTypeName = new HashSet<>();
|
|
if(detailDOList.size()>0){//无完成事项内容
|
|
if(detailDOList.size()>0){//无完成事项内容
|
|
boolean doubt =false;
|
|
boolean doubt =false;
|
|
for (BaseDailyReportDetailDO tmp:detailDOList){
|
|
for (BaseDailyReportDetailDO tmp:detailDOList){
|
|
if (1==tmp.getDoubt()&&(null==tmp.getDoubtState()||0==tmp.getDoubtState())){
|
|
if (1==tmp.getDoubt()&&(null==tmp.getDoubtState()||0==tmp.getDoubtState())){
|
|
doubt = true;
|
|
doubt = true;
|
|
|
|
if(0!=tmp.getDoubtType()&&doubtTypeObj.containsKey(tmp.getDoubtType()+"")){
|
|
|
|
doubtTypeName.add(doubtTypeObj.getString(tmp.getDoubtType()+""));
|
|
|
|
}
|
|
}
|
|
}
|
|
tmp.setVerificationTime(new Date());
|
|
tmp.setVerificationTime(new Date());
|
|
tmp.setVerificationUser(doctorId);
|
|
tmp.setVerificationUser(doctorId);
|
|
@ -544,7 +568,7 @@ public class DailyReportUploadService {
|
|
logger.info("该用户"+doctorDO.getName()+"没有企业微信手机号,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
|
|
logger.info("该用户"+doctorDO.getName()+"没有企业微信手机号,无法推送模版消息,用户ID:"+doctorDO.getId()+"wechatId:"+wechatId);
|
|
}else{
|
|
}else{
|
|
String title = "待办事项";
|
|
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 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);
|
|
String res = enterpriseService.sendTWMesByDoctor(wechatId,remindDoctorDO.getId(),title,des,url);
|
|
}
|
|
}
|
|
@ -561,6 +585,29 @@ public class DailyReportUploadService {
|
|
baseDailyReportLogDO.setTypeName("上级核实未存疑");
|
|
baseDailyReportLogDO.setTypeName("上级核实未存疑");
|
|
baseDailyReportLogDO.setContent("上级核实未存疑");
|
|
baseDailyReportLogDO.setContent("上级核实未存疑");
|
|
}
|
|
}
|
|
|
|
try {
|
|
|
|
if (doubt==true){
|
|
|
|
BaseDoctorDO remindDoctorDO = 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 = "您好,"+doctorDO.getName()+"对您提交的每日日报提出"+doubtTypeName.stream().map(String::valueOf).collect(Collectors.joining("'、'"))+",请点击进行查看。";
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
dailyReportLogDao.save(baseDailyReportLogDO);
|
|
dailyReportLogDao.save(baseDailyReportLogDO);
|
|
|
|
|
|
}else {
|
|
}else {
|
|
@ -626,6 +673,97 @@ public class DailyReportUploadService {
|
|
return dailyReportUploadDO;
|
|
return dailyReportUploadDO;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 催促代办项目
|
|
|
|
*/
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public List<BaseDailyUrgingRecordDO> urgingDoctor(String doctorId,String receiveDoctorId, List<BaseDailyUrgingRecordDO> urgingRecordDOS) throws Exception {
|
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
|
|
|
|
if (StringUtils.isBlank(receiveDoctorId)){
|
|
|
|
BaseDailyReportUploadDO dailyReportUploadDO = dailyReportUploadDao.findOne(urgingRecordDOS.get(0).getReportId());
|
|
|
|
if (null==dailyReportUploadDO){
|
|
|
|
throw new Exception("传参错误");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String code = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
|
|
|
|
|
if (null==doctorDO){
|
|
|
|
throw new Exception("无权限操作");
|
|
|
|
}
|
|
|
|
BaseDoctorDO receiveDoctor = baseDoctorDao.findById(receiveDoctorId);
|
|
|
|
if (null==receiveDoctor){
|
|
|
|
throw new Exception("员工不存在");
|
|
|
|
}
|
|
|
|
String dept = "";
|
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(receiveDoctorId);
|
|
|
|
if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
|
|
|
|
dept = doctorHospitalDOS.get(0).getDeptCode();
|
|
|
|
}
|
|
|
|
for (BaseDailyUrgingRecordDO tmp:urgingRecordDOS){
|
|
|
|
tmp.setCode(code);
|
|
|
|
tmp.setReceiveDoctor(receiveDoctorId);
|
|
|
|
tmp.setDoctorName(receiveDoctor.getName());
|
|
|
|
tmp.setCreateUser(doctorId);
|
|
|
|
tmp.setCreateUserName(doctorDO.getName());
|
|
|
|
tmp.setCreateTime(new Date());
|
|
|
|
tmp.setDept(dept);
|
|
|
|
tmp.setDel(1);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
BaseDoctorDO remindDoctorDO = baseDoctorDao.findById(receiveDoctorId);
|
|
|
|
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 = "您好,"+doctorDO.getName()+"对您发起"+urgingRecordDOS.size()+"项加急待办事项,请点击进行查看。";
|
|
|
|
String url = "https://ehr.yihu.com/hlwyy/zjxl/dailyReport/#/workSummary/urge?id="+code;
|
|
|
|
String res = enterpriseService.sendTWMesByDoctor(wechatId,remindDoctorDO.getId(),title,des,url);
|
|
|
|
}
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
urgingRecordDao.save(urgingRecordDOS);
|
|
|
|
urgingRecordDOS = urgingRecordDao.findByCodeAndDel(code,1);
|
|
|
|
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 ";
|
|
|
|
if (StringUtils.isNotBlank(code)){
|
|
|
|
sql +=" and ur.code='"+code+"' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(doctor)){
|
|
|
|
sql +=" and ur.receive_doctor='"+doctor+"' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(reportId)){
|
|
|
|
sql +=" and ur.report_id='"+reportId+"' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(createUser)){
|
|
|
|
sql +=" and ur.create_user='"+createUser+"' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(startTime)){
|
|
|
|
sql +=" and ur.create_time>='"+startTime+"' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(endTime)){
|
|
|
|
sql +=" and ur.create_time<='"+endTime+"' ";
|
|
|
|
}
|
|
|
|
sql +=" group by ur.code order by ur.create_time desc ";
|
|
|
|
|
|
|
|
return jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseDailyUrgingRecordDO.class));
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<BaseDailyUrgingRecordDO> getUrgingDetail(String code){
|
|
|
|
return urgingRecordDao.findByCodeAndDel(code,1);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取当天日报上传记录
|
|
* 获取当天日报上传记录
|
|
* @param doctor
|
|
* @param doctor
|
|
@ -660,6 +798,13 @@ public class DailyReportUploadService {
|
|
tmp.setDetailDOList(detailDOS);
|
|
tmp.setDetailDOList(detailDOS);
|
|
List<BaseDailyReportLogDO> dailyReportLogDOList = dailyReportLogDao.findByReportId(tmp.getId());
|
|
List<BaseDailyReportLogDO> dailyReportLogDOList = dailyReportLogDao.findByReportId(tmp.getId());
|
|
tmp.setDailyReportLogDOList(dailyReportLogDOList);
|
|
tmp.setDailyReportLogDOList(dailyReportLogDOList);
|
|
|
|
tmp.setDoubt(false);
|
|
|
|
if (detailDOS.size()>0){
|
|
|
|
Integer sum = detailDOS.stream().mapToInt(e->e.getDoubt()==null?0:e.getDoubt()).sum();
|
|
|
|
if (sum>0){
|
|
|
|
tmp.setDoubt(true);
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
Map<String,List<BaseDailyReportUploadDO>> reportList = list.stream().collect(Collectors.groupingBy(BaseDailyReportUploadDO::getReportDate));
|
|
Map<String,List<BaseDailyReportUploadDO>> reportList = list.stream().collect(Collectors.groupingBy(BaseDailyReportUploadDO::getReportDate));
|
|
Date endDate =DateUtil.strToDate(endDateStr);
|
|
Date endDate =DateUtil.strToDate(endDateStr);
|
|
@ -722,14 +867,20 @@ public class DailyReportUploadService {
|
|
reportUploadDO = new BaseDailyReportUploadDO();
|
|
reportUploadDO = new BaseDailyReportUploadDO();
|
|
}
|
|
}
|
|
//今日本人上报数量
|
|
//今日本人上报数量
|
|
String benrenTotalSql = " select count(1) from base_doctor_daily_report_upload where doctor_id='"+doctorId+"' and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' ";
|
|
|
|
|
|
String benrenTotalSql = " 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.doctor_id='"+doctorId+"' and up.report_date>='"+nowDate+"' and up.report_date<='"+nowDate+"' ";
|
|
//本人已上报数量
|
|
//本人已上报数量
|
|
String benrenshangbaoTotalSql = " select count(1) from base_doctor_daily_report_upload where doctor_id='"+doctorId+"' ";
|
|
|
|
|
|
String benrenshangbaoTotalSql = " 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.doctor_id='"+doctorId+"' ";
|
|
//本人上级未核实事项数
|
|
//本人上级未核实事项数
|
|
String benrenVerifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" +
|
|
|
|
|
|
String benrenVerifiedSql = " 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_daily_report_detail de on up.id = de.report_id" +
|
|
" where up.doctor_id='"+doctorId+"' and de.state=1 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' ";
|
|
" where up.doctor_id='"+doctorId+"' and de.state=1 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' ";
|
|
//本人上级已核实事项数
|
|
//本人上级已核实事项数
|
|
String benrenNotVerifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" +
|
|
|
|
|
|
String benrenNotVerifiedSql = " 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_daily_report_detail de on up.id = de.report_id" +
|
|
" where up.doctor_id='"+doctorId+"' and de.state=0 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' ";
|
|
" where up.doctor_id='"+doctorId+"' and de.state=0 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' ";
|
|
|
|
|
|
//科室总人数
|
|
//科室总人数
|
|
@ -744,26 +895,32 @@ public class DailyReportUploadService {
|
|
//总人数
|
|
//总人数
|
|
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 ";
|
|
//今日上报人数
|
|
//今日上报人数
|
|
sqlTotalSql = " select count(1) from base_doctor_daily_report_upload where report_date>='"+nowDate+"' and report_date<='"+nowDate+"' ";
|
|
|
|
|
|
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+"' ";
|
|
//今日核实数量
|
|
//今日核实数量
|
|
verifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" +
|
|
|
|
|
|
verifiedSql = " 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_daily_report_detail de on up.id = de.report_id" +
|
|
" where de.state=1 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' ";
|
|
" where de.state=1 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' ";
|
|
//今日未核实数量
|
|
//今日未核实数量
|
|
notVerifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" +
|
|
|
|
|
|
notVerifiedSql = " 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_daily_report_detail de on up.id = de.report_id" +
|
|
" where de.state=0 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' ";
|
|
" where de.state=0 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' ";
|
|
} else if (level == 2) {
|
|
} else if (level == 2) {
|
|
//总人次
|
|
//总人次
|
|
doctorTotalSql = " select COUNT(1) as 'total' from base_doctor d where d.del=1 and id " +
|
|
doctorTotalSql = " 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 )";
|
|
" IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
|
|
//今日上报人数
|
|
//今日上报人数
|
|
sqlTotalSql = " select count(1) from base_doctor_daily_report_upload where report_date>='"+nowDate+"' and report_date<='"+nowDate+"' " +
|
|
|
|
" and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
|
|
|
|
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+"' " +
|
|
|
|
" and up.doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
//今日核实数量
|
|
//今日核实数量
|
|
verifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" +
|
|
|
|
|
|
verifiedSql = " 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_daily_report_detail de on up.id = de.report_id" +
|
|
" where de.state=1 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"'" +
|
|
" where de.state=1 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 ) ";
|
|
" and up.doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
//今日未核实数量
|
|
//今日未核实数量
|
|
notVerifiedSql = " select count(distinct up.id) from base_doctor_daily_report_upload up inner join base_daily_report_detail de on up.id = de.report_id" +
|
|
|
|
|
|
notVerifiedSql = " 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_daily_report_detail de on up.id = de.report_id" +
|
|
" where de.state=0 and report_date>='"+nowDate+"' and report_date<='"+nowDate+"' " +
|
|
" 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 ) ";
|
|
" and up.doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
}
|
|
}
|
|
@ -824,16 +981,16 @@ public class DailyReportUploadService {
|
|
String deptSql = " select code,name,dh1.doctorTotal,dh2.yishangbaoTotal,dh3.verified,dh4.notVerified,dh5.shangchuanTotal from dict_hospital_dept hd " +
|
|
String deptSql = " select code,name,dh1.doctorTotal,dh2.yishangbaoTotal,dh3.verified,dh4.notVerified,dh5.shangchuanTotal from dict_hospital_dept hd " +
|
|
"LEFT JOIN (select count(1) as 'doctorTotal',dh.dept_code from base_doctor d LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"LEFT JOIN (select count(1) as 'doctorTotal',dh.dept_code from base_doctor d LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"WHERE d.del = 1 AND dh.del = 1 "+doctorSqlCondition+" GROUP BY dh.dept_code)dh1 ON hd.CODE = dh1.dept_code " +
|
|
"WHERE d.del = 1 AND dh.del = 1 "+doctorSqlCondition+" GROUP BY dh.dept_code)dh1 ON hd.CODE = dh1.dept_code " +
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'yishangbaoTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id " +
|
|
|
|
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'yishangbaoTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id and d.del=1 " +
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code)dh2 ON hd.CODE = dh2.dept_code " +
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code)dh2 ON hd.CODE = dh2.dept_code " +
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'verified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'verified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
|
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id and d.del=1 LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"where 1=1 and de.state=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code)dh3 ON hd.CODE = dh3.dept_code " +
|
|
"where 1=1 and de.state=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code)dh3 ON hd.CODE = dh3.dept_code " +
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'notVerified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'notVerified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
|
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id and d.del=1 LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"where 1=1 and de.state=0 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code)dh4 ON hd.CODE = dh4.dept_code " +
|
|
"where 1=1 and de.state=0 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code)dh4 ON hd.CODE = dh4.dept_code " +
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'shangchuanTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id " +
|
|
|
|
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'shangchuanTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id and d.del=1 " +
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+")dh5 ON hd.CODE = dh5.dept_code " +
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+")dh5 ON hd.CODE = dh5.dept_code " +
|
|
" WHERE hd.consult_dept_flag = 1 ";
|
|
" WHERE hd.consult_dept_flag = 1 ";
|
|
@ -945,16 +1102,16 @@ public class DailyReportUploadService {
|
|
String deptSql = " select code,name,dh1.doctorTotal,dh2.yishangbaoTotal,dh3.verified,dh4.notVerified,dh5.shangchuanTotal from dict_hospital_dept hd " +
|
|
String deptSql = " select code,name,dh1.doctorTotal,dh2.yishangbaoTotal,dh3.verified,dh4.notVerified,dh5.shangchuanTotal from dict_hospital_dept hd " +
|
|
"LEFT JOIN (select count(1) as 'doctorTotal',dh.dept_code from base_doctor d LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"LEFT JOIN (select count(1) as 'doctorTotal',dh.dept_code from base_doctor d LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"WHERE d.del = 1 AND dh.del = 1 "+doctorSqlCondition+" GROUP BY dh.dept_code)dh1 ON hd.CODE = dh1.dept_code " +
|
|
"WHERE d.del = 1 AND dh.del = 1 "+doctorSqlCondition+" GROUP BY dh.dept_code)dh1 ON hd.CODE = dh1.dept_code " +
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'yishangbaoTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id " +
|
|
|
|
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'yishangbaoTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id and d.del=1 " +
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh2 ON hd.CODE = dh2.dept_code " +
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh2 ON hd.CODE = dh2.dept_code " +
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'verified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'verified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
|
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id and d.del=1 LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"where 1=1 and de.state=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh3 ON hd.CODE = dh3.dept_code " +
|
|
"where 1=1 and de.state=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh3 ON hd.CODE = dh3.dept_code " +
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'notVerified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
"LEFT JOIN(select dh.dept_code,count(distinct up.id) 'notVerified' from base_doctor_daily_report_upload up LEFT JOIN base_daily_report_detail de on up.id = de.report_id " +
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
|
|
|
|
"INNER JOIN base_doctor d on up.doctor_id = d.id and d.del=1 LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"where 1=1 and de.state=0 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh4 ON hd.CODE = dh4.dept_code " +
|
|
"where 1=1 and de.state=0 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh4 ON hd.CODE = dh4.dept_code " +
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'shangchuanTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id " +
|
|
|
|
|
|
"LEFT JOIN(select dh.dept_code,count(up.id) 'shangchuanTotal' from base_doctor_daily_report_upload up INNER JOIN base_doctor d on up.doctor_id = d.id and d.del=1 " +
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id " +
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh5 ON hd.CODE = dh5.dept_code " +
|
|
"where 1=1 "+doctorSqlCondition+reportCondition+" GROUP BY dh.dept_code )dh5 ON hd.CODE = dh5.dept_code " +
|
|
" WHERE hd.consult_dept_flag = 1 ";
|
|
" WHERE hd.consult_dept_flag = 1 ";
|
|
@ -1019,8 +1176,25 @@ public class DailyReportUploadService {
|
|
* @param endDate
|
|
* @param endDate
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONArray selectListByTotal(String dept, String idType, String status, String state, String startDate, String endDate, String name,Integer doubtType) {
|
|
|
|
|
|
public JSONArray selectListByTotal(String user,String dept, String idType, String status, String state, String startDate, String endDate, String name,Integer doubtType) {
|
|
List<String> list = new ArrayList<>();
|
|
List<String> list = new ArrayList<>();
|
|
|
|
|
|
|
|
String doctorSqlCondition = " ";
|
|
|
|
if (StringUtils.isNotBlank(user)){
|
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' and role_code ='admin' ";
|
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
|
if (userRoles.size()>0){
|
|
|
|
doctorSqlCondition = " and d.id in ( select distinct doc.id from base_doctor doc " +
|
|
|
|
"INNER JOIN base_doctor_role role on doc.id =role.doctor_code where doc.del=1 and doc.identity=0 " +
|
|
|
|
"union " +
|
|
|
|
"select distinct doc.id from base_doctor doc left JOIN base_doctor_hospital dh on doc.id = dh.doctor_code " +
|
|
|
|
" LEFT JOIN (select distinct dh1.dept_code,doc1.id from base_doctor doc1 " +
|
|
|
|
"INNER JOIN base_doctor_role role1 on doc1.id =role1.doctor_code " +
|
|
|
|
"INNER JOIN base_doctor_hospital dh1 on doc1.id =dh1.doctor_code where doc1.del=1 and dh1.del=1 and doc1.identity=0 )A on dh.dept_code = A.dept_code " +
|
|
|
|
"where doc.del=1 and doc.identity=0 and A.dept_code is null ) ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
Date startTime = DateUtil.strToDateShort(startDate);
|
|
Date startTime = DateUtil.strToDateShort(startDate);
|
|
Date endDateTime = DateUtil.strToDateShort(endDate);
|
|
Date endDateTime = DateUtil.strToDateShort(endDate);
|
|
int i=0;
|
|
int i=0;
|
|
@ -1033,7 +1207,7 @@ public class DailyReportUploadService {
|
|
JSONArray array = new JSONArray();
|
|
JSONArray array = new JSONArray();
|
|
for ( i = 0; i < list.size(); i++) {
|
|
for ( i = 0; i < list.size(); i++) {
|
|
String date = list.get(i);
|
|
String date = list.get(i);
|
|
String doctorSql = " select COUNT(1) as 'total' from base_doctor d where d.del=1 and d.identity=0 ";
|
|
|
|
|
|
String doctorSql = " select COUNT(1) as 'total' from base_doctor d where d.del=1 and d.identity=0 "+doctorSqlCondition;
|
|
String deptCondition = "";
|
|
String deptCondition = "";
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
deptCondition += " (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
|
|
deptCondition += " (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
|
|
@ -1091,8 +1265,24 @@ public class DailyReportUploadService {
|
|
* @param name total
|
|
* @param name total
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONArray selectListInfoByTotal(String dept, String idType, String status, String state, String startDate, String endDate, String name,
|
|
|
|
|
|
public JSONArray selectListInfoByTotal(String user, String dept, String idType, String status, String state, String startDate, String endDate, String name,
|
|
Integer doubtType) {
|
|
Integer doubtType) {
|
|
|
|
String doctorSqlCondition = " ";
|
|
|
|
if (StringUtils.isNotBlank(user)){
|
|
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' and role_code ='admin' ";
|
|
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
|
|
if (userRoles.size()>0){
|
|
|
|
doctorSqlCondition = " and d.id in ( select distinct doc.id from base_doctor doc " +
|
|
|
|
"INNER JOIN base_doctor_role role on doc.id =role.doctor_code where doc.del=1 and doc.identity=0 " +
|
|
|
|
"union " +
|
|
|
|
"select distinct doc.id from base_doctor doc left JOIN base_doctor_hospital dh on doc.id = dh.doctor_code " +
|
|
|
|
" LEFT JOIN (select distinct dh1.dept_code,doc1.id from base_doctor doc1 " +
|
|
|
|
"INNER JOIN base_doctor_role role1 on doc1.id =role1.doctor_code " +
|
|
|
|
"INNER JOIN base_doctor_hospital dh1 on doc1.id =dh1.doctor_code where doc1.del=1 and dh1.del=1 and doc1.identity=0 )A on dh.dept_code = A.dept_code " +
|
|
|
|
"where doc.del=1 and doc.identity=0 and A.dept_code is null ) ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
List<String> list = new ArrayList<>();
|
|
List<String> list = new ArrayList<>();
|
|
Date startTime = DateUtil.strToDateShort(startDate);
|
|
Date startTime = DateUtil.strToDateShort(startDate);
|
|
Date endDateTime = DateUtil.strToDateShort(endDate);
|
|
Date endDateTime = DateUtil.strToDateShort(endDate);
|
|
@ -1106,7 +1296,7 @@ public class DailyReportUploadService {
|
|
JSONArray array = new JSONArray();
|
|
JSONArray array = new JSONArray();
|
|
for (i = 0; i < list.size(); i++) {
|
|
for (i = 0; i < list.size(); i++) {
|
|
String date = list.get(i);
|
|
String date = list.get(i);
|
|
String doctorSql = " select d.name,d.id,d.job_title_name as jobTitleName,d.photo from base_doctor d where d.del=1 and d.identity=0 ";
|
|
|
|
|
|
String doctorSql = " select d.name,d.id,d.job_title_name as jobTitleName,d.photo from base_doctor d where d.del=1 and d.identity=0 "+doctorSqlCondition;
|
|
String deptCondition = "";
|
|
String deptCondition = "";
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
deptCondition += " (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
|
|
deptCondition += " (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 )";
|
|
@ -1147,7 +1337,8 @@ public class DailyReportUploadService {
|
|
stateCondition += " and d1.state='"+state+"' ";
|
|
stateCondition += " and d1.state='"+state+"' ";
|
|
|
|
|
|
}
|
|
}
|
|
String sql = " select d1.id,d1.state,total_hour from base_doctor_daily_report_upload d1 where d1.doctor_id='"+id+"' and d1.report_date>='"+date+"' and d1.report_date<='"+date+"' ORDER BY report_date desc ";
|
|
|
|
|
|
String sql = " select d1.id,d1.state,total_hour from base_doctor_daily_report_upload d1 INNER JOIN base_doctor doc on d1.doctor_id = doc.id " +
|
|
|
|
" and doc.del=1 where d1.doctor_id='"+id+"' and d1.report_date>='"+date+"' and d1.report_date<='"+date+"' ORDER BY report_date desc ";
|
|
List<Map<String, Object>> mapList1 = jdbcTemplate.queryForList(sql);
|
|
List<Map<String, Object>> mapList1 = jdbcTemplate.queryForList(sql);
|
|
if (mapList1 != null && mapList1.size() != 0) {
|
|
if (mapList1 != null && mapList1.size() != 0) {
|
|
for (Map<String, Object> map1 : mapList1) {
|
|
for (Map<String, Object> map1 : mapList1) {
|
|
@ -1206,7 +1397,7 @@ public class DailyReportUploadService {
|
|
String doubtSql = " select count(distinct rd.id) as 'total' from base_doctor_daily_report_upload up " +
|
|
String doubtSql = " select count(distinct rd.id) as 'total' from base_doctor_daily_report_upload up " +
|
|
" inner join base_doctor d on up.doctor_id = d.id and d.del=1 and d.identity=0 " +
|
|
" inner join base_doctor d on up.doctor_id = d.id and d.del=1 and d.identity=0 " +
|
|
" inner join base_daily_report_detail rd on up.id = rd.report_id " +
|
|
" inner join base_daily_report_detail rd on up.id = rd.report_id " +
|
|
" where rd.doubt=1 and up.report_date >='" + date + "' and up.report_date<='" + date + "' and up.state=1 ";
|
|
|
|
|
|
" where up.report_date >='" + date + "' and up.report_date<='" + date + "' and up.state=1 ";
|
|
|
|
|
|
String deptCondition = "";
|
|
String deptCondition = "";
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
@ -1219,11 +1410,7 @@ public class DailyReportUploadService {
|
|
doubtSql += " and d.id IN " + deptCondition;
|
|
doubtSql += " and d.id IN " + deptCondition;
|
|
}
|
|
}
|
|
if (null!=doubtType){
|
|
if (null!=doubtType){
|
|
if (0==doubtType){
|
|
|
|
doubtSql += " and rd.doubt_type is not null ";
|
|
|
|
}else{
|
|
|
|
doubtSql += " and rd.doubt_type='"+doubtType+"' ";
|
|
|
|
}
|
|
|
|
|
|
doubtSql += " and rd.doubt_type='"+doubtType+"' ";
|
|
}
|
|
}
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
doubtSql += " and d.name LIKE '%" + name + "%' ";
|
|
doubtSql += " and d.name LIKE '%" + name + "%' ";
|
|
@ -1265,6 +1452,13 @@ public class DailyReportUploadService {
|
|
list.add(str);
|
|
list.add(str);
|
|
i=1;
|
|
i=1;
|
|
}while (startTime.before(endDateTime));
|
|
}while (startTime.before(endDateTime));
|
|
|
|
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");
|
|
|
|
}
|
|
JSONArray array = new JSONArray();
|
|
JSONArray array = new JSONArray();
|
|
for (i = 0; i < list.size(); i++) {
|
|
for (i = 0; i < list.size(); i++) {
|
|
String date = list.get(i);
|
|
String date = list.get(i);
|
|
@ -1275,7 +1469,7 @@ public class DailyReportUploadService {
|
|
" from base_doctor_daily_report_upload up " +
|
|
" from base_doctor_daily_report_upload up " +
|
|
" inner join base_doctor d on up.doctor_id = d.id and d.del=1 and d.identity=0 " +
|
|
" inner join base_doctor d on up.doctor_id = d.id and d.del=1 and d.identity=0 " +
|
|
" inner join base_daily_report_detail rd on up.id = rd.report_id " +
|
|
" inner join base_daily_report_detail rd on up.id = rd.report_id " +
|
|
" where rd.doubt=1 and up.report_date >='" + date + "' and up.report_date<='" + date + "' and up.state=1 ";
|
|
|
|
|
|
" where up.report_date >='" + date + "' and up.report_date<='" + date + "' and up.state=1 ";
|
|
|
|
|
|
String deptCondition = "";
|
|
String deptCondition = "";
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
@ -1288,11 +1482,7 @@ public class DailyReportUploadService {
|
|
doubtSql += " and d.id IN " + deptCondition;
|
|
doubtSql += " and d.id IN " + deptCondition;
|
|
}
|
|
}
|
|
if (null!=doubtType){
|
|
if (null!=doubtType){
|
|
if(0==doubtType){
|
|
|
|
doubtSql += " and rd.doubt_type is not null ";
|
|
|
|
}else {
|
|
|
|
doubtSql += " and rd.doubt_type='"+doubtType+"' ";
|
|
|
|
}
|
|
|
|
|
|
doubtSql += " and rd.doubt_type='"+doubtType+"' ";
|
|
}
|
|
}
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
doubtSql += " and d.name LIKE '%" + name + "%' ";
|
|
doubtSql += " and d.name LIKE '%" + name + "%' ";
|
|
@ -1318,15 +1508,8 @@ public class DailyReportUploadService {
|
|
map.put("doubt_state", "存疑未核实");
|
|
map.put("doubt_state", "存疑未核实");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
map.put("doubt_type", "");
|
|
|
|
if (StringUtils.isNotBlank(doubt_type)){
|
|
if (StringUtils.isNotBlank(doubt_type)){
|
|
if("1".equals(doubt_type)){
|
|
|
|
map.put("doubt_type", "不饱和存疑");
|
|
|
|
} else if ("2".equals(doubt_type)){
|
|
|
|
map.put("doubt_type", "效率存疑");
|
|
|
|
}else {
|
|
|
|
map.put("doubt_type", "");
|
|
|
|
}
|
|
|
|
|
|
map.put("doubt_type",null==doubtTypeObj.get("doubt_type")?"":doubtTypeObj.get("doubt_type").toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
JSONObject object = new JSONObject();
|
|
JSONObject object = new JSONObject();
|
|
@ -1567,7 +1750,7 @@ public class DailyReportUploadService {
|
|
sqlCondition =" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
sqlCondition =" and d.doctor_id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
}
|
|
}
|
|
String sql = " SELECT SUM(d1.total) as total from (select COUNT(DISTINCT d.doctor_id) as 'total',date_format(d.report_date ,'%Y-%m-%d' ) " +
|
|
String sql = " SELECT SUM(d1.total) as total from (select COUNT(DISTINCT d.doctor_id) as 'total',date_format(d.report_date ,'%Y-%m-%d' ) " +
|
|
" from base_doctor_daily_report_upload d where 1=1 "+sqlCondition+" and d.report_date >='"+startDate+"' and d.report_date<='"+endDate+"' " +
|
|
|
|
|
|
" from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 where 1=1 "+sqlCondition+" and d.report_date >='"+startDate+"' and d.report_date<='"+endDate+"' " +
|
|
" GROUP BY date_format(d.report_date ,'%Y-%m-%d' ))d1 ";
|
|
" GROUP BY date_format(d.report_date ,'%Y-%m-%d' ))d1 ";
|
|
if (level==2){
|
|
if (level==2){
|
|
doctorSql +=" and d.id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
doctorSql +=" and d.id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '" + dept + "' and dh.del=1 ) ";
|
|
@ -1585,8 +1768,6 @@ public class DailyReportUploadService {
|
|
Integer weishangbaoTotal = 0;
|
|
Integer weishangbaoTotal = 0;
|
|
Integer verifiedTotal = 0;
|
|
Integer verifiedTotal = 0;
|
|
Integer notVerifiedTotal = 0;
|
|
Integer notVerifiedTotal = 0;
|
|
Integer baoheDoubt = 0;
|
|
|
|
Integer xiaolvDoubt = 0;
|
|
|
|
//已上传
|
|
//已上传
|
|
Map<String, Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
|
|
Map<String, Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
|
|
if (yishangchaungMap != null) {
|
|
if (yishangchaungMap != null) {
|
|
@ -1600,7 +1781,7 @@ public class DailyReportUploadService {
|
|
//上传总次数
|
|
//上传总次数
|
|
Integer shangchuanTotal = 0;
|
|
Integer shangchuanTotal = 0;
|
|
|
|
|
|
String shangchuanTotalSql = "select COUNT(1) as 'total' from base_doctor_daily_report_upload d where 1=1 ";
|
|
|
|
|
|
String shangchuanTotalSql = "select COUNT(1) as 'total' from base_doctor_daily_report_upload d INNER JOIN base_doctor doc on d.doctor_id = doc.id and doc.del=1 where 1=1 ";
|
|
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
shangchuanTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
shangchuanTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
@ -1617,7 +1798,7 @@ public class DailyReportUploadService {
|
|
|
|
|
|
|
|
|
|
//已核实、未核实
|
|
//已核实、未核实
|
|
String verifiedTotalSql = "select COUNT(1) as 'total' from base_doctor_daily_report_upload d where state=1 ";
|
|
|
|
|
|
String verifiedTotalSql = "select COUNT(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 where d.state=1 ";
|
|
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
verifiedTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
verifiedTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
@ -1634,7 +1815,7 @@ public class DailyReportUploadService {
|
|
}
|
|
}
|
|
|
|
|
|
//未核实
|
|
//未核实
|
|
String notVerifiedTotalSql = "select COUNT(1) as 'total' from base_doctor_daily_report_upload d where state=0 ";
|
|
|
|
|
|
String notVerifiedTotalSql = "select COUNT(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 where d.state=0 ";
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
notVerifiedTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
notVerifiedTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
}
|
|
}
|
|
@ -1649,46 +1830,58 @@ public class DailyReportUploadService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//不饱和存疑
|
|
|
|
String baoheTotalSql = "select COUNT(de.id) as 'total' from base_doctor_daily_report_upload d 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)) {
|
|
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){
|
|
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 ) ";
|
|
|
|
}
|
|
|
|
Map<String, Object> baoheMap = jdbcTemplate.queryForMap(baoheTotalSql);
|
|
|
|
if (baoheMap != null) {
|
|
|
|
if (baoheMap.get("total") != null) {
|
|
|
|
baoheDoubt = Integer.parseInt(baoheMap.get("total").toString());
|
|
|
|
|
|
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 ) ";
|
|
|
|
}
|
|
|
|
doubtTypeSql += " group by de.doubt_type ";
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
|
|
|
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","其他");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//效率存疑
|
|
|
|
String xiaolvTotalSql = "select COUNT(de.id) as 'total' from base_doctor_daily_report_upload d 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 + "' ";
|
|
|
|
}
|
|
|
|
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 ) ";
|
|
|
|
}
|
|
|
|
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("total", total);//总人次
|
|
object.put("yishangbaoTotal", yishangbaoTotal);//已上报
|
|
object.put("yishangbaoTotal", yishangbaoTotal);//已上报
|
|
object.put("weishangbaoTotal", weishangbaoTotal);//未上报
|
|
object.put("weishangbaoTotal", weishangbaoTotal);//未上报
|
|
object.put("verifiedTotal", verifiedTotal);//已核实
|
|
object.put("verifiedTotal", verifiedTotal);//已核实
|
|
object.put("notVerifiedTotal", notVerifiedTotal);//未核实
|
|
object.put("notVerifiedTotal", notVerifiedTotal);//未核实
|
|
object.put("shangchuanTotal", shangchuanTotal);//上传总次数
|
|
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;
|
|
return object;
|
|
}
|
|
}
|
|
|
|
|
|
@ -1709,7 +1902,7 @@ public class DailyReportUploadService {
|
|
|
|
|
|
String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 and d.identity=0 ";
|
|
String doctorSql = " select COUNT(1) as \"total\" from base_doctor d where d.del=1 and d.identity=0 ";
|
|
Integer total = 0;//总人次
|
|
Integer total = 0;//总人次
|
|
String sql = "select COUNT(DISTINCT d.id) as \"total\" from base_doctor_daily_report_upload d inner join base_daily_report_detail de " +
|
|
|
|
|
|
String sql = "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 1=1 ";
|
|
" on d.id = de.report_id where 1=1 ";
|
|
String deptCondition = "";
|
|
String deptCondition = "";
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
if (StringUtils.isNoneBlank(dept)) {
|
|
@ -1729,14 +1922,6 @@ public class DailyReportUploadService {
|
|
doctorSql += " and d.name like '%" + name + "%' ";
|
|
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);
|
|
Integer doctorTotal = jdbcTemplate.queryForObject(doctorSql,Integer.class);
|
|
|
|
|
|
total = doctorTotal * (Integer.parseInt(day));
|
|
total = doctorTotal * (Integer.parseInt(day));
|
|
@ -1746,8 +1931,6 @@ public class DailyReportUploadService {
|
|
Integer notVerified=0;//未核实
|
|
Integer notVerified=0;//未核实
|
|
Integer verified=0;//已核实
|
|
Integer verified=0;//已核实
|
|
Integer shangchuanTotal=0;//上传总次数
|
|
Integer shangchuanTotal=0;//上传总次数
|
|
Integer baoheDoubt=0;//饱和度存疑次数
|
|
|
|
Integer xiaolvDoubt=0;//效益存疑数量
|
|
|
|
|
|
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
sql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
sql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
@ -1770,7 +1953,7 @@ public class DailyReportUploadService {
|
|
weishangbaoTotal = total - yishangbaoTotal>0?total - yishangbaoTotal:0;
|
|
weishangbaoTotal = total - yishangbaoTotal>0?total - yishangbaoTotal:0;
|
|
|
|
|
|
|
|
|
|
String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_daily_report_upload d where 1=1 ";
|
|
|
|
|
|
String shangchuanTotalSql = "select COUNT(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 where 1=1 ";
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
shangchuanTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
shangchuanTotalSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
}
|
|
}
|
|
@ -1785,47 +1968,82 @@ public class DailyReportUploadService {
|
|
}
|
|
}
|
|
|
|
|
|
//未核实数量
|
|
//未核实数量
|
|
String notVerifiedSql = "select COUNT(DISTINCT d.id) as 'total' from base_doctor_daily_report_upload d 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_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 ";
|
|
" 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_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_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)) {
|
|
if (StringUtils.isNoneBlank(startDate)) {
|
|
notVerifiedSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
notVerifiedSql += " and d.report_date >='" + startDate + "' and d.report_date<='" + endDate + "' ";
|
|
verifiedSql += " 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)) {
|
|
if (StringUtils.isNoneBlank(deptCondition)) {
|
|
notVerifiedSql += " and d.doctor_id IN " + deptCondition;
|
|
notVerifiedSql += " and d.doctor_id IN " + deptCondition;
|
|
verifiedSql += " 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)) {
|
|
if (StringUtils.isNoneBlank(idTypeCondition)) {
|
|
notVerifiedSql += " and d.doctor_id IN " + idTypeCondition;
|
|
notVerifiedSql += " and d.doctor_id IN " + idTypeCondition;
|
|
verifiedSql += " 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)) {
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
notVerifiedSql += " and d.doctor_name like '%" + name + "%'";
|
|
notVerifiedSql += " and d.doctor_name like '%" + name + "%'";
|
|
verifiedSql += " 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);
|
|
notVerified = jdbcTemplate.queryForObject(notVerifiedSql,Integer.class);
|
|
verified = jdbcTemplate.queryForObject(verifiedSql,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);
|
|
shangchuanTotal = jdbcTemplate.queryForObject(shangchuanTotalSql,Integer.class);
|
|
@ -1836,9 +2054,8 @@ public class DailyReportUploadService {
|
|
object.put("notVerified", notVerified);//未核实数量
|
|
object.put("notVerified", notVerified);//未核实数量
|
|
object.put("verified", verified);//已核实数量
|
|
object.put("verified", verified);//已核实数量
|
|
object.put("shangchuanTotal", shangchuanTotal);//上传总次数
|
|
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;
|
|
return object;
|
|
}
|
|
}
|
|
|
|
|
|
@ -2088,7 +2305,8 @@ public class DailyReportUploadService {
|
|
if (null==reportItemDO){
|
|
if (null==reportItemDO){
|
|
throw new Exception("日报项目不存在");
|
|
throw new Exception("日报项目不存在");
|
|
}
|
|
}
|
|
String sql = " select m.*,IFNULL(A.completion_hour,0) completion_hour,dh.dept_code,dh.dept_name from base_daily_report_item_members m " +
|
|
|
|
|
|
String sql = " select m.*,IFNULL(A.completion_hour,0) completion_hour,dh.dept_code,dh.dept_name from base_daily_report_item_members m " +
|
|
|
|
" INNER JOIN base_doctor doc on m.user_id = doc.id and doc.del=1 " +
|
|
"LEFT JOIN ( " +
|
|
"LEFT JOIN ( " +
|
|
"select up.doctor_id,SUM(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0))) completion_hour " +
|
|
"select up.doctor_id,SUM(IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0))) completion_hour " +
|
|
" from base_doctor_daily_report_upload up " +
|
|
" from base_doctor_daily_report_upload up " +
|
|
@ -2103,7 +2321,7 @@ public class DailyReportUploadService {
|
|
/**
|
|
/**
|
|
* 管理员获取所有日报项目
|
|
* 管理员获取所有日报项目
|
|
*/
|
|
*/
|
|
public List<BaseDailyReportItemDO> findReportItemListAdmin(String user,String title,String content,Integer state,String begin_time,String end_time,String createUser,String createUserName) throws Exception {
|
|
|
|
|
|
public List<BaseDailyReportItemDO> findReportItemListAdmin(String user,String projectCode,String title,String content,Integer state,String begin_time,String end_time,String createUser,String createUserName) throws Exception {
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
if (userRoles.size()==0){
|
|
if (userRoles.size()==0){
|
|
@ -2111,6 +2329,9 @@ public class DailyReportUploadService {
|
|
}
|
|
}
|
|
List<BaseDailyReportItemDO> itemDOS = new ArrayList<>();
|
|
List<BaseDailyReportItemDO> itemDOS = new ArrayList<>();
|
|
sql = " select i.* from base_daily_report_item i where 1=1 and i.del=1 ";
|
|
sql = " select i.* from base_daily_report_item i where 1=1 and i.del=1 ";
|
|
|
|
if(StringUtils.isNotBlank(projectCode)){
|
|
|
|
sql += " and i.project_code='"+projectCode+"' ";
|
|
|
|
}
|
|
if (StringUtils.isNotBlank(title)){
|
|
if (StringUtils.isNotBlank(title)){
|
|
sql +=" and i.title like '%"+title+"%' ";
|
|
sql +=" and i.title like '%"+title+"%' ";
|
|
}
|
|
}
|
|
@ -2145,6 +2366,7 @@ public class DailyReportUploadService {
|
|
*/
|
|
*/
|
|
public List<BaseDailyReportItemDO> findReportItemList(String user,String projectCode,String title,String content,Integer state,String begin_time,String end_time,String createUser,String createUserName) throws Exception {
|
|
public List<BaseDailyReportItemDO> findReportItemList(String user,String projectCode,String title,String content,Integer state,String begin_time,String end_time,String createUser,String createUserName) throws Exception {
|
|
String sql = "select i.* from base_daily_report_item i INNER JOIN base_daily_report_item_members mem on i.id = mem.report_item_id " +
|
|
String sql = "select i.* from base_daily_report_item i INNER JOIN base_daily_report_item_members mem on i.id = mem.report_item_id " +
|
|
|
|
"INNER JOIN base_doctor doc on mem.user_id = doc.id and doc.del=1 " +
|
|
"where i.del=1 and mem.del=1 and mem.user_id='"+user+"' " ;
|
|
"where i.del=1 and mem.del=1 and mem.user_id='"+user+"' " ;
|
|
|
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
@ -2183,12 +2405,32 @@ public class DailyReportUploadService {
|
|
/**
|
|
/**
|
|
* 管理员日报项目统计一级
|
|
* 管理员日报项目统计一级
|
|
*/
|
|
*/
|
|
public List<Map<String,Object>> statisticReportProjectList(String user, String projectCode,String startDate, String endDate,String dept,String member) throws Exception {
|
|
|
|
|
|
public List<JSONObject> statisticReportProjectList(String user, String projectCode,String startDate, String endDate,String dept,String member) throws Exception {
|
|
|
|
//判断导出人权限
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
if (userRoles.size()==0){
|
|
if (userRoles.size()==0){
|
|
throw new Exception("您无权限操作");
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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 = " ";
|
|
String sqlCondition = " ";
|
|
|
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
@ -2201,34 +2443,95 @@ public class DailyReportUploadService {
|
|
sqlCondition += " and i.project_code='"+projectCode+"' ";
|
|
sqlCondition += " and i.project_code='"+projectCode+"' ";
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(dept)){//查询指定部门
|
|
if (StringUtils.isNotBlank(dept)){//查询指定部门
|
|
sqlCondition += " and i.dept='"+dept+"' ";
|
|
|
|
|
|
sqlCondition += " and dh.dept_code='"+dept+"' ";
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(member)){//查询指定员工
|
|
if (StringUtils.isNotBlank(member)){//查询指定员工
|
|
sqlCondition += " and up.doctor_id='"+member+"' ";
|
|
sqlCondition += " and up.doctor_id='"+member+"' ";
|
|
}
|
|
}
|
|
String sqlList = " select dict.dict_code project_code,dict.dict_value projectName,IFNULL( A.completionHour,0) 'completionHour', " +
|
|
String sqlList = " select dict.dict_code project_code,dict.dict_value projectName,IFNULL( A.completionHour,0) 'completionHour', " +
|
|
" IFNULL(A.doctorTotal,0) 'doctorTotal' from wlyy_hospital_sys_dict dict " +
|
|
|
|
|
|
" 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 (" +
|
|
" Left JOIN (" +
|
|
" select i.project_code,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour, " +
|
|
" 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 from base_daily_report_item i LEFT JOIN base_daily_report_detail de on i.id = de.report_item_id " +
|
|
" 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 where i.del=1 "+sqlCondition+" GROUP BY i.project_code )A " +
|
|
|
|
"on A.project_code = dict.dict_code where dict.dict_name='daily_report_project' ";
|
|
|
|
|
|
" 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)){
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
sqlList +=" and dict.dict_code='"+projectCode+"' ";
|
|
sqlList +=" and dict.dict_code='"+projectCode+"' ";
|
|
}
|
|
}
|
|
sqlList += " order by sort, completionHour desc ";
|
|
|
|
return jdbcTemplate.queryForList(sqlList);
|
|
|
|
|
|
sqlList += " order by B.sort asc, c.sort asc,completionHour desc ";
|
|
|
|
List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sqlList);
|
|
|
|
List<JSONObject> result = new ArrayList<>();
|
|
|
|
if (sqlResult.size()>0){
|
|
|
|
Map<String,List<Map<String,Object>>> sqlResultMap = sqlResult.stream().collect(Collectors.groupingBy(e -> e.get("categoryCode").toString()));
|
|
|
|
for (String key: sqlResultMap.keySet()){
|
|
|
|
JSONObject categoryTmp = new JSONObject();
|
|
|
|
sql = " select dict_code,dict_value,sort from wlyy_hospital_sys_dict where dict_name='daily_report_category' and dict_code='"+key+"' ";
|
|
|
|
Map<String,Object> dictValue = jdbcTemplate.queryForMap(sql);
|
|
|
|
categoryTmp.put("categoryName",dictValue.get("dict_value"));
|
|
|
|
categoryTmp.put("categoryCode",key);
|
|
|
|
categoryTmp.put("sort",dictValue.get("sort"));
|
|
|
|
JSONArray categoryList = new JSONArray();
|
|
|
|
List<Map<String,Object>> listTmp = sqlResultMap.get(key);
|
|
|
|
if (listTmp.size()>0){
|
|
|
|
Map<String,List<Map<String,Object>>> sqlResultMap2 = listTmp.stream().collect(Collectors.groupingBy(e -> e.get("levelCode").toString()));
|
|
|
|
for (String key2: sqlResultMap2.keySet()){
|
|
|
|
JSONObject levelTmp = new JSONObject();
|
|
|
|
sql = " select dict_code,dict_value,sort from wlyy_hospital_sys_dict where dict_name='daily_report_level' and dict_code='"+key2+"' ";
|
|
|
|
dictValue = jdbcTemplate.queryForMap(sql);
|
|
|
|
levelTmp.put("levelName",dictValue.get("dict_value"));
|
|
|
|
levelTmp.put("levelCode",key2);
|
|
|
|
levelTmp.put("sort",dictValue.get("sort"));
|
|
|
|
List<Map<String,Object>> listTmp2 = sqlResultMap2.get(key2);
|
|
|
|
levelTmp.put("value",listTmp2);
|
|
|
|
categoryList.add(levelTmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
categoryTmp.put("value",categoryList);
|
|
|
|
if (categoryList.size()>0){
|
|
|
|
categoryList.sort(Comparator.comparing(e->((JSONObject)e).getString("sort")));
|
|
|
|
}
|
|
|
|
result.add(categoryTmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (result.size()>0){
|
|
|
|
result.sort(Comparator.comparing(e->e.getString("sort")));
|
|
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 管理员日报项目统计二级
|
|
* 管理员日报项目统计二级
|
|
*/
|
|
*/
|
|
public List<Map<String,Object>> statisticReportProjectDeptList(String user, String projectCode,String startDate, String endDate,String dept,String member) throws Exception {
|
|
public List<Map<String,Object>> statisticReportProjectDeptList(String user, String projectCode,String startDate, String endDate,String dept,String member) throws Exception {
|
|
|
|
//判断导出人权限
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
if (userRoles.size()==0){
|
|
if (userRoles.size()==0){
|
|
throw new Exception("您无权限操作");
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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 = " ";
|
|
String sqlCondition = " ";
|
|
|
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
@ -2241,14 +2544,15 @@ public class DailyReportUploadService {
|
|
sqlCondition += " and i.project_code='"+projectCode+"' ";
|
|
sqlCondition += " and i.project_code='"+projectCode+"' ";
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(dept)){//查询指定部门
|
|
if (StringUtils.isNotBlank(dept)){//查询指定部门
|
|
sqlCondition += " and i.dept='"+dept+"' ";
|
|
|
|
|
|
sqlCondition += " and dh.dept_code='"+dept+"' ";
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(member)){//查询指定员工
|
|
if (StringUtils.isNotBlank(member)){//查询指定员工
|
|
sqlCondition += " and up.doctor_id='"+member+"' ";
|
|
sqlCondition += " and up.doctor_id='"+member+"' ";
|
|
}
|
|
}
|
|
String sqlList = " select i.dept,i.dept_name deptName,i.project_code,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour, " +
|
|
String sqlList = " select i.dept,i.dept_name deptName,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 from base_daily_report_item i LEFT JOIN base_daily_report_detail de on i.id = de.report_item_id " +
|
|
" 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 where i.del=1 "+sqlCondition+" GROUP BY i.project_code,i.dept ";
|
|
|
|
|
|
" 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,i.dept ";
|
|
|
|
|
|
sqlList += " order by completionHour desc ";
|
|
sqlList += " order by completionHour desc ";
|
|
return jdbcTemplate.queryForList(sqlList);
|
|
return jdbcTemplate.queryForList(sqlList);
|
|
@ -2261,13 +2565,34 @@ public class DailyReportUploadService {
|
|
String startDate, String endDate, String createUser,String createUserName, Integer page, Integer size,
|
|
String startDate, String endDate, String createUser,String createUserName, Integer page, Integer size,
|
|
String dept,String member) throws Exception {
|
|
String dept,String member) throws Exception {
|
|
page = page>0?page-1:0;
|
|
page = page>0?page-1:0;
|
|
|
|
|
|
|
|
//判断导出人权限
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
if (userRoles.size()==0){
|
|
if (userRoles.size()==0){
|
|
throw new Exception("您无权限操作");
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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("您无权限操作");
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
List<Map<String,Object>> itemDOS = new ArrayList<>();
|
|
List<Map<String,Object>> itemDOS = new ArrayList<>();
|
|
String sqlCondition = " ";
|
|
|
|
|
|
|
|
String updateTimeSql="";
|
|
String updateTimeSql="";
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
updateTimeSql += " and up.report_date>='"+startDate+"' ";
|
|
updateTimeSql += " and up.report_date>='"+startDate+"' ";
|
|
@ -2278,16 +2603,23 @@ public class DailyReportUploadService {
|
|
if (StringUtils.isNotBlank(member)){
|
|
if (StringUtils.isNotBlank(member)){
|
|
updateTimeSql += " and up.doctor_id='"+member+"' ";
|
|
updateTimeSql += " and up.doctor_id='"+member+"' ";
|
|
}
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(dept)){//查询指定部门
|
|
|
|
updateTimeSql += " and dh.dept_code='"+dept+"' ";
|
|
|
|
}
|
|
|
|
|
|
String sqlList = " select i.id,CONCAT(i.title,'(',i.dept_name,')') title,i.content,i.state,i.begin_time beginTime,i.end_time endTime, " +
|
|
String sqlList = " 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,IFNULL(A.completionHour,'0') completionHour ,IFNULL(A.doctorTotal,0) doctorTotal " +
|
|
|
|
" from base_daily_report_item i LEFT JOIN( " +
|
|
|
|
|
|
" i.create_user_name createUserName,IFNULL(A.completionHour,'0') completionHour ,IFNULL(A.doctorTotal,0) doctorTotal ";
|
|
|
|
|
|
|
|
String sqlCount = " select count(distinct i.id) ";
|
|
|
|
|
|
|
|
String sqlCondition = " from base_daily_report_item i LEFT JOIN( " +
|
|
" select de.report_item_id,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour, " +
|
|
" select de.report_item_id,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour, " +
|
|
" count(distinct up.doctor_id) as doctorTotal " +
|
|
" count(distinct up.doctor_id) as doctorTotal " +
|
|
" from base_daily_report_detail de Inner JOIN base_doctor_daily_report_upload up on up.id = de.report_id " +updateTimeSql+
|
|
|
|
|
|
" from base_daily_report_detail de 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 " +updateTimeSql+
|
|
" group by de.report_item_id " +
|
|
" group by de.report_item_id " +
|
|
" )A on i.id = A.report_item_id where i.del=1 ";
|
|
" )A on i.id = A.report_item_id where i.del=1 ";
|
|
String sqlCount = " select count(distinct i.id) from base_daily_report_item i where i.del=1 ";
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(title)){
|
|
if (StringUtils.isNotBlank(title)){
|
|
sqlCondition +=" and i.title like '%"+title+"%' ";
|
|
sqlCondition +=" and i.title like '%"+title+"%' ";
|
|
}
|
|
}
|
|
@ -2306,13 +2638,11 @@ public class DailyReportUploadService {
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
sqlCondition += " and i.project_code='"+projectCode+"' ";
|
|
sqlCondition += " and i.project_code='"+projectCode+"' ";
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(dept)){//查询指定部门
|
|
|
|
sqlCondition += " and i.dept='"+dept+"' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(member)){
|
|
if (StringUtils.isNotBlank(member)){
|
|
sqlCondition += " and exists (select 1 from base_daily_report_item_members mem where i.id =mem.report_item_id and mem.user_id='"+member+"' and mem.del=1 )";
|
|
|
|
|
|
sqlCondition += " and exists (select 1 from base_daily_report_item_members mem " +
|
|
|
|
" INNER JOIN base_doctor doc on mem.user_id = doc.id and doc.del=1 " +
|
|
|
|
" where i.id =mem.report_item_id and mem.user_id='"+member+"' and mem.del=1 )";
|
|
}
|
|
}
|
|
|
|
|
|
sqlList +=sqlCondition+ " group by i.id order by i.create_time,i.id desc limit "+page*size+","+size;
|
|
sqlList +=sqlCondition+ " group by i.id order by i.create_time,i.id desc limit "+page*size+","+size;
|
|
itemDOS = jdbcTemplate.queryForList(sqlList);
|
|
itemDOS = jdbcTemplate.queryForList(sqlList);
|
|
Long count = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class);
|
|
Long count = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class);
|
|
@ -2321,11 +2651,32 @@ public class DailyReportUploadService {
|
|
|
|
|
|
public List<Map<String,Object>> statisticReportItemById(String user,String item_id,Integer type,String startDate,String endDate,
|
|
public List<Map<String,Object>> statisticReportItemById(String user,String item_id,Integer type,String startDate,String endDate,
|
|
String dept,String member) throws Exception {
|
|
String dept,String member) throws Exception {
|
|
|
|
|
|
|
|
//判断导出人权限
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
if (userRoles.size()==0){
|
|
if (userRoles.size()==0){
|
|
throw new Exception("您无权限操作");
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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 updateTimeSql = " ";
|
|
String updateTimeSql = " ";
|
|
String itemSql = " ";
|
|
String itemSql = " ";
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
@ -2338,27 +2689,30 @@ public class DailyReportUploadService {
|
|
updateTimeSql += " and up.doctor_id='"+member+"' ";
|
|
updateTimeSql += " and up.doctor_id='"+member+"' ";
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(dept)){
|
|
if (StringUtils.isNotBlank(dept)){
|
|
itemSql += " and i.dept='"+dept+"' ";
|
|
|
|
|
|
itemSql += " and dh.dept_code='"+dept+"' ";
|
|
}
|
|
}
|
|
if(1==type){//天
|
|
if(1==type){//天
|
|
sql = " 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, " +
|
|
sql = " 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, " +
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time', " +
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time', " +
|
|
" count(distinct up.doctor_id) as doctorTotal from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
" 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 " +updateTimeSql+
|
|
|
|
|
|
"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 " +updateTimeSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +itemSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +itemSql+
|
|
"group by i.id,DATE_FORMAT(de.create_time,'%Y-%m-%d') order by time asc ";
|
|
"group by i.id,DATE_FORMAT(de.create_time,'%Y-%m-%d') order by time asc ";
|
|
}else if (2==type){//按周
|
|
}else if (2==type){//按周
|
|
sql = " 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, " +
|
|
sql = " 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, " +
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time', " +
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time', " +
|
|
" count(distinct up.doctor_id) as doctorTotal from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
" 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 " +updateTimeSql+
|
|
|
|
|
|
"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 " +updateTimeSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +itemSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +itemSql+
|
|
"group by i.id,DATE_FORMAT(de.create_time,'%Y%v') order by time asc ";
|
|
"group by i.id,DATE_FORMAT(de.create_time,'%Y%v') order by time asc ";
|
|
}else if (3==type){//月
|
|
}else if (3==type){//月
|
|
sql = " 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, " +
|
|
sql = " 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, " +
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m') as 'time', " +
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m') as 'time', " +
|
|
" count(distinct up.doctor_id) as doctorTotal from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
" 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 " +updateTimeSql+
|
|
|
|
|
|
"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 " +updateTimeSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +itemSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +itemSql+
|
|
"group by i.id,DATE_FORMAT(de.create_time,'%Y-%m') order by time asc ";
|
|
"group by i.id,DATE_FORMAT(de.create_time,'%Y-%m') order by time asc ";
|
|
}else {
|
|
}else {
|
|
@ -2420,11 +2774,14 @@ public class DailyReportUploadService {
|
|
}
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> statisticReportItemMembersById(String user,String item_id,Integer type,String member,String startDate,String endDate ) throws Exception {
|
|
public List<Map<String,Object>> statisticReportItemMembersById(String user,String item_id,Integer type,String member,String startDate,String endDate ) throws Exception {
|
|
|
|
|
|
|
|
//判断导出人权限
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
if (userRoles.size()==0){
|
|
if (userRoles.size()==0){
|
|
throw new Exception("您无权限操作");
|
|
throw new Exception("您无权限操作");
|
|
}
|
|
}
|
|
|
|
|
|
String memberSql = " ";
|
|
String memberSql = " ";
|
|
if (StringUtils.isNotBlank(member)){
|
|
if (StringUtils.isNotBlank(member)){
|
|
memberSql = " and up.doctor_id='"+member+"' ";
|
|
memberSql = " and up.doctor_id='"+member+"' ";
|
|
@ -2444,7 +2801,7 @@ public class DailyReportUploadService {
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time'," +
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time'," +
|
|
" DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'searchTime' " +
|
|
" DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'searchTime' " +
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
"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 de.report_id = up.id " +updateTimeSql+
|
|
|
|
|
|
"on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +updateTimeSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +memberSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +memberSql+
|
|
"group by i.id,up.doctor_id order by completionHour desc ";
|
|
"group by i.id,up.doctor_id order by completionHour desc ";
|
|
searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y-%m-%d') ";
|
|
searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y-%m-%d') ";
|
|
@ -2455,7 +2812,7 @@ public class DailyReportUploadService {
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time', " +
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time', " +
|
|
"DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'searchTime' " +
|
|
"DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'searchTime' " +
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
"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 de.report_id = up.id " +updateTimeSql+
|
|
|
|
|
|
"on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +updateTimeSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +
|
|
"where 1=1 and i.id='"+item_id+"' " +
|
|
"group by i.id,up.doctor_id order by time asc ";
|
|
"group by i.id,up.doctor_id order by time asc ";
|
|
searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y-%m-%d') ";
|
|
searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y-%m-%d') ";
|
|
@ -2465,7 +2822,7 @@ public class DailyReportUploadService {
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time', " +
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m-%d') as 'time', " +
|
|
"DATE_FORMAT(de.create_time,'%Y%v') as 'searchTime' " +
|
|
"DATE_FORMAT(de.create_time,'%Y%v') as 'searchTime' " +
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
"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 de.report_id = up.id " +updateTimeSql+
|
|
|
|
|
|
"on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +updateTimeSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +memberSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +memberSql+
|
|
"group by i.id,up.doctor_id order by time asc ";
|
|
"group by i.id,up.doctor_id order by time asc ";
|
|
searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y%v') ";
|
|
searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y%v') ";
|
|
@ -2475,7 +2832,7 @@ public class DailyReportUploadService {
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m') as 'time', " +
|
|
" CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour,DATE_FORMAT(de.create_time,'%Y-%m') as 'time', " +
|
|
"DATE_FORMAT(de.create_time,'%Y-%m') as 'searchTime' " +
|
|
"DATE_FORMAT(de.create_time,'%Y-%m') as 'searchTime' " +
|
|
"from base_daily_report_item i LEFT JOIN base_daily_report_detail de " +
|
|
"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 de.report_id = up.id " +updateTimeSql+
|
|
|
|
|
|
"on i.id = de.report_item_id INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +updateTimeSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +memberSql+
|
|
"where 1=1 and i.id='"+item_id+"' " +memberSql+
|
|
"group by i.id,up.doctor_id order by time asc ";
|
|
"group by i.id,up.doctor_id order by time asc ";
|
|
searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y-%m') ";
|
|
searchTimeFormat=" DATE_FORMAT(de.create_time,'%Y-%m') ";
|
|
@ -2517,7 +2874,7 @@ public class DailyReportUploadService {
|
|
tmp.put("timeRange",getRangeDouble(completionHour,totalHour));
|
|
tmp.put("timeRange",getRangeDouble(completionHour,totalHour));
|
|
String doctorId = tmp.get("doctor_id").toString();
|
|
String doctorId = tmp.get("doctor_id").toString();
|
|
sql = " select up.doctor_name,"+uploadTimeFormat+" as report_date ,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour " +
|
|
sql = " select up.doctor_name,"+uploadTimeFormat+" as report_date ,CAST((sum(IFNULL(de.actual_completion_hour,IFNULL(de.completion_hour,'0')))) as char ) as completionHour " +
|
|
" from base_daily_report_detail de INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id " +updateTimeSql+
|
|
|
|
|
|
" from base_daily_report_detail de INNER JOIN base_doctor_daily_report_upload up on de.report_id = up.id INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +updateTimeSql+
|
|
"where de.report_item_id='"+item_id+"' and up.doctor_id='"+doctorId+"' " +
|
|
"where de.report_item_id='"+item_id+"' and up.doctor_id='"+doctorId+"' " +
|
|
"GROUP BY "+searchTimeFormat+" ORDER BY report_date asc ";
|
|
"GROUP BY "+searchTimeFormat+" ORDER BY report_date asc ";
|
|
List<Map<String,Object>> timeUseList = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> timeUseList = jdbcTemplate.queryForList(sql);
|
|
@ -2554,11 +2911,32 @@ public class DailyReportUploadService {
|
|
* 获取某个部门的项目趋势图一级
|
|
* 获取某个部门的项目趋势图一级
|
|
*/
|
|
*/
|
|
public List<Map<String,Object>> statisticDeptProjectTrend(String user,String dept,String startDate,String endDate,Integer type) throws Exception {
|
|
public List<Map<String,Object>> statisticDeptProjectTrend(String user,String dept,String startDate,String endDate,Integer type) throws Exception {
|
|
|
|
|
|
|
|
//判断导出人权限
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
if (userRoles.size()==0){
|
|
if (userRoles.size()==0){
|
|
throw new Exception("您无权限操作");
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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 = " ";
|
|
String sqlCondition = " ";
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
sqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
sqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
@ -2566,6 +2944,9 @@ public class DailyReportUploadService {
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
sqlCondition += " and up.report_date<='"+endDate+"' ";
|
|
sqlCondition += " and up.report_date<='"+endDate+"' ";
|
|
}
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(dept)){
|
|
|
|
sqlCondition += " and dh.dept_code='"+dept+"' ";
|
|
|
|
}
|
|
String groupTimeFormat = "";
|
|
String groupTimeFormat = "";
|
|
String uploadTimeFormat = "";
|
|
String uploadTimeFormat = "";
|
|
if(0==type){//全部
|
|
if(0==type){//全部
|
|
@ -2586,13 +2967,25 @@ public class DailyReportUploadService {
|
|
}
|
|
}
|
|
String projectSql = " select dict.dict_code project_code,dict.dict_value projectName " +
|
|
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 " +
|
|
" 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 ";
|
|
|
|
projectSql += " union "+
|
|
|
|
" select i.project_code,i.project_name projectName" +
|
|
|
|
" 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 \n" +
|
|
|
|
" INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 where i.del=1 " +sqlCondition+
|
|
|
|
" GROUP BY i.id ";
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> deptProjectList = jdbcTemplate.queryForList(projectSql);
|
|
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, " +
|
|
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' " +
|
|
" 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 " +
|
|
" 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 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 " +
|
|
|
|
" INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 where i.del=1 and i.project_code='{project_code}' "+sqlCondition+
|
|
" GROUP BY "+groupTimeFormat+" order by time asc";
|
|
" GROUP BY "+groupTimeFormat+" order by time asc";
|
|
for (Map<String,Object>tmp:deptProjectList){
|
|
for (Map<String,Object>tmp:deptProjectList){
|
|
String project_code = tmp.get("project_code").toString();
|
|
String project_code = tmp.get("project_code").toString();
|
|
@ -2610,9 +3003,15 @@ public class DailyReportUploadService {
|
|
useTimeTmp.put("time",sunday);
|
|
useTimeTmp.put("time",sunday);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}else {
|
|
|
|
tmp.put("avgValue",0.0);
|
|
|
|
tmp.put("totalHour",0.0);
|
|
}
|
|
}
|
|
tmp.put("useTimeList",useTimeList);
|
|
tmp.put("useTimeList",useTimeList);
|
|
}
|
|
}
|
|
|
|
if (deptProjectList.size()>0){
|
|
|
|
deptProjectList.sort(Comparator.comparing(obj -> ((Map<String,Object>) obj).get("totalHour").toString()).reversed());
|
|
|
|
}
|
|
return deptProjectList;
|
|
return deptProjectList;
|
|
}
|
|
}
|
|
|
|
|
|
@ -2620,11 +3019,32 @@ public class DailyReportUploadService {
|
|
* 获取某个部门的某个项目详情趋势图二级
|
|
* 获取某个部门的某个项目详情趋势图二级
|
|
*/
|
|
*/
|
|
public List<Map<String,Object>> statisticDeptProjectItemTrend(String user,String dept,String projectCode,String startDate,String endDate,Integer type) throws Exception {
|
|
public List<Map<String,Object>> statisticDeptProjectItemTrend(String user,String dept,String projectCode,String startDate,String endDate,Integer type) throws Exception {
|
|
|
|
|
|
|
|
//判断导出人权限
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
if (userRoles.size()==0){
|
|
if (userRoles.size()==0){
|
|
throw new Exception("您无权限操作");
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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 = " ";
|
|
String sqlCondition = " ";
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
sqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
sqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
@ -2632,6 +3052,9 @@ public class DailyReportUploadService {
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
sqlCondition += " and up.report_date<='"+endDate+"' ";
|
|
sqlCondition += " and up.report_date<='"+endDate+"' ";
|
|
}
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(dept)){
|
|
|
|
sqlCondition+= " and dh.dept_code='"+dept+"' ";
|
|
|
|
}
|
|
String groupTimeFormat = "";
|
|
String groupTimeFormat = "";
|
|
String uploadTimeFormat = "";
|
|
String uploadTimeFormat = "";
|
|
if(0==type){//全部
|
|
if(0==type){//全部
|
|
@ -2652,14 +3075,51 @@ public class DailyReportUploadService {
|
|
}
|
|
}
|
|
String projectSql = " select i.id,CONCAT(i.title,'(',i.dept_name,')') title,i.content,i.state,i.begin_time beginTime, " +
|
|
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 " +
|
|
" 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 ";
|
|
|
|
projectSql += " union "+
|
|
|
|
" 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 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='"+projectCode+"' " +sqlCondition+
|
|
|
|
" GROUP BY i.id ";
|
|
|
|
|
|
List<Map<String,Object>> deptProjectItemList = jdbcTemplate.queryForList(projectSql);
|
|
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, " +
|
|
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' " +
|
|
" 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 " +
|
|
" 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 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 " +
|
|
|
|
" INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 where i.del=1 and i.id='{itemId}' "+sqlCondition+
|
|
" GROUP BY "+groupTimeFormat+" order by time asc";
|
|
" GROUP BY "+groupTimeFormat+" order by time asc";
|
|
|
|
Set<String> resultTimeList = new HashSet<>();
|
|
|
|
if (deptProjectItemList.size()>0){
|
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
|
|
Date startDateTmp = DateUtil.strToDate(startDate);
|
|
|
|
Date endDateTmp = DateUtil.strToDate(endDate);
|
|
|
|
if (type==1){
|
|
|
|
for (;!startDateTmp.after(endDateTmp);){
|
|
|
|
resultTimeList.add(DateUtil.dateToStr(startDateTmp,DateUtil.YYYY_MM_DD));
|
|
|
|
startDateTmp = DateUtil.getNextDay1(startDateTmp,1);
|
|
|
|
}
|
|
|
|
} else if (type==2) {
|
|
|
|
for (;!startDateTmp.after(endDateTmp);){
|
|
|
|
startDateTmp = DateUtil.strToDate(DateUtil.getSundayOfThisWeek(startDateTmp));
|
|
|
|
resultTimeList.add(DateUtil.getSundayOfThisWeek(startDateTmp));
|
|
|
|
startDateTmp = DateUtil.getNextWeek(startDateTmp,1);
|
|
|
|
}
|
|
|
|
}else if (type==3){
|
|
|
|
for (;!startDateTmp.after(endDateTmp);){
|
|
|
|
resultTimeList.add(DateUtil.dateToStr(startDateTmp,DateUtil.YYYY_MM));
|
|
|
|
startDateTmp = DateUtil.getNextMonthReturnDate(startDateTmp,1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
for (Map<String,Object>tmp:deptProjectItemList){
|
|
for (Map<String,Object>tmp:deptProjectItemList){
|
|
String itemId = tmp.get("id").toString();
|
|
String itemId = tmp.get("id").toString();
|
|
List<Map<String,Object>> useTimeList = jdbcTemplate.queryForList(sqlList.replace("{itemId}",itemId));
|
|
List<Map<String,Object>> useTimeList = jdbcTemplate.queryForList(sqlList.replace("{itemId}",itemId));
|
|
@ -2669,16 +3129,42 @@ public class DailyReportUploadService {
|
|
Double avgValue = avg.getAsDouble();
|
|
Double avgValue = avg.getAsDouble();
|
|
tmp.put("avgValue",avgValue);
|
|
tmp.put("avgValue",avgValue);
|
|
tmp.put("totalHour",totalHour);
|
|
tmp.put("totalHour",totalHour);
|
|
if(2==type){//获取周的最后一天
|
|
|
|
for (Map<String,Object>useTimeTmp :useTimeList){
|
|
|
|
|
|
|
|
|
|
Set searchTimeList = new HashSet();
|
|
|
|
for (Map<String,Object>useTimeTmp :useTimeList){
|
|
|
|
if(2==type){
|
|
String time = useTimeTmp.get("time").toString();
|
|
String time = useTimeTmp.get("time").toString();
|
|
String sunday = DateUtil.getSundayOfThisWeek(DateUtil.strToDate(time));
|
|
String sunday = DateUtil.getSundayOfThisWeek(DateUtil.strToDate(time));
|
|
useTimeTmp.put("time",sunday);
|
|
useTimeTmp.put("time",sunday);
|
|
}
|
|
}
|
|
|
|
String time = useTimeTmp.get("time").toString();
|
|
|
|
searchTimeList.add(time);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type!=0){
|
|
|
|
for (String tmpTime:resultTimeList){
|
|
|
|
if (!searchTimeList.contains(tmpTime)){
|
|
|
|
Map<String,Object> mapTmp = new HashMap<>();
|
|
|
|
mapTmp.put("time",tmpTime);
|
|
|
|
mapTmp.put("completionHour",0);
|
|
|
|
mapTmp.put("doctorTotal",0);
|
|
|
|
useTimeList.add(mapTmp);
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
tmp.put("avgValue",0.0);
|
|
|
|
tmp.put("totalHour",0.0);
|
|
|
|
}
|
|
|
|
if(useTimeList.size()>0){
|
|
|
|
useTimeList.sort(Comparator.comparing(e->e.get("time").toString()));
|
|
}
|
|
}
|
|
tmp.put("useTimeList",useTimeList);
|
|
tmp.put("useTimeList",useTimeList);
|
|
}
|
|
}
|
|
|
|
if (deptProjectItemList.size()>0){
|
|
|
|
deptProjectItemList.sort(Comparator.comparing(obj -> ((Map<String,Object>) obj).get("totalHour").toString()).reversed());
|
|
|
|
}
|
|
return deptProjectItemList;
|
|
return deptProjectItemList;
|
|
}
|
|
}
|
|
|
|
|
|
@ -2686,11 +3172,32 @@ public class DailyReportUploadService {
|
|
* 获取员工项目趋势图一级
|
|
* 获取员工项目趋势图一级
|
|
*/
|
|
*/
|
|
public List<Map<String,Object>> statisticDoctorProjectTrend(String user,String dept,String memberId,String startDate,String endDate,Integer type) throws Exception {
|
|
public List<Map<String,Object>> statisticDoctorProjectTrend(String user,String dept,String memberId,String startDate,String endDate,Integer type) throws Exception {
|
|
|
|
//判断导出人权限
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
if (userRoles.size()==0){
|
|
if (userRoles.size()==0){
|
|
throw new Exception("您无权限操作");
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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 = " ";
|
|
String sqlCondition = " ";
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
sqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
sqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
@ -2719,13 +3226,16 @@ public class DailyReportUploadService {
|
|
String projectSql = " select dict.dict_code project_code,dict.dict_value projectName,i.dept " +
|
|
String projectSql = " select dict.dict_code project_code,dict.dict_value projectName,i.dept " +
|
|
" from wlyy_hospital_sys_dict dict INNER JOIN base_daily_report_item i on i.project_code = dict.dict_code " +
|
|
" from wlyy_hospital_sys_dict dict INNER JOIN base_daily_report_item i on i.project_code = dict.dict_code " +
|
|
" INNER JOIN base_daily_report_item_members mem on i.id =mem.report_item_id " +
|
|
" INNER JOIN base_daily_report_item_members mem on i.id =mem.report_item_id " +
|
|
" where dict.dict_name='daily_report_project' and i.dept='"+dept+"' and mem.user_id='"+memberId+"' 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 " +
|
|
|
|
" where dict.dict_name='daily_report_project' and dh.dept_code='"+dept+"' and mem.user_id='"+memberId+"' and mem.del=1 " +
|
|
" GROUP BY dict.dict_code; ";
|
|
" GROUP BY dict.dict_code; ";
|
|
List<Map<String,Object>> deptProjectList = jdbcTemplate.queryForList(projectSql);
|
|
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, " +
|
|
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' " +
|
|
" 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 " +
|
|
" 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 where up.doctor_id='"+memberId+"' and 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 " +
|
|
|
|
" INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 where up.doctor_id='"+memberId+"' and i.del=1 and dh.dept_code='"+dept+"' and i.project_code='{project_code}' "+sqlCondition+
|
|
" GROUP BY "+groupTimeFormat+" order by time asc";
|
|
" GROUP BY "+groupTimeFormat+" order by time asc";
|
|
for (Map<String,Object>tmp:deptProjectList){
|
|
for (Map<String,Object>tmp:deptProjectList){
|
|
String project_code = tmp.get("project_code").toString();
|
|
String project_code = tmp.get("project_code").toString();
|
|
@ -2743,9 +3253,15 @@ public class DailyReportUploadService {
|
|
useTimeTmp.put("time",sunday);
|
|
useTimeTmp.put("time",sunday);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}else {
|
|
|
|
tmp.put("totalHour",0.0);
|
|
|
|
tmp.put("avgValue",0.0);
|
|
}
|
|
}
|
|
tmp.put("useTimeList",useTimeList);
|
|
tmp.put("useTimeList",useTimeList);
|
|
}
|
|
}
|
|
|
|
if(deptProjectList.size()>0){
|
|
|
|
deptProjectList.sort(Comparator.comparing(obj -> ((Map<String,Object>) obj).get("totalHour").toString()).reversed());
|
|
|
|
}
|
|
return deptProjectList;
|
|
return deptProjectList;
|
|
}
|
|
}
|
|
|
|
|
|
@ -2753,11 +3269,31 @@ public class DailyReportUploadService {
|
|
* 获取员工某个项目详情趋势图二级
|
|
* 获取员工某个项目详情趋势图二级
|
|
*/
|
|
*/
|
|
public List<Map<String,Object>> statisticDoctorProjectItemTrend(String user,String dept,String memberId,String projectCode,String startDate,String endDate,Integer type) throws Exception {
|
|
public List<Map<String,Object>> statisticDoctorProjectItemTrend(String user,String dept,String memberId,String projectCode,String startDate,String endDate,Integer type) throws Exception {
|
|
|
|
//判断导出人权限
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
String sql = " select * from base_doctor_role where doctor_code='"+user+"' ";
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> userRoles = jdbcTemplate.queryForList(sql);
|
|
if (userRoles.size()==0){
|
|
if (userRoles.size()==0){
|
|
throw new Exception("您无权限操作");
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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 = " ";
|
|
String sqlCondition = " ";
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
sqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
sqlCondition += " and up.report_date>='"+startDate+"' ";
|
|
@ -2786,13 +3322,18 @@ public class DailyReportUploadService {
|
|
String projectSql = " select i.id,CONCAT(i.title,'(',i.dept_name,')') title,i.content,i.state,i.begin_time beginTime, " +
|
|
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 " +
|
|
" i.end_time endTime, i.create_user_name createUserName " +
|
|
" from base_daily_report_item i INNER JOIN base_daily_report_item_members mem on i.id =mem.report_item_id " +
|
|
" from base_daily_report_item i INNER JOIN base_daily_report_item_members mem on i.id =mem.report_item_id " +
|
|
" where i.project_code='"+projectCode+"' and mem.user_id='"+memberId+"' and mem.del=1 and i.dept='"+dept+"' " +
|
|
|
|
|
|
" 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 " +
|
|
|
|
" where i.project_code='"+projectCode+"' and mem.user_id='"+memberId+"' and mem.del=1 and dh.dept_code='"+dept+"' " +
|
|
" GROUP BY i.id ";
|
|
" GROUP BY i.id ";
|
|
List<Map<String,Object>> deptProjectItemList = jdbcTemplate.queryForList(projectSql);
|
|
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, " +
|
|
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' " +
|
|
" 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 " +
|
|
" 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 where i.del=1 and up.doctor_id='"+memberId+"' 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 " +
|
|
|
|
" INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
|
|
|
|
" where i.del=1 and up.doctor_id='"+memberId+"' and dh.dept_code='"+dept+"' and i.id='{itemId}' "+sqlCondition+
|
|
" GROUP BY "+groupTimeFormat+" order by time asc";
|
|
" GROUP BY "+groupTimeFormat+" order by time asc";
|
|
for (Map<String,Object>tmp:deptProjectItemList){
|
|
for (Map<String,Object>tmp:deptProjectItemList){
|
|
String itemId = tmp.get("id").toString();
|
|
String itemId = tmp.get("id").toString();
|
|
@ -2810,12 +3351,394 @@ public class DailyReportUploadService {
|
|
useTimeTmp.put("time",sunday);
|
|
useTimeTmp.put("time",sunday);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}else {
|
|
|
|
tmp.put("avgValue",0.0);
|
|
|
|
tmp.put("totalHour",0.0);
|
|
}
|
|
}
|
|
tmp.put("useTimeList",useTimeList);
|
|
tmp.put("useTimeList",useTimeList);
|
|
}
|
|
}
|
|
|
|
if (deptProjectItemList.size()>0){
|
|
|
|
deptProjectItemList.sort(Comparator.comparing(obj -> ((Map<String,Object>) obj).get("totalHour").toString()).reversed());
|
|
|
|
}
|
|
return deptProjectItemList;
|
|
return deptProjectItemList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 统计各存疑数量
|
|
|
|
* @param user
|
|
|
|
* @param projectCode
|
|
|
|
* @param item_id
|
|
|
|
* @param dept
|
|
|
|
* @param memberId
|
|
|
|
* @param startDate
|
|
|
|
* @param endDate
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public JSONObject statisticDetailHeaderInfo(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){
|
|
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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();
|
|
|
|
Date startDateTmp = DateUtil.getDateStart();
|
|
|
|
if (StringUtils.isBlank(endDate)){
|
|
|
|
endDate = DateUtil.dateToStrLong(DateUtil.getDateEnd());
|
|
|
|
}
|
|
|
|
//以项目开始时间 or 员工第一次提交时间开始计算。
|
|
|
|
if (StringUtils.isNotBlank(memberId)){
|
|
|
|
sql = " select min(report_date) from base_doctor_daily_report_upload where doctor_id='"+memberId+"' ";
|
|
|
|
List<String> startResult = jdbcTemplate.queryForList(sql,String.class);
|
|
|
|
if (startResult.size()>0){
|
|
|
|
startDateTmp = DateUtil.strToDate(startResult.get(0));
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
sql = " select min(begin_time) from base_daily_report_item where begin_time is not null ";
|
|
|
|
if (StringUtils.isNotBlank(projectCode)){
|
|
|
|
sql += " and project_code='"+projectCode+"' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(item_id)){
|
|
|
|
sql += " and id='"+item_id+"' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(dept)){
|
|
|
|
sql +=" and dept='"+dept+"' ";
|
|
|
|
}
|
|
|
|
List<String> startResult = jdbcTemplate.queryForList(sql,String.class);
|
|
|
|
if (startResult.size()>0){
|
|
|
|
startDateTmp = DateUtil.strToDate(startResult.get(0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
|
|
if(startDateTmp.after(DateUtil.strToDate(startDate))){
|
|
|
|
startDate = DateUtil.dateToStrLong(startDateTmp);
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
startDate = DateUtil.dateToStrLong(startDateTmp);
|
|
|
|
}
|
|
|
|
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 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 " +
|
|
|
|
"inner join base_daily_report_item i on i.id = rd.report_item_id and i.del=1 where 1=1 " +
|
|
|
|
"and DATE_FORMAT(up.report_date,'%w') BETWEEN 1 and 5 "+sqlWhere;
|
|
|
|
//只计算出周一到周五上传的数量去求未上传
|
|
|
|
|
|
|
|
Long shangchuanTotal = jdbcTemplate.queryForObject(shangchuanSql,Long.class);
|
|
|
|
|
|
|
|
|
|
|
|
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<='endDate' ";
|
|
|
|
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(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 " +
|
|
|
|
" inner 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 " +
|
|
|
|
"inner 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 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 " +
|
|
|
|
"inner 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Map<String,Object>> statisticWorkTypeInfo(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){
|
|
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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 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+"' ";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
|
|
sqlWhere +=" and up.report_date>='"+startDate+"' ";
|
|
|
|
}
|
|
|
|
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_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 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){
|
|
|
|
throw new Exception("您无权限操作");
|
|
|
|
}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 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 up.id,'report' as 'itemType',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 ur.code as id,'urge' as 'itemType',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);
|
|
|
|
for (Map<String,Object> tmp:result){
|
|
|
|
tmp.put("doubt_type_name",null==tmp.get("doubt_type")?"":StringUtils.isBlank(tmp.get("doubt_type").toString())?"":doubtTypeObj.getString(tmp.get("doubt_type").toString()));
|
|
|
|
}
|
|
|
|
|
|
|
|
Long count = jdbcTemplate.queryForObject(" select sum(total) from ("+sqlCount+")A ",Long.class);
|
|
|
|
return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 导出项目计划周报月报用时情况
|
|
* 导出项目计划周报月报用时情况
|
|
@ -2848,8 +3771,8 @@ public class DailyReportUploadService {
|
|
startTime = DateUtil.getMondayOfThisWeek(DateUtil.strToDate(date))+" 00:00:00";
|
|
startTime = DateUtil.getMondayOfThisWeek(DateUtil.strToDate(date))+" 00:00:00";
|
|
endTime = DateUtil.getSundayOfThisWeek(DateUtil.strToDate(date))+" 23:59:59";
|
|
endTime = DateUtil.getSundayOfThisWeek(DateUtil.strToDate(date))+" 23:59:59";
|
|
}else if (2==type){//月报
|
|
}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 {
|
|
}else {
|
|
throw new Exception("导出失败,请检查传入参数");
|
|
throw new Exception("导出失败,请检查传入参数");
|
|
}
|
|
}
|
|
@ -2870,8 +3793,8 @@ public class DailyReportUploadService {
|
|
"it.title,it.content,rd.sort,rd.report_content,IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) 'completion_hour', " +
|
|
"it.title,it.content,rd.sort,rd.report_content,IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) 'completion_hour', " +
|
|
"DATE_FORMAT(rd.create_time,'%Y-%m-%d %H:%i:%S') create_time,DATE_FORMAT(rd.verification_time,'%Y-%m-%d %H:%i:%S') verification_time," +
|
|
"DATE_FORMAT(rd.create_time,'%Y-%m-%d %H:%i:%S') create_time,DATE_FORMAT(rd.verification_time,'%Y-%m-%d %H:%i:%S') verification_time," +
|
|
" CASE rd.state WHEN 1 THEN '已核实' ELSE '未核实' END as 'verification_state',rd.verification_user_name,CASE rd.doubt WHEN 1 THEN '存疑' ELSE '无存疑' END as 'doubt', " +
|
|
" CASE rd.state WHEN 1 THEN '已核实' ELSE '未核实' END as 'verification_state',rd.verification_user_name,CASE rd.doubt WHEN 1 THEN '存疑' ELSE '无存疑' END as 'doubt', " +
|
|
" CASE rd.doubt WHEN 1 THEN '不饱和存疑' WHEN 2 THEN '效率存疑' ELSE null END as 'doubtType', rd.remark " +
|
|
|
|
"from base_doctor_daily_report_upload up INNER JOIN base_doctor doc on up.doctor_id = doc.id " +
|
|
|
|
|
|
" rd.doubt_type doubtType, 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 " +
|
|
"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 " +
|
|
"base_daily_report_detail rd on up.id = rd.report_id " +
|
|
"LEFT JOIN base_daily_report_item it on rd.report_item_id = it.id " +
|
|
"LEFT JOIN base_daily_report_item it on rd.report_item_id = it.id " +
|
|
@ -2919,8 +3842,8 @@ public class DailyReportUploadService {
|
|
startTime = DateUtil.getMondayOfThisWeek(DateUtil.strToDate(date))+" 00:00:00";
|
|
startTime = DateUtil.getMondayOfThisWeek(DateUtil.strToDate(date))+" 00:00:00";
|
|
endTime = DateUtil.getSundayOfThisWeek(DateUtil.strToDate(date))+" 23:59:59";
|
|
endTime = DateUtil.getSundayOfThisWeek(DateUtil.strToDate(date))+" 23:59:59";
|
|
}else if (2==type){//月报
|
|
}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 {
|
|
}else {
|
|
throw new Exception("导出失败,请检查传入参数");
|
|
throw new Exception("导出失败,请检查传入参数");
|
|
}
|
|
}
|
|
@ -2929,8 +3852,8 @@ public class DailyReportUploadService {
|
|
"it.title,it.content,rd.sort,rd.report_content,IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) 'completion_hour', " +
|
|
"it.title,it.content,rd.sort,rd.report_content,IFNULL(rd.actual_completion_hour,IFNULL(rd.completion_hour,0)) 'completion_hour', " +
|
|
"DATE_FORMAT(rd.create_time,'%Y-%m-%d %H:%i:%S') create_time,DATE_FORMAT(rd.verification_time,'%Y-%m-%d %H:%i:%S') verification_time," +
|
|
"DATE_FORMAT(rd.create_time,'%Y-%m-%d %H:%i:%S') create_time,DATE_FORMAT(rd.verification_time,'%Y-%m-%d %H:%i:%S') verification_time," +
|
|
" CASE rd.state WHEN 1 THEN '已核实' ELSE '未核实' END as 'verification_state',rd.verification_user_name,CASE rd.doubt WHEN 1 THEN '存疑' ELSE '无存疑' END as 'doubt'," +
|
|
" CASE rd.state WHEN 1 THEN '已核实' ELSE '未核实' END as 'verification_state',rd.verification_user_name,CASE rd.doubt WHEN 1 THEN '存疑' ELSE '无存疑' END as 'doubt'," +
|
|
" CASE rd.doubt WHEN 1 THEN '不饱和存疑' WHEN 2 THEN '效率存疑' ELSE null END as 'doubtType', rd.remark " +
|
|
|
|
"from base_doctor_daily_report_upload up INNER JOIN base_doctor doc on up.doctor_id = doc.id " +
|
|
|
|
|
|
" rd.doubt_type doubtType, 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 " +
|
|
"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 " +
|
|
"base_daily_report_detail rd on up.id = rd.report_id " +
|
|
"LEFT JOIN base_daily_report_item it on rd.report_item_id = it.id " +
|
|
"LEFT JOIN base_daily_report_item it on rd.report_item_id = it.id " +
|
|
@ -3093,6 +4016,14 @@ public class DailyReportUploadService {
|
|
* @throws WriteException
|
|
* @throws WriteException
|
|
*/
|
|
*/
|
|
public void UserReportListExcel(List<Map<String,Object>> userCompleteList,OutputStream os,String startDate,String endDate) throws IOException, WriteException {
|
|
public void UserReportListExcel(List<Map<String,Object>> userCompleteList,OutputStream os,String startDate,String endDate) throws IOException, WriteException {
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
|
WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
|
|
WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
|
|
WritableSheet sheet = wwb.createSheet("sheet", 1);
|
|
WritableSheet sheet = wwb.createSheet("sheet", 1);
|
|
String[] header = {"员工完成情况("+startDate+"至"+endDate+")","","","","","","","","","","","","","","","","","",""};//
|
|
String[] header = {"员工完成情况("+startDate+"至"+endDate+")","","","","","","","","","","","","","","","","","",""};//
|
|
@ -3170,7 +4101,12 @@ public class DailyReportUploadService {
|
|
addCell(sheet,i , 14,null==completeTmp.get("verification_user_name")?"":completeTmp.get("verification_user_name").toString());
|
|
addCell(sheet,i , 14,null==completeTmp.get("verification_user_name")?"":completeTmp.get("verification_user_name").toString());
|
|
addCell(sheet,i , 15,null==completeTmp.get("verification_time")?"":completeTmp.get("verification_time").toString());
|
|
addCell(sheet,i , 15,null==completeTmp.get("verification_time")?"":completeTmp.get("verification_time").toString());
|
|
addCell(sheet,i , 16,null==completeTmp.get("doubt")?"":completeTmp.get("doubt").toString());
|
|
addCell(sheet,i , 16,null==completeTmp.get("doubt")?"":completeTmp.get("doubt").toString());
|
|
addCell(sheet,i , 17,null==completeTmp.get("doubtType")?"":completeTmp.get("doubtType").toString());
|
|
|
|
|
|
String doubtType = null==completeTmp.get("doubtType")?"":completeTmp.get("doubtType").toString();
|
|
|
|
if(StringUtils.isBlank(doubtType)){
|
|
|
|
addCell(sheet,i , 17,"");
|
|
|
|
}else {
|
|
|
|
addCell(sheet,i , 17,null==doubtTypeObj.get(doubtType)?"":doubtTypeObj.get(doubtType).toString());
|
|
|
|
}
|
|
addCell(sheet,i , 18,null==completeTmp.get("remark")?"":completeTmp.get("remark").toString());
|
|
addCell(sheet,i , 18,null==completeTmp.get("remark")?"":completeTmp.get("remark").toString());
|
|
i++;
|
|
i++;
|
|
}
|
|
}
|