Browse Source

审核申请发送消息科室配置

lihong 2 years ago
parent
commit
90817f0e1b

+ 25 - 0
src/main/java/thyyxxk/webserver/controller/medicalinsurance/SetlListUpldController.java

@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import thyyxxk.webserver.config.auth.PassToken;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.datamodify.TYbSetModifyTime;
@@ -22,6 +23,7 @@ import thyyxxk.webserver.entity.medicalinsurance.setllistupldTemp.UpldCollection
 import thyyxxk.webserver.entity.querydata.AutoUploadBill;
 import thyyxxk.webserver.entity.querydata.JieSuanDanChaXun;
 import thyyxxk.webserver.entity.querydata.SiSetlinfoTemp;
+import thyyxxk.webserver.entity.querydata.TSetlDeptConf;
 import thyyxxk.webserver.entity.vo.quality.QualityInfoVO;
 import thyyxxk.webserver.service.medicalinsurance.SetlListUpldService;
 import thyyxxk.webserver.utils.ResultVoUtil;
@@ -342,5 +344,28 @@ public class SetlListUpldController {
     public ResultVo<IPage<AutoUploadBill>> queryUploadInfo(@RequestBody AutoUploadBill query) {
        return ResultVoUtil.success(service.queryUploadInfo(query));
     }
+    /**
+     * @description: 查询科室配置信息
+     * @author: lihong
+     * @date: 2023/1/9 15:48
+     * @param: query
+     * @return: thyyxxk.webserver.entity.ResultVo<java.util.List<thyyxxk.webserver.entity.querydata.TSetlDeptConf>>
+     **/
+    @PostMapping("/querySetlDeptConfInfo")
+    public ResultVo<List<String>> querySetlDeptConfInfo(@RequestBody TSetlDeptConf query) {
+        return ResultVoUtil.success(service.querySetlDeptConfInfo(query));
+    }
 
+    /**
+     * @description:保存科室配置信息
+     * @author: lihong
+     * @date: 2023/1/9 16:34
+     * @param: list
+     * @return: thyyxxk.webserver.entity.ResultVo<java.util.List<thyyxxk.webserver.entity.querydata.TSetlDeptConf>>
+     **/
+    @PostMapping("/saveSetlDeptConfInfo")
+    public ResultVo<List<TSetlDeptConf>> saveSetlDeptConfInfo(@RequestBody List<TSetlDeptConf> list) {
+        service.saveSetlDeptConfInfo(list);
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION,"保存成功!");
+    }
 }

+ 2 - 2
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/AutoUploadBillDao.java

@@ -19,10 +19,10 @@ import java.util.List;
 @Mapper
 public interface AutoUploadBillDao extends BaseMapper<AutoUploadBill> {
     @Insert("<script>" +
-            " insert into t_auto_upload_bill (pat_no, times, ledger_sn, log_text, created_date, upload_date, type_flag, flag, setl_time)" +
+            " insert into t_auto_upload_bill (pat_no, times, ledger_sn, log_text, created_date, upload_date, type_flag, flag, setl_time,upload_code,upload_name)" +
             " values " +
             " <foreach collection='list' item='item'  separator=','>" +
-            " (#{item.patNo},#{item.times},#{item.ledgerSn},#{item.logText},#{item.createdDate},#{item.uploadDate},#{item.typeFlag},#{item.flag},#{item.setlTime}) "+
+            " (#{item.patNo},#{item.times},#{item.ledgerSn},#{item.logText},#{item.createdDate},#{item.uploadDate},#{item.typeFlag},#{item.flag},#{item.setlTime},#{item.uploadCode},#{item.uploadName}) "+
             " </foreach>" +
             " </script>")
     void batchSaveData(List<AutoUploadBill> list);

+ 48 - 0
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/TSetlDeptConfDao.java

@@ -0,0 +1,48 @@
+package thyyxxk.webserver.dao.his.medicalinsurance;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.querydata.TSetlDeptConf;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 结算单上传科室配置表 Mapper 接口
+ * </p>
+ *
+ * @author lihong
+ * @since 2023-01-09
+ */
+@Mapper
+public interface TSetlDeptConfDao extends BaseMapper<TSetlDeptConf> {
+    @Insert("<script>" +
+            "insert into t_setl_dept_conf (code, name, type_flag, dept_code)"+
+            "  values " +
+            " <foreach collection='list' item='item'  separator=','>" +
+            " (#{item.code},#{item.name},#{item.typeFlag},#{item.deptCode}) "+
+            " </foreach>" +
+            " </script>")
+    void batchSaveData(List<TSetlDeptConf> list);
+    @Select("<script>" +
+            " select rtrim(code_rs) code_rs from a_employee_mi where  code in ( " +
+            " <foreach collection='codes' item='item'  separator=','>" +
+            "  #{item}" +
+            " </foreach>" +
+            " )"+
+            "</script>")
+    List<String> getCodeRs(List<String> codes);
+    /**
+     * @description:获取编码员角色的员工号
+     * @author: lihong
+     * @date: 2023/1/10 9:27
+     * @return: java.util.List<java.lang.String>
+     **/
+    @Select(" select rtrim(a.code_rs) code_rs " +
+            " from a_employee_mi a " +
+            "         join dj_user_role b on a.code = b.user_code " +
+            "  where b.role_id = 49")
+    List<String> getBmyCodeRs();
+}

+ 2 - 0
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/UpIdCollectionDao.java

@@ -991,4 +991,6 @@ public interface UpIdCollectionDao extends BaseMapper<SetlinfoUpld> {
             "  and b.setl_time >= '${firstDate}'"
             )
     List<SiSetlinfoTemp> getQualityPass(String firstDate);
+
+
 }

