|
@ -317,12 +317,19 @@ public class DailyReportUploadService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BaseDailyReportUploadDO createDailyReport(String doctorId,String report_date,String week_name, List<BaseDailyReportDetailDO> detailDOList) throws Exception {
|
|
|
public BaseDailyReportUploadDO createDailyReport(String doctorId,String report_date,Integer leaveState,String leaveHour,String week_name, List<BaseDailyReportDetailDO> detailDOList) throws Exception {
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(doctorId);
|
|
|
if (null==doctorDO){
|
|
|
throw new Exception("上报人不存在");
|
|
|
}
|
|
|
if (1==leaveState){
|
|
|
if (StringUtils.isNotBlank(leaveHour)){
|
|
|
if (Integer.parseInt(leaveHour)<8&&detailDOList.size()==0){
|
|
|
throw new Exception("上传失败,请假未满8小时需要提交完成内容");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (StringUtil.isBlank(report_date)){
|
|
|
report_date = DateUtil.getStringDateShort();
|
|
@ -331,6 +338,7 @@ public class DailyReportUploadService {
|
|
|
BaseDailyReportUploadDO dailyReportUploadDO = dailyReportUploadDao.findByDoctorIdAndReportDate(doctorId,report_date);
|
|
|
if (null==dailyReportUploadDO){
|
|
|
dailyReportUploadDO = new BaseDailyReportUploadDO();
|
|
|
dailyReportUploadDO.setState(0);
|
|
|
}else{
|
|
|
reportDetailDao.deleteByReportIdAndState(dailyReportUploadDO.getId(),0);
|
|
|
}
|
|
@ -338,55 +346,55 @@ public class DailyReportUploadService {
|
|
|
dailyReportUploadDO.setDoctorName(doctorDO.getName());
|
|
|
dailyReportUploadDO.setReportDate(report_date);
|
|
|
dailyReportUploadDO.setWeekName(week_name);
|
|
|
dailyReportUploadDao.save(dailyReportUploadDO);
|
|
|
dailyReportUploadDO = dailyReportUploadDao.save(dailyReportUploadDO);
|
|
|
for (BaseDailyReportDetailDO tmp :detailDOList){
|
|
|
tmp.setReportId(dailyReportUploadDO.getId());
|
|
|
}
|
|
|
reportDetailDao.save(detailDOList);
|
|
|
if (detailDOList.size()>0){
|
|
|
reportDetailDao.save(detailDOList);
|
|
|
}
|
|
|
List<BaseDailyReportDetailDO> detailDOS = reportDetailDao.findByReportId(dailyReportUploadDO.getId());
|
|
|
if (reportDetailDao.findByReportIdAndState(dailyReportUploadDO.getId(),0).size()>0){
|
|
|
dailyReportUploadDO.setState(0);
|
|
|
String senderID="";//日报发送对象
|
|
|
String boosID="0592008";//老板id
|
|
|
List<BaseDoctorRoleDO> roleDOS = doctorRoleDao.findByDoctorCode(doctorId);
|
|
|
if (roleDOS.size()==0){//普通员工 需要查询对应上级人员
|
|
|
if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
|
|
|
BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
|
|
|
String sql = " select role.doctor_code from base_doctor_role role INNER JOIN base_doctor_hospital dh " +
|
|
|
"on role.doctor_code = dh.doctor_code and dh.dept_code='"+doctorHospitalDO.getDeptCode()+"' " +
|
|
|
"where role.role_code='deptAdmin' ";
|
|
|
List<String> deptAdmins = jdbcTemplate.queryForList(sql,String.class);
|
|
|
if (deptAdmins.size()>0){
|
|
|
senderID = deptAdmins.get(0);
|
|
|
}else {
|
|
|
senderID=boosID;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String senderID="";//日报发送对象
|
|
|
String boosID="0592008";//老板id
|
|
|
List<BaseDoctorRoleDO> roleDOS = doctorRoleDao.findByDoctorCode(doctorId);
|
|
|
if (roleDOS.size()==0){//普通员工 需要查询对应上级人员
|
|
|
if (doctorHospitalDOS != null && doctorHospitalDOS.size() != 0) {
|
|
|
BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
|
|
|
String sql = " select role.doctor_code from base_doctor_role role INNER JOIN base_doctor_hospital dh " +
|
|
|
"on role.doctor_code = dh.doctor_code and dh.dept_code='"+doctorHospitalDO.getDeptCode()+"' " +
|
|
|
"where role.role_code='deptAdmin' ";
|
|
|
List<String> deptAdmins = jdbcTemplate.queryForList(sql,String.class);
|
|
|
if (deptAdmins.size()>0){
|
|
|
senderID = deptAdmins.get(0);
|
|
|
}else {
|
|
|
senderID=boosID;
|
|
|
}
|
|
|
}else {//部门管理员 发送对象为老板
|
|
|
senderID = boosID;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(senderID)){
|
|
|
BaseDoctorDO remindDoctorDO = baseDoctorDao.findById(senderID);
|
|
|
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()+"已提交每日日报,请点击前往审核。";
|
|
|
String url = "https://ehr.yihu.com/hlwyy/zjxl/healthMonitoring/#/workSummary/commit?mode=verify&docId="+doctorId;
|
|
|
String res = enterpriseService.sendTWMesByDoctor(wechatId,remindDoctorDO.getId(),title,des,url);
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}else {//部门管理员 发送对象为老板
|
|
|
senderID = boosID;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(senderID)){
|
|
|
BaseDoctorDO remindDoctorDO = baseDoctorDao.findById(senderID);
|
|
|
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()+"已提交每日日报,请点击前往审核。";
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
dailyReportUploadDO.setState(1);
|
|
|
}
|
|
|
dailyReportUploadDao.save(dailyReportUploadDO);
|
|
|
dailyReportUploadDO.setDetailDOList(detailDOS);
|
|
@ -398,20 +406,23 @@ public class DailyReportUploadService {
|
|
|
* 核实审核信息
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
public BaseDailyReportUploadDO verifiedItem(String doctorId,List<BaseDailyReportDetailDO> detailDOList) throws Exception {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BaseDailyReportUploadDO verifiedItem(String doctorId,String reportId,List<BaseDailyReportDetailDO> detailDOList) throws Exception {
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
|
|
|
if (null==doctorDO){
|
|
|
throw new Exception("无权限审核");
|
|
|
}
|
|
|
BaseDailyReportUploadDO dailyReportUploadDO = new BaseDailyReportUploadDO();
|
|
|
if(detailDOList.size()>0){
|
|
|
dailyReportUploadDO = dailyReportUploadDao.findOne(detailDOList.get(0).getReportId());
|
|
|
if (null==dailyReportUploadDO){
|
|
|
throw new Exception("核实记录未查询到");
|
|
|
}
|
|
|
|
|
|
BaseDailyReportUploadDO dailyReportUploadDO = null;
|
|
|
dailyReportUploadDO = dailyReportUploadDao.findOne(reportId);
|
|
|
if (null==dailyReportUploadDO){
|
|
|
throw new Exception("核实记录未查询到");
|
|
|
}
|
|
|
if(detailDOList.size()>0){//无完成事项内容
|
|
|
boolean doubt =false;
|
|
|
for (BaseDailyReportDetailDO tmp:detailDOList){
|
|
|
if (1==tmp.getDoubt()){
|
|
|
doubt = true;
|
|
|
}
|
|
|
tmp.setVerificationTime(new Date());
|
|
|
}
|
|
|
reportDetailDao.save(detailDOList);
|
|
@ -421,11 +432,66 @@ public class DailyReportUploadService {
|
|
|
dailyReportUploadDO.setState(1);
|
|
|
dailyReportUploadDao.save(dailyReportUploadDO);
|
|
|
}
|
|
|
if (doubt==true){//有疑惑,推送给总经办"0592181"和老板"0592008";//老板id
|
|
|
String sql = " select dict_value from wlyy_hospital_sys_dict where dict_name='MRRB_DOUBT_SENDER' ";
|
|
|
List<String> doubtSendUser = jdbcTemplate.queryForList(sql,String.class);
|
|
|
for (String senderUser:doubtSendUser){
|
|
|
try {
|
|
|
BaseDoctorDO remindDoctorDO = baseDoctorDao.findById(senderUser);
|
|
|
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()+"对"+dailyReportUploadDO.getDoctorName()+"已提交的每日日报有存疑,请点击前往审核。";
|
|
|
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);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
dailyReportUploadDO.setState(1);
|
|
|
dailyReportUploadDao.save(dailyReportUploadDO);
|
|
|
}
|
|
|
|
|
|
return dailyReportUploadDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*核实每日报表疑惑
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BaseDailyReportUploadDO verifiedDoubtItem(String doctorId,List<BaseDailyReportDetailDO> detailDOList) throws Exception {
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
|
|
|
if (null==doctorDO){
|
|
|
throw new Exception("无权限审核");
|
|
|
}
|
|
|
String sql = " select dict_value from wlyy_hospital_sys_dict where dict_name='MRRB_DOUBT_SENDER' ";
|
|
|
List<String> doubtSendUser = jdbcTemplate.queryForList(sql,String.class);
|
|
|
if (!doubtSendUser.contains(doctorId)){
|
|
|
throw new Exception("无权限审核");
|
|
|
}
|
|
|
BaseDailyReportUploadDO dailyReportUploadDO = new BaseDailyReportUploadDO();
|
|
|
if(detailDOList.size()>0) {
|
|
|
dailyReportUploadDO = dailyReportUploadDao.findOne(detailDOList.get(0).getReportId());
|
|
|
if (null == dailyReportUploadDO) {
|
|
|
throw new Exception("核实记录未查询到");
|
|
|
}
|
|
|
reportDetailDao.save(detailDOList);
|
|
|
}
|
|
|
return dailyReportUploadDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取当天日报上传记录
|
|
|
* @param doctor
|