Browse Source

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 2 năm trước cách đây
mục cha
commit
c6afceff94

+ 17 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -11691,6 +11691,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
                    vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(), 1), inspectionVOs, WlyyInspectionVO.class));
                    //物流信息
                    List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByOutpatientId(vo.getOutpatientId());
                    if (expressageDOs != null && expressageDOs.size() > 0) {
                        vo.setExpressage(convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class));
                        vo.setOneselfPickupFlg(expressageDOs.get(0).getOneselfPickupFlg());
                    } else {
                        vo.setExpressage(null);
                        vo.setOneselfPickupFlg(null);
                    }
                    List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(vo.getOutpatientId());
                    List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
                    if (expressageLogDOs != null && expressageLogDOs.size() > 0) {
                        convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class);
                    }
                    vo.setExpressageLogs(expressageLogVOs);
                    //支付信息
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(vo.getId());
                    if (null!=businessOrderDO){

+ 11 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java

@ -371,6 +371,9 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "检查检验", example = "模块1")
    private List<WlyyInspectionVO> inspectionVOs;
    @ApiModelProperty(value = "物流信息", example = "模块1")
    private List<WlyyPrescriptionExpressageLogVO> expressageLogs ;
    @ApiModelProperty(value = "电子病历", example = "模块1")
    private WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO;
@ -917,4 +920,12 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    public void setWlyyPrescriptionEmrDO(WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO) {
        this.wlyyPrescriptionEmrDO = wlyyPrescriptionEmrDO;
    }
    public List<WlyyPrescriptionExpressageLogVO> getExpressageLogs() {
        return expressageLogs;
    }
    public void setExpressageLogs(List<WlyyPrescriptionExpressageLogVO> expressageLogs) {
        this.expressageLogs = expressageLogs;
    }
}

+ 31 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/dailyReport/DailyReportMonthReportJob.java

@ -0,0 +1,31 @@
package com.yihu.jw.job.dailyReport;
import com.yihu.jw.service.channel.DailyReportService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * 员工月报统计推送通知
 */
public class DailyReportMonthReportJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(DailyReportMonthReportJob.class);
    @Autowired
    private DailyReportService dailyReportService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("START========DailyReportMonthReportJob========");
        try {
            dailyReportService.dailyReportMonth();
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("END===ERROE===DailyReportMonthReportJob,message:"+e.getMessage());
        }
    }
}

+ 1 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/dailyReport/DailyReportRemindJob.java

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
/**
 * Created by Bing on 2022/7/26.
 * 日报未上传第一次提醒
 */
public class DailyReportRemindJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(DailyReportRemindJob.class);

+ 1 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/dailyReport/DailyReportRemindSecondJob.java

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
/**
 * Created by Bing on 2022/7/26.
 * 日报未上传二次提醒
 */
public class DailyReportRemindSecondJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(DailyReportRemindSecondJob.class);

+ 1 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/dailyReport/DailyReportTotalRemindJob.java

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
/**
 * Created by Bing on 2022/7/26.
 * 日报当日上传情况统计通知
 */
public class DailyReportTotalRemindJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(DailyReportTotalRemindJob.class);

+ 1 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/dailyReport/DailyReportWsbTotalRemindJob.java

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
/**
 * Created by Bing on 2022/7/26.
 * 日报未上报统计通知
 */
public class DailyReportWsbTotalRemindJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(DailyReportWsbTotalRemindJob.class);

+ 118 - 3
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/DailyReportService.java

@ -1,5 +1,6 @@
package com.yihu.jw.service.channel;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dailyReport.dao.BaseDailyReportDetailDao;
import com.yihu.jw.dailyReport.dao.BaseDailyReportUploadDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -30,9 +31,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
 * Created by Bing on 2022/7/26.
@ -259,4 +259,119 @@ public class DailyReportService {
        }
    }
    public void dailyReportMonth(){
        String sql = " select dict_value from wlyy_hospital_sys_dict where dict_name='BOOS_ADMIN_SENDER'  ";
        List<String> boosSenderIds = jdbcTemplate.queryForList(sql, String.class);
        String boosID = " ";
        if (boosSenderIds.size() > 0) {
            boosID = boosSenderIds.get(0);
        }
        sql = "select id,name,mobile from base_doctor where del=1 and identity=0 and id<>'"+boosID+"' ";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(sql);
        Date lastMonth= DateUtil.getNextMonthReturnDate(new Date(),-1);
        String monthStartDay = DateUtil.getFristDayOfMonthThisDate(lastMonth);
        String monthEndDay = DateUtil.getLastDayOfMonthThisDate(lastMonth);
        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){
            doubtTypeObj = JSONObject.parseObject(dictValues.get(0)).getJSONObject("dailyReportDoubtTypeName");
        }
        String monthStr = DateUtil.dateToStr(lastMonth,"MM");
        for (Map<String,Object>tmp:patientList){
            String msg = "{name},{month}月份月报:效能异常:{doubtTotal}次,请假:{leaveHour}个小时,未上报:{weishangbao}次,{doubtTypeMsg},项目催促:{xmcc}次,效能异常超过3次扣绩效! ";
            String user = tmp.get("id").toString();
            String name = null==tmp.get("name")?"":tmp.get("name").toString();
            String mobile = null==tmp.get("mobile")?"":tmp.get("mobile").toString();
            //效能异常
           sql = "select count(distinct d1.id)from base_doctor_daily_report_upload d1 INNER JOIN base_doctor doc on d1.doctor_id = doc.id " +
                    "INNER JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1  " +
                    "LEFT JOIN base_daily_report_detail de on d1.id = de.report_id " +
                    "where doc.del=1 and doc.identity=0 and doc.id='"+user+"' and d1.report_date>='"+monthStartDay+"' and d1.report_date<='"+monthEndDay+"'  and de.doubt=1 ";
           Integer doubtTotal = jdbcTemplate.queryForObject(sql,Integer.class);
           if (doubtTotal>3){
               continue;
           }
            //请假
            Double leaveHour = 0d;
            sql = " select sum(cast(IFNULL(leave_hour,IFNULL(leave_hour,0)) as decimal(18,2))) from base_doctor_daily_report_upload up where up.doctor_id='"+user+"' and up.report_date>='"+monthStartDay+"' and up.report_date<='"+monthEndDay+"' ";
            leaveHour = jdbcTemplate.queryForObject(sql,Double.class);
            leaveHour = null==leaveHour?0:leaveHour;
            //未上报
            Long weishangbao=0l;
            Long workDays=0l;
            if (StringUtils.isNotBlank(monthStartDay)&&StringUtils.isNotBlank(monthEndDay)) {
                workDays = DateUtil.getWorkDays(monthStartDay, monthEndDay);
            }
            sql = " select count(id) from base_doctor_daily_report_upload up where up.doctor_id='"+user+"' and up.report_date>='"+monthStartDay+"' and up.report_date<='"+monthEndDay+"' ";
            Long yishangbao = jdbcTemplate.queryForObject(sql,Long.class);
            weishangbao = (workDays-yishangbao)<0?0:workDays-yishangbao;
            sql = " select count(distinct up.id) as total,rd.doubt_type " +
                    " from base_doctor_daily_report_upload up  " +
                    "INNER JOIN base_doctor doc on up.doctor_id = doc.id and doc.del=1 " +
                    "Inner JOIN base_doctor_hospital dh on doc.id = dh.doctor_code and dh.del=1 " +
                    "LEFT JOIN base_daily_report_detail rd on up.id = rd.report_id " +
                    "LEFT join base_daily_report_item i on i.id = rd.report_item_id and i.del=1 and up.state=1 where 1=1 " +
                    " and doc.id='"+user+"' and up.report_date>='"+monthStartDay+"' and up.report_date<='"+monthEndDay+"'  group by rd.doubt_type";
            List<Map<String,Object>> doubtTypeList = jdbcTemplate.queryForList(sql);
            List<Map<String,Object>> personDoubtList = new ArrayList<>();
            for (Map<String,Object>doubtTmp:doubtTypeList){
                if (doubtTmp.get("doubt_type")==null){
                }else {
                    String doubtType = doubtTmp.get("doubt_type").toString();
                    if(doubtTypeObj.containsKey(doubtType)){
                        doubtTmp.put("doubtTypeName",doubtTypeObj.get(doubtType));
                    }else {
                        doubtTmp.put("doubtTypeName","其他");
                    }
                    personDoubtList.add(doubtTmp);
                }
            }
            List<String> doubtListStr = personDoubtList.stream().map(e -> e.get("doubt_type").toString()).collect(Collectors.toList());
            for (String key:doubtTypeObj.keySet()){
                if (!doubtListStr.contains(key)){
                    Map<String,Object>doubtTmp = new HashMap<>();
                    doubtTmp.put("doubt_type",key);
                    doubtTmp.put("doubtTypeName",doubtTypeObj.get(key));
                    doubtTmp.put("total",0);
                    personDoubtList.add(doubtTmp);
                }
            }
            personDoubtList.sort((Comparator.comparing(e->e.get("doubt_type").toString())));
            List<String> doubtTypeMsgs = new ArrayList<>();
            for (Map<String,Object> personDoubt:personDoubtList ){
                String doubtName = personDoubt.get("doubtTypeName").toString();
                String total = personDoubt.get("total").toString();
                doubtTypeMsgs.add(doubtName+total+"次");
            }
            String doubtTypeMsg = doubtTypeMsgs.stream().map(String::valueOf).collect(Collectors.joining(","));
            //项目催促
            Integer xmcc=0;
            sql = " select count(id) from base_daily_urging_record where receive_doctor='"+user+"' and create_time>='"+monthStartDay +" 00:00:00' and create_time<='"+monthEndDay+" 23:59:59' ";
            xmcc = jdbcTemplate.queryForObject(sql,Integer.class);
            try {
                WxEnterpriseUserDO enterpriseUserDO = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(wechatId, mobile);
                if (enterpriseUserDO == null) {
                    logger.info("该用户" + name + "没有企业微信手机号,无法推送模版消息,用户ID:" + user + "wechatId:" + wechatId);
                } else {
                    String title = "月报反馈";
                    String des = msg.replace("{name}",name).replace("{name}",name).replace("{month}",monthStr+"")
                            .replace("{doubtTotal}",doubtTotal+"").replace("{leaveHour}",leaveHour+"")
                            .replace("{weishangbao}",weishangbao+"").replace("{doubtTypeMsg}",doubtTypeMsg).replace("{xmcc}",xmcc+"");
                    logger.info(des);
                    String url = "https://ehr.yihu.com/hlwyy/zjxl/dailyReport/#/home/index";
                    String res = enterpriseService.sendTWMesByDoctor(wechatId, user, title, des, url);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}

+ 11 - 4
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -10,10 +10,7 @@ import com.yihu.jw.internet.service.InternetService;
import com.yihu.jw.internet.service.YkyyCommonService;
import com.yihu.jw.internet.service.ykyy.YkyyInternetService;
import com.yihu.jw.job.*;
import com.yihu.jw.job.dailyReport.DailyReportRemindJob;
import com.yihu.jw.job.dailyReport.DailyReportRemindSecondJob;
import com.yihu.jw.job.dailyReport.DailyReportTotalRemindJob;
import com.yihu.jw.job.dailyReport.DailyReportWsbTotalRemindJob;
import com.yihu.jw.job.dailyReport.*;
import com.yihu.jw.job.yk.YKYYDataUploadJob;
import com.yihu.jw.job.ykyy.UnCheckPrescriptionJob;
import com.yihu.jw.job.ykyy.UnSettledHISPrescriptionJob;
@ -370,6 +367,16 @@ public class JobController extends BaseController {
                        logger.info("DailyReportWsbTotalRemindJob  job exist");
                    }
                    break;
                case "DailyReportMonthReportJob" :
                    //日报未上报通知
                    if (!quartzHelper.isExistJob("DailyReportMonthReportJob")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("DailyReportMonthReportJob");
                        quartzHelper.addJob(DailyReportMonthReportJob.class, trigger, "DailyReportMonthReportJob", new HashMap<String, Object>());
                        logger.info("DailyReportMonthReportJob  job success");
                    } else {
                        logger.info("DailyReportMonthReportJob  job exist");
                    }
                    break;
                default :
            }
            return success("启动成功!");

+ 2 - 0
svr/svr-internet-hospital-job/src/main/resources/system.properties

@ -49,3 +49,5 @@ DailyReportTotalRemindJob=0 0 22 * * ? *
DailyReportWsbTotalRemindJob=0 0 21 * * ? *
DailyReportMonthReportJob=0 0 9 1 * ? *

+ 2 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dailyReport/DailyReportUploadPoint.java

@ -369,8 +369,8 @@ public class DailyReportUploadPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "首页按照科室统计")
    public ListEnvelop selectHeaderListHeshi(@ApiParam(name = "dept", value = "科室code")
                                        @RequestParam(value = "dept", required = false) String dept,
                                             @ApiParam(name = "doctor", value = "当前用户")
                                             @RequestParam(value = "doctor", required = false) String doctor,
                                        @ApiParam(name = "doctor", value = "当前用户")
                                        @RequestParam(value = "doctor", required = false) String doctor,
                                        @ApiParam(name = "idType", value = "身份类别")
                                        @RequestParam(value = "idType", required = false) String idType,
                                        @ApiParam(name = "state", value = "核实状态0未核实1已核实")