Browse Source

添加撤销审核通过的功能,以及其他优化

lighter 1 year ago
parent
commit
a7042e8313

+ 5 - 0
src/main/java/thyyxxk/webserver/config/exception/BizException.java

@@ -17,6 +17,11 @@ public class BizException extends RuntimeException {
         this.errorEnum = errorEnum;
     }
 
+    public BizException(String message) {
+        super(new Throwable(message));
+        this.errorEnum = ExceptionEnum.INTERNAL_SERVER_ERROR;
+    }
+
     public BizException(ExceptionEnum errorEnum, String message) {
         super(message);
         errorEnum.setMessage(message);

+ 1 - 1
src/main/java/thyyxxk/webserver/config/exception/GlobalExceptionHandler.java

@@ -30,7 +30,7 @@ public class GlobalExceptionHandler {
     @ResponseBody
     public ResultVo<String> bizExceptionHandler(BizException e){
         log.error("【BizException】发生业务异常", e);
-        return ResultVoUtil.fail(e.getErrorEnum());
+        return ResultVoUtil.fail(e.getErrorEnum(), e.getMessage());
     }
 
     @ExceptionHandler(value = NullPointerException.class)

+ 5 - 0
src/main/java/thyyxxk/webserver/controller/inpatient/casefrontsheet/CaseFrontSheetController.java

@@ -280,6 +280,11 @@ public class CaseFrontSheetController {
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result);
     }
 
+    @PostMapping("/revokeApprovedAudit")
+    public ResultVo<String> revokeApprovedAudit(@RequestBody FrontsheetQualityVerification request) {
+        return ResultVoUtil.success(service.revokeApprovedAudit(request));
+    }
+
     @PostMapping("/fetchAuditHistories")
     public ResultVo<List<FrontsheetQualityVerification>> fetchAuditHistories(@RequestBody FrontsheetQualityVerification request) {
         return ResultVoUtil.success(service.fetchAuditHistories(request));

+ 2 - 2
src/main/java/thyyxxk/webserver/dao/his/dictionary/NationalMatchDao.java

@@ -19,7 +19,7 @@ import java.util.List;
 @Mapper
 public interface NationalMatchDao {
 
-    @Select("select a.code,a.serial,a.new_name as name,type=#{type},${upldFlagColumn} as uploadedFlag, " +
+    @Select("select a.code,a.serial,isnull(a.new_name,a.name) as name,type=#{type},${upldFlagColumn} as uploadedFlag, " +
             "${codeColumn} as nationalCode,${nameColumn} as nationalName,${statement} " +
             "aaz231 as injuryUniqueId,ake003 as catalogueType, bke215 as fundType, " +
             "unit=(select name from yp_zd_unit where yp_zd_unit.code=a.dosage_unit), " +
@@ -44,7 +44,7 @@ public interface NationalMatchDao {
                                                   @Param("statement") String statement,
                                                   @Param("uploadStatement") String uploadStatement);
 
-    @Select("select a.code,a.serial,a.new_name as name,type=#{type},${upldFlagColumn} as uploadedFlag, " +
+    @Select("select a.code,a.serial,isnull(a.new_name,a.name) as name,type=#{type},${upldFlagColumn} as uploadedFlag, " +
             "${codeColumn} as nationalCode,${nameColumn} as nationalName,${statement} " +
             "aaz231 as injuryUniqueId,ake003 as catalogueType, bke215 as fundType, " +
             "unit=(select name from yp_zd_unit where yp_zd_unit.code=a.dosage_unit), " +

+ 4 - 0
src/main/java/thyyxxk/webserver/dao/his/inpatient/casefrontsheet/QualityVerificationDao.java

@@ -2,6 +2,7 @@ package thyyxxk.webserver.dao.his.inpatient.casefrontsheet;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import org.mapstruct.Mapper;
 import thyyxxk.webserver.entity.casefrontsheet.FrontsheetQualityVerification;
 import thyyxxk.webserver.entity.dictionary.CodeName;
@@ -28,4 +29,7 @@ public interface QualityVerificationDao extends BaseMapper<FrontsheetQualityVeri
     @Select("select code,name,py_code from zd_unit_code where isnull(del_flag,'0')!='1' " +
             "and code not like '8%' and inpatient_flag='1' order by code")
     List<CodeName> selectAllSmallDeptWithInpatientFlag();
+
+    @Update("update t_frontsheet_quality_verification set audit_state='INITIAL' where id=#{id} ")
+    int revokeApprovedAudit(String id);
 }

+ 15 - 0
src/main/java/thyyxxk/webserver/service/inpatient/casefrontsheet/CaseFrontSheetMainService.java

@@ -11,6 +11,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
+import thyyxxk.webserver.config.exception.BizException;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.sidicts.Insutype;
 import thyyxxk.webserver.constants.sidicts.MedType;
@@ -1210,6 +1211,20 @@ public class CaseFrontSheetMainService {
         return "数据库错误,请联系管理员。";
     }
 
+    public String revokeApprovedAudit(FrontsheetQualityVerification request) {
+        Integer fileStatus = dao.selectFileStatus(request.getPatNo(), request.getTimes());
+        if (null != fileStatus && fileStatus == 1) {
+            throw new BizException(ExceptionEnum.LOGICAL_ERROR, "病案已签收,无法撤销审核。");
+        }
+        int result = qualityVerificationDao.revokeApprovedAudit(request.getId());
+        if (result == 0) {
+            throw new BizException("数据库错误,请稍后再试。");
+        }
+        log.info("操作员:【{}】撤销病案质控已通过的审核:\n{}",
+                TokenUtil.getInstance().getTokenUserId(), JSON.toJSONString(request));
+        return "撤销成功。";
+    }
+
     public List<FrontsheetQualityVerification> fetchAuditHistories(FrontsheetQualityVerification request) {
         QueryWrapper<FrontsheetQualityVerification> wrapper = new QueryWrapper<>();
         wrapper.eq("pat_no", request.getPatNo());

+ 2 - 3
src/main/java/thyyxxk/webserver/service/outpatient/wxapi/WxApiService.java

@@ -85,7 +85,6 @@ public class WxApiService {
         log.info("退款申请:{}", JSON.toJSONStringWithDateFormat(param, "yyyy-MM-dd HH:mm:ss"));
         String nonceStr = SnowFlakeId.instance().nextId();
         String outRefundNo = SnowFlakeId.instance().nextId();
-        String totalFee = DecimalUtil.moneyYuanToFen(param.getTotalFee());
         String cashpayAmt = DecimalUtil.moneyYuanToFen(param.getCashpayAmt());
         TreeMap<String, String> map = new TreeMap<>();
         map.put("appid", WxCertUtil.APP_ID);
@@ -94,7 +93,7 @@ public class WxApiService {
         map.put("out_refund_no", outRefundNo);
         map.put("out_trade_no", param.getTradeNo());
         map.put("refund_fee", cashpayAmt);
-        map.put("total_fee", totalFee);
+        map.put("total_fee", cashpayAmt);
         String refundSign = Md5Util.createWxPaySign(map);
         String xml = "<xml>" +
                 "<appid>" + WxCertUtil.APP_ID + "</appid>" +
@@ -103,7 +102,7 @@ public class WxApiService {
                 "<out_refund_no>" + outRefundNo + "</out_refund_no>" +
                 "<out_trade_no>" + param.getTradeNo() + "</out_trade_no>" +
                 "<refund_fee>" + cashpayAmt + "</refund_fee>" +
-                "<total_fee>" + totalFee + "</total_fee>" +
+                "<total_fee>" + cashpayAmt + "</total_fee>" +
                 "<sign>" + refundSign + "</sign>" +
                 "</xml>";
         String str = requestWithSsl(xml);