Explorar el Código

解决电子病历审核问题,dao类 foreach循环BigDecimal会失去精度

xiaochan hace 8 meses
padre
commit
924fd77961

+ 3 - 7
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/emr/EmrAuditDao.java

@@ -14,21 +14,17 @@ import java.util.List;
 @Mapper
 public interface EmrAuditDao extends BaseMapper<EmrAuditDetail> {
 
-    @Insert("<script>" +
-            "insert into emr_audit_detail (pat_no,times,approver, review_time, name, scoring_criteria, remark, " +
+    @Insert("insert into emr_audit_detail (pat_no,times,approver, review_time, name, scoring_criteria, remark, " +
             "number_of_defects, emr_id, history , doctor , final_control,level,minus_points) " +
             "values" +
-            "<foreach collection='list' item='item' separator=','>" +
             "(#{patNo},#{times},#{item.approver},#{item.reviewTime},#{item.name},#{item.scoringCriteria},#{item.remark}," +
-            "#{item.numberOfDefects},#{id},0,#{doctor},#{item.finalControl},#{level},#{item.minusPoints})" +
-            "</foreach>" +
-            "</script>")
+            "#{item.numberOfDefects},#{id},0,#{doctor},#{item.finalControl},#{level},#{item.minusPoints})")
     void insertAudit(@Param("patNo") String patNo,
                      @Param("times") Integer times,
                      @Param("id") Integer id,
                      @Param("doctor") String doctor,
                      @Param("level") Integer level,
-                     @Param("list") List<EmrAuditDetail> list);
+                     @Param("item") EmrAuditDetail list);
 
     @Update("UPDATE emr_audit_detail " +
             "SET remediation_status = #{state}," +

+ 1 - 7
src/main/java/thyyxxk/webserver/service/ca/CaServer.java

@@ -48,7 +48,6 @@ public class CaServer implements Assertion {
     private final CaData caData;
     private final String SUCCRSS = "success";
     private final RedisLikeService redisLikeService;
-    private final EmrServer emrServer;
     private final RedisServer redisServer;
     private final EmrPatientDao emrPatientDao;
     private final String archivePath;
@@ -60,14 +59,11 @@ public class CaServer implements Assertion {
         return "ca-emr-" + documentId;
     }
 
-    public CaServer(
-            CaData caData, RedisLikeService redisLikeService, EmrServer emrServer, RedisServer redisServer, EmrPatientDao emrPatientDao, ArchiveConfig archive) {
+    public CaServer(CaData caData, RedisLikeService redisLikeService, RedisServer redisServer, EmrPatientDao emrPatientDao, ArchiveConfig archive) {
         this.caData = caData;
         this.redisLikeService = redisLikeService;
-        this.emrServer = emrServer;
         this.redisServer = redisServer;
         this.emrPatientDao = emrPatientDao;
-
         archivePath = archive.getPath() + "/emr";
     }
 
@@ -668,7 +664,6 @@ public class CaServer implements Assertion {
         if (execute.getInt("code") != 0) {
             throw new BizException(ExceptionEnum.LOGICAL_ERROR, execute.getStr("ret_msg"));
         }
-
         return execute;
     }
 
@@ -692,5 +687,4 @@ public class CaServer implements Assertion {
         return "/archive" + pdfPath;
     }
 
-
 }

+ 6 - 7
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuLuRuServer.java

@@ -68,12 +68,7 @@ public class YiZhuLuRuServer {
     private final SqlSessionFactory sqlSessionFactory;
     private final SiChargeLimitService siChargeLimitService;
 
-    /**
-     * 转科的医嘱编码
-     */
-    private final String ZK_CODE = "06286";
     private final String ITEM = "00";
-    private final String 出院带药 = "007";
 
     public ResultVo<String> getOrderNo() {
         return ResultVoUtil.success(publicServer.getActOrderNo().stripTrailingZeros().toPlainString());
@@ -383,6 +378,7 @@ public class YiZhuLuRuServer {
         }
 
         if (checkData.getPassTheAudit()) {
+            String ZK_CODE = "06286"; //转科的医嘱编码
             if (ZK_CODE.equals(data.getOrderCode())) {
                 ZyOrderZk transferData = new ZyOrderZk();
                 transferData
@@ -1230,6 +1226,7 @@ public class YiZhuLuRuServer {
      */
     public ResultVo<Map<String, Object>> confirmTheDoctorSOrderWithMedicine(String patNo, Integer times) {
         QueryWrapper<?> qw = new QueryWrapper<>();
+        String 出院带药 = "007";
         qw.eq("a.inpatient_no", patNo)
                 .eq("a.admiss_times", times)
                 .eq("a.status_flag", "1")
@@ -1456,7 +1453,6 @@ public class YiZhuLuRuServer {
     }
 
     public QueryWrapper<?> getConfirmQueryWrapper(String patNo, Integer times) {
-        // 排除出院带药的医嘱
         return new QueryWrapper<>().eq("a.inpatient_no", patNo)
                 .eq("a.admiss_times", times)
                 .eq("a.status_flag", "1")
@@ -1475,7 +1471,10 @@ public class YiZhuLuRuServer {
             return ResultVoUtil.success("OK");
         }
 
-        List<String> collect = orderCode.stream().filter(Objects::nonNull).collect(Collectors.toList());
+        List<String> collect = orderCode
+                .stream()
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
 
         if (collect.isEmpty()) {
             return ResultVoUtil.success("OK");

+ 4 - 2
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/emr/EmrAuditServer.java

@@ -44,8 +44,10 @@ public class EmrAuditServer {
         if (auditSet.size() != data.getList().size()) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请勿添加重复审核项目。");
         }
+        ListUtil.batchList(data.getList(), EmrAuditDao.class, (mapper, item) -> {
+            mapper.insertAudit(data.getPatNo(), data.getTimes(), data.getId(), data.getDoctor(), data.getLevel(), item);
+        });
 
-        dao.insertAudit(data.getPatNo(), data.getTimes(), data.getId(), data.getDoctor(), data.getLevel(), data.getList());
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE);
     }
 
@@ -120,7 +122,7 @@ public class EmrAuditServer {
 
     public ResultVo<String> deleteEmrAuditByEmrId(String id) {
         EmrAuditDetail emrAuditDetail = dao.selectById(id);
-        if (publicServer.needRule(78) || emrAuditDetail.getRemark().equals(TokenUtil.getInstance().getTokenUserId())) {
+        if (publicServer.needRule(78) || emrAuditDetail.getApprover().equals(TokenUtil.getInstance().getTokenUserId())) {
             dao.deleteById(id);
             return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE);
         }