Ver código fonte

质控核查迭代相关代码提交

songxinlu 3 anos atrás
pai
commit
75ec63dddf

+ 1 - 0
doc/049.20220518v2.8.0_通用版_质控核查迭代/qc_init_v2.8.0_通用版_质控核查迭代.sql

@@ -24,6 +24,7 @@ CREATE TABLE `med_check_distribution_scheme` (
   `distribution_type` char(3) NOT NULL DEFAULT '0' COMMENT '分配方式(0:平均分配;1:按比例分配) 默认平均分配',
   `task_time_limit` int(8) DEFAULT NULL COMMENT '任务时限',
   `is_timing` char(3) NOT NULL DEFAULT '0' COMMENT '是否定时任务(0:非定时任务 1:是定时任务)',
+  `scheduled_task_expression` varchar(255) DEFAULT NULL COMMENT '任务生成时间表达式',
   `is_deleted` char(3) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
   `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
   `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',

+ 143 - 0
src/main/java/com/diagbot/aop/RunBehospitalInfoTypeAspect.java

@@ -0,0 +1,143 @@
+package com.diagbot.aop;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.entity.MedNewsNotice;
+import com.diagbot.entity.SysUser;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.NewsNoticeTypeEnum;
+import com.diagbot.facade.MedNewsNoticeFacade;
+import com.diagbot.facade.SysUserFacade;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.HttpUtils;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.SysUserUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @Description:运行病历每次评分后生成对应的患者类型
+ * @Author: songxl
+ * @time: 2022/5/19 10:18
+ */
+
+@Aspect
+@Component
+public class RunBehospitalInfoTypeAspect {
+    @Autowired
+    private MedNewsNoticeFacade medNewsNoticeFacade;
+    @Autowired
+    private SysUserFacade sysUserFacade;
+
+    // 操作配置织入点
+    @Pointcut("execution(public * com.diagbot.web.BehospitalInfoController.analyzeApi(..))"+
+            "||execution(public * com.diagbot.web.BehospitalInfoController.analyzeRun(..))")
+    public void makeTypePointCut() {
+    }
+
+    /**
+     * 操作后执行
+     *
+     * @param joinPoint
+     * @param jsonResult
+     * @Return void
+     */
+    @AfterReturning(pointcut = "makeTypePointCut()", returning = "jsonResult")
+    public void analyzeAfterReturning(JoinPoint joinPoint, Object jsonResult) {
+        try {
+            //获取请求入参
+            String params = getRequestParams(joinPoint);
+            if (StringUtils.isNotBlank(params)) {
+                //存储消息通知
+                saveNewsNotice(params);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 存储消息通知
+     *
+     * @param params
+     * @Return void
+     */
+    private void saveNewsNotice(String params) {
+        //参数处理
+        MedNewsNotice newsNotice = paramHandler(params);
+        if (newsNotice != null) {
+            medNewsNoticeFacade.save(newsNotice);
+        }
+    }
+
+    /**
+     * 参数处理
+     *
+     * @param params
+     * @Return java.lang.String
+     */
+    private MedNewsNotice paramHandler(String params) {
+        if (StringUtil.isNotEmpty(params) && "{".equals(params.substring(0, 1))) {
+            JSONObject paramJSON = JSONObject.parseObject(params);
+            if (paramJSON.getJSONArray("behospitalCodes") == null
+                    || StringUtil.isBlank(paramJSON.getString("checkId"))
+                    || StringUtil.isBlank(paramJSON.getString("distributionType"))
+                    || StringUtil.isBlank(paramJSON.getString("checkName"))) {
+                return null;
+            }
+            //获取分配者用户名
+        }
+        return null;
+    }
+
+
+    /**
+     * /**
+     * 获取请求的参数
+     *
+     * @param joinPoint
+     * @Return java.lang.String
+     */
+    private String getRequestParams(JoinPoint joinPoint) throws Exception {
+        Map<String, String[]> map = HttpUtils.getHttpServletRequest().getParameterMap();
+        if (MapUtils.isNotEmpty(map)) {
+            String params = JSONObject.toJSONString(map);
+            return params;
+        } else {
+            Object[] args = joinPoint.getArgs();
+            if (null != args) {
+                return argsArrayToString(joinPoint.getArgs());
+            }
+        }
+        return "";
+    }
+
+    /**
+     * 参数拼装
+     *
+     * @param paramsArray
+     * @Return java.lang.String
+     */
+    private String argsArrayToString(Object[] paramsArray) {
+        String params = "";
+        if (paramsArray != null && paramsArray.length > 0) {
+            for (int i = 0; i < paramsArray.length; i++) {
+                if (null != (paramsArray[i])) {
+                    Object jsonObj = JSONObject.toJSONString(paramsArray[i]);
+                    params += jsonObj.toString() + " ";
+                }
+            }
+        }
+        return params.trim();
+    }
+}
+
+

+ 10 - 161
src/main/java/com/diagbot/entity/CheckDistributionScheme.java

@@ -3,6 +3,9 @@ package com.diagbot.entity;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Getter;
+import lombok.Setter;
+
 import java.time.LocalDateTime;
 import java.io.Serializable;
 
@@ -15,6 +18,8 @@ import java.io.Serializable;
  * @since 2022-05-18
  */
 @TableName("med_check_distribution_scheme")
+@Getter
+@Setter
 public class CheckDistributionScheme implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -105,6 +110,11 @@ public class CheckDistributionScheme implements Serializable {
      */
     private String isTiming;
 
+    /**
+     * 任务生成时间表达式
+     */
+    private String scheduledTaskExpression;
+
     /**
      * 是否删除,N:未删除,Y:删除
      */
@@ -135,167 +145,6 @@ public class CheckDistributionScheme implements Serializable {
      */
     private String remark;
 
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-    public Long getHospitalId() {
-        return hospitalId;
-    }
-
-    public void setHospitalId(Long hospitalId) {
-        this.hospitalId = hospitalId;
-    }
-    public String getDeptIds() {
-        return deptIds;
-    }
-
-    public void setDeptIds(String deptIds) {
-        this.deptIds = deptIds;
-    }
-    public String getDeptNames() {
-        return deptNames;
-    }
-
-    public void setDeptNames(String deptNames) {
-        this.deptNames = deptNames;
-    }
-    public String getSchemeName() {
-        return schemeName;
-    }
-
-    public void setSchemeName(String schemeName) {
-        this.schemeName = schemeName;
-    }
-    public String getStage() {
-        return stage;
-    }
-
-    public void setStage(String stage) {
-        this.stage = stage;
-    }
-    public Integer getInTimeFrame() {
-        return inTimeFrame;
-    }
-
-    public void setInTimeFrame(Integer inTimeFrame) {
-        this.inTimeFrame = inTimeFrame;
-    }
-    public Integer getOutTimeFrame() {
-        return outTimeFrame;
-    }
-
-    public void setOutTimeFrame(Integer outTimeFrame) {
-        this.outTimeFrame = outTimeFrame;
-    }
-    public String getLevel() {
-        return level;
-    }
-
-    public void setLevel(String level) {
-        this.level = level;
-    }
-    public String getBehospitalType() {
-        return behospitalType;
-    }
-
-    public void setBehospitalType(String behospitalType) {
-        this.behospitalType = behospitalType;
-    }
-    public String getCheckStatus() {
-        return checkStatus;
-    }
-
-    public void setCheckStatus(String checkStatus) {
-        this.checkStatus = checkStatus;
-    }
-    public String getIsCheckAll() {
-        return isCheckAll;
-    }
-
-    public void setIsCheckAll(String isCheckAll) {
-        this.isCheckAll = isCheckAll;
-    }
-    public Integer getCheckRatio() {
-        return checkRatio;
-    }
-
-    public void setCheckRatio(Integer checkRatio) {
-        this.checkRatio = checkRatio;
-    }
-    public Integer getCheckNum() {
-        return checkNum;
-    }
-
-    public void setCheckNum(Integer checkNum) {
-        this.checkNum = checkNum;
-    }
-    public String getDistributionType() {
-        return distributionType;
-    }
-
-    public void setDistributionType(String distributionType) {
-        this.distributionType = distributionType;
-    }
-    public Integer getTaskTimeLimit() {
-        return taskTimeLimit;
-    }
-
-    public void setTaskTimeLimit(Integer taskTimeLimit) {
-        this.taskTimeLimit = taskTimeLimit;
-    }
-    public String getIsTiming() {
-        return isTiming;
-    }
-
-    public void setIsTiming(String isTiming) {
-        this.isTiming = isTiming;
-    }
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-    public LocalDateTime getGmtCreate() {
-        return gmtCreate;
-    }
-
-    public void setGmtCreate(LocalDateTime gmtCreate) {
-        this.gmtCreate = gmtCreate;
-    }
-    public LocalDateTime getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(LocalDateTime gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-    public String getModifier() {
-        return modifier;
-    }
-
-    public void setModifier(String modifier) {
-        this.modifier = modifier;
-    }
-    public String getRemark() {
-        return remark;
-    }
-
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
 
     @Override
     public String toString() {

+ 1 - 0
src/main/resources/mapper/CheckDistributionSchemeMapper.xml

@@ -21,6 +21,7 @@
         <result column="distribution_type" property="distributionType" />
         <result column="task_time_limit" property="taskTimeLimit" />
         <result column="is_timing" property="isTiming" />
+        <result column="scheduled_task_expression" property="scheduledTaskExpression" />
         <result column="is_deleted" property="isDeleted" />
         <result column="gmt_create" property="gmtCreate" />
         <result column="gmt_modified" property="gmtModified" />