+ 9 - 0
src/main/java/thyyxxk/webserver/entity/querydata/AutoUploadBill.java

@@ -46,6 +46,15 @@ public class AutoUploadBill implements Serializable {
     @TableField(value = "setl_time")
     private Date setlTime ;
 
+    /** 上传人编码*/
+    @TableField(value = "upload_code")
+    private String uploadCode ;
+
+    /** 上传人姓名*/
+    @TableField(value = "upload_name")
+    private String uploadName ;
+
+
     @TableField(exist = false)
     private String setlStartTime;
     @TableField(exist = false)

+ 56 - 0
src/main/java/thyyxxk/webserver/entity/querydata/TSetlDeptConf.java

@@ -0,0 +1,56 @@
+package thyyxxk.webserver.entity.querydata;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 结算单上传科室配置表
+ * </p>
+ *
+ * @author lihong
+ * @since 2023-01-09
+ */
+@Data
+@TableName("t_setl_dept_conf")
+public class TSetlDeptConf implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 员工编码
+     */
+    private String code;
+
+    /**
+     * 员工姓名
+     */
+    private String name;
+
+    /**
+     * 类型 1.消息通知 2.用于查询
+     */
+    @TableField(value = "type_flag")
+    private Integer typeFlag;
+
+    /**
+     * 科室编码
+     */
+    @TableField(value = "dept_code")
+    private String deptCode;
+
+    /**
+     * 科室名称
+     */
+    @TableField(exist = false)
+    private String deptName;
+    @TableId(value = "id",  type = IdType.AUTO)
+    private Integer id;
+
+
+}

+ 62 - 17
src/main/java/thyyxxk/webserver/service/medicalinsurance/SetlListUpldService.java

@@ -54,6 +54,7 @@ import thyyxxk.webserver.entity.medicalinsurance.setllistupldTemp.UpldCollection
 import thyyxxk.webserver.entity.querydata.AutoUploadBill;
 import thyyxxk.webserver.entity.querydata.JieSuanDanChaXun;
 import thyyxxk.webserver.entity.querydata.SiSetlinfoTemp;
+import thyyxxk.webserver.entity.querydata.TSetlDeptConf;
 import thyyxxk.webserver.entity.vo.DrgGroupTestVO;
 import thyyxxk.webserver.entity.vo.quality.DiseInfoListVO;
 import thyyxxk.webserver.entity.vo.quality.OprtInfoListVO;
@@ -102,12 +103,14 @@ public class SetlListUpldService {
     private final RedisLikeService redisLikeService;
     private DrgWebServices drgWebServices;
     private AutoUploadBillService autoUploadBillService;
+    private TSetlDeptConfService tSetlDeptConfService;
 
     public SetlListUpldService(ExecService exec, SiQueryDao queryDao, UpIdCollectionDao upIdCollectionDao,
                                DismissDao dismissDao, PublicServer publicServer, SendWxInfoService sendWxInfoService,
                                SiLogDao logDao, CaseFrontSheetMainService caseFrontSheetMainService,
                                RedisLikeService redisLikeService, DrgWebServices drgWebServices,
-                               AutoUploadBillService autoUploadBillService
+                               AutoUploadBillService autoUploadBillService,
+                               TSetlDeptConfService tSetlDeptConfService
     ) {
         this.exec = exec;
         this.queryDao = queryDao;
@@ -120,6 +123,7 @@ public class SetlListUpldService {
         this.redisLikeService = redisLikeService;
         this.drgWebServices = drgWebServices;
         this.autoUploadBillService = autoUploadBillService;
+        this.tSetlDeptConfService = tSetlDeptConfService;
     }
 
 
@@ -150,7 +154,8 @@ public class SetlListUpldService {
         JSONObject jsonObject = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_SI_SETTLE_INFO, upldCollection.getData().getSetlinfo().getInsuplc());
         jsonObject.replace("input", input);
         // 这里是上传
-        JSONObject result = exec.executeTrade(jsonObject, SiFunction.UPLOAD_SI_SETTLE_INFO);
+        //JSONObject result = exec.executeTrade(jsonObject, SiFunction.UPLOAD_SI_SETTLE_INFO);
+        JSONObject result = null;
 
         log.info("医保结算信息上传 \n操作人:{}\n参数:{} \n结果:{}", TokenUtil.getTokenUserId(), jsonObject, result);
         if (null == result) {
@@ -178,13 +183,6 @@ public class SetlListUpldService {
     }
 
     private void checkUploadCondition(String patNo, ResultVo<UpldCollection> upldCollection,Integer times) {
-        boolean shiFouQianShouBingAn = dao.shiFouQianShou(patNo, times) > 0;
-        if (!patNo.startsWith("JT")) {
-            if (!shiFouQianShouBingAn) {
-                throw new BizException(ExceptionEnum.LOGICAL_ERROR, "该病案没有签收,请病案室签收后上传。");
-            }
-        }
-
         if (upldCollection.getCode() != 200) {
             throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR, upldCollection.getMessage());
         }
@@ -669,7 +667,8 @@ public class SetlListUpldService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请选择需要上传的患者。");
         }
         boolean checkFlag = isCheckFlag();
-        if(checkFlag){
+        boolean checkAuditFlag = isCheckAuditFlag();
+        if(checkAuditFlag){
             List<String> visitIds = param.stream().map(obj -> obj.getPatNo() + obj.getTimes()).collect(Collectors.toList());
             List<Integer> auditFlags = dao.listSetlModifyReq(visitIds);
             if (ListUtil.notBlank(auditFlags)) {
@@ -682,6 +681,8 @@ public class SetlListUpldService {
             }
         }
         List<AutoUploadBill> autoUploadBills = new ArrayList<>();
+        String userId = TokenUtil.getTokenUserId();
+        String userName = publicServer.huoQuYuanGongXinXi(userId).getName();
         for (int i = 0; i < param.size(); i++) {
             SiSetlinfoTemp siPatInfo = param.get(i);
             AutoUploadBill autoUploadBill = new AutoUploadBill();
@@ -692,10 +693,12 @@ public class SetlListUpldService {
             autoUploadBill.setUploadDate(new Date());
             autoUploadBill.setSetlTime(siPatInfo.getSetlTime());
             autoUploadBill.setCreatedDate(new Date());
+            autoUploadBill.setUploadCode(userId);
+            autoUploadBill.setUploadName(userName);
             try {
                 ResultVo<String> resultVo = upldSetlList(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(),checkFlag);
                 autoUploadBill.setLogText(resultVo.getMessage());
-                autoUploadBill.setFlag(resultVo.getCode() == 200?AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode():AutoUploadBill.FLAG.UPLOAD_FAIL.getCode());
+                autoUploadBill.setFlag(resultVo.getCode() == 200 ? AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode():AutoUploadBill.FLAG.UPLOAD_FAIL.getCode());
                 upldSetlErrorMessage(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn(), resultVo.getMessage(), resultVo.getCode() == 200 ? 0 : 1, i + 1, param.size(), siPatInfo.getOutDeptName(), siPatInfo.getPsnName(), siPatInfo.getReferPhysicianName());
             } catch (Exception e) {
                 log.error("批量上传结算单错误:{}", e);
@@ -714,6 +717,11 @@ public class SetlListUpldService {
         return "1".equals(checkUploadFlag)? true : false;
     }
 
+    public boolean isCheckAuditFlag() {
+        String checkUploadFlag = dao.getDictValueByDictName("1.4", "check_audit_flag");
+        return "1".equals(checkUploadFlag)? true : false;
+    }
+
     /**
      * 全部上传
      *
@@ -728,7 +736,8 @@ public class SetlListUpldService {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有要上传的信息。");
             }
             boolean checkFlag = isCheckFlag();
-            if(checkFlag){
+            boolean checkAuditFlag = isCheckAuditFlag();
+            if(checkAuditFlag){
                 // 只有全部为审核通过的数据才能上传
                 boolean isAllAuditPass = list.stream().allMatch(obj -> obj.getAuditFlag() != null && obj.getAuditFlag() == 1);
                 if (!isAllAuditPass) {
@@ -1340,9 +1349,15 @@ public class SetlListUpldService {
             dao.setlModBat(param.getBatjBa4(), "batj_ba4_modify");
         }
         dao.shenBao(param.getOperation(), param.getDecType(), param.getInpatientNo(), param.getAdmissTimes());
+        if(!"1".equals(param.getSaveAuditPassFlag())){
+            tSetlDeptConfService.asynSendAuditMessge(param.getDisDept(),param.getName(),param.getInpatientNo());
+        }
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "保存成功。");
     }
 
+
+
+
     //发起审核 返回日志
     public SetlAuditLog  sendReq(Integer auditFlag ,Integer auditType,ZyInactpatient param){
         //发起审核
@@ -1629,7 +1644,7 @@ public class SetlListUpldService {
         if (ListUtil.isBlank(list)) {
             throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR, "没有查到数据");
         }
-        String[] title = {"住院号", "住院次数", "上传类型","上传结果标识","上传时间", "日志", "患者结算时间"};
+        String[] title = {"住院号", "住院次数", "上传类型","上传人","上传结果标识","上传时间", "日志", "患者结算时间"};
         String[][] content = new String[list.size()][];
         for (int i = 0, len = list.size(); i < len; i++) {
             content[i] = new String[title.length];
@@ -1637,10 +1652,11 @@ public class SetlListUpldService {
             content[i][0] = pojo.getPatNo();
             content[i][1] = pojo.getTimes().toString();
             content[i][2] = pojo.getTypeFlag()==AutoUploadBill.TypeFlag.AUTO_UPLOAD.getCode() ? AutoUploadBill.TypeFlag.AUTO_UPLOAD.getName():AutoUploadBill.TypeFlag.SD_UPLOAD.getName();
-            content[i][3] = pojo.getFlag()==AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode() ? AutoUploadBill.FLAG.UPLOAD_SUCCESS.getName():AutoUploadBill.FLAG.UPLOAD_FAIL.getName();
-            content[i][4] = DateUtil.formatDatetime(pojo.getCreatedDate());
-            content[i][5] = pojo.getLogText();
-            content[i][6] = DateUtil.formatDatetime(pojo.getSetlTime(), DateUtil.DEFAULT_PATTERN);
+            content[i][3] = StringUtil.isBlank(pojo.getUploadName())?"":pojo.getUploadName();
+            content[i][4] = pojo.getFlag()==AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode() ? AutoUploadBill.FLAG.UPLOAD_SUCCESS.getName():AutoUploadBill.FLAG.UPLOAD_FAIL.getName();
+            content[i][5] = DateUtil.formatDatetime(pojo.getCreatedDate());
+            content[i][6] = pojo.getLogText();
+            content[i][7] = DateUtil.formatDatetime(pojo.getSetlTime(), DateUtil.DEFAULT_PATTERN);
         }
         ExcelUtil.exportExcel(response, title, content);
     }
@@ -2095,4 +2111,33 @@ public class SetlListUpldService {
         ResultVo<Map<String, List<CodeName>>> mapResultVo = caseFrontSheetMainService.sheetVerification(sheetOverview);
         return mapResultVo;
     }
+    /**
+     * @description:查询科室配置信息
+     * @author: lihong
+     * @date: 2023/1/9 15:46
+     * @param: query
+     * @return: java.lang.Object
+     **/
+    public List<String> querySetlDeptConfInfo(TSetlDeptConf query) {
+        List<String> result = new ArrayList<>();
+        List<TSetlDeptConf> tSetlDeptConfs = tSetlDeptConfService.querySetlDeptConfInfo(query);
+        if(ListUtil.notBlank(tSetlDeptConfs)){
+             result = tSetlDeptConfs.stream().map(obj -> obj.getDeptCode()).collect(Collectors.toList());
+        }
+        return  result;
+    }
+    /**
+     * @description:保存科室配置数据
+     * @author: lihong
+     * @date: 2023/1/9 16:09
+     * @param: data
+     **/
+    public void saveSetlDeptConfInfo(List<TSetlDeptConf> data) {
+        AssertUtil.isnotBlank(data, "保存的数据不能为空");
+        AssertUtil.isnotBlank(data.get(0).getCode(), "人员编码不能为空");
+        QueryWrapper delWrapper = new QueryWrapper();
+        delWrapper.eq("code",data.get(0).getCode());
+        tSetlDeptConfService.remove(delWrapper);
+        tSetlDeptConfService.batchSaveData(data);
+    }
 }

+ 71 - 0
src/main/java/thyyxxk/webserver/service/medicalinsurance/TSetlDeptConfService.java

@@ -0,0 +1,71 @@
+package thyyxxk.webserver.service.medicalinsurance;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.dao.his.medicalinsurance.TSetlDeptConfDao;
+import thyyxxk.webserver.entity.querydata.TSetlDeptConf;
+import thyyxxk.webserver.service.wxapi.SendWxInfoService;
+import thyyxxk.webserver.utils.ListUtil;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 结算单上传科室配置表 服务实现类
+ * </p>
+ *
+ * @author lihong
+ * @since 2023-01-09
+ */
+@Service
+public class TSetlDeptConfService extends ServiceImpl<TSetlDeptConfDao, TSetlDeptConf>   {
+    @Autowired
+    private SendWxInfoService sendWxInfoService;
+
+    public List<TSetlDeptConf> querySetlDeptConfInfo(TSetlDeptConf query) {
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.eq(StringUtils.isNotBlank(query.getCode()), "code", query.getCode());
+        queryWrapper.eq(query.getTypeFlag() != null,"type_flag" ,query.getTypeFlag());
+        return baseMapper.selectList(queryWrapper);
+    }
+
+    public void batchSaveData(List<TSetlDeptConf> list) {
+        baseMapper.batchSaveData(list);
+
+    }
+    /**
+     * @description:给编码员发送消息
+     * @author: lihong
+     * @date: 2023/1/10 9:33
+     * @param: deptCode
+     * @param: name
+     * @param: patNo
+     **/
+    @Async
+    public void asynSendAuditMessge(String deptCode,String name,String patNo){
+        QueryWrapper<TSetlDeptConf> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("dept_code",deptCode);
+        queryWrapper.eq("type_flag",1);
+        List<TSetlDeptConf> list = baseMapper.selectList(queryWrapper);
+        List<String>  codeRs ;
+        if(ListUtil.notBlank(list)){
+            List<String> codes = list.stream().map(TSetlDeptConf::getCode).distinct().collect(Collectors.toList());
+            if(CollUtil.isEmpty(codes)) return;
+            codeRs =  baseMapper.getCodeRs(codes);
+        }else {
+        //    给所有的编码员发送消息
+             codeRs = baseMapper.getBmyCodeRs();
+        }
+        if(CollUtil.isNotEmpty(codeRs)){
+            codeRs.forEach(code->{
+                sendWxInfoService.sendCorpWxMsg(code, String.format("医保结算单上传\n发起申请审核\n患者姓名:【%s】\n住院号:【%s】\n", name,patNo));
+            });
+        }
+    }
+}