Prechádzať zdrojové kódy

正则式相关代码提交

songxinlu 3 rokov pred
rodič
commit
6409bd3c27

+ 31 - 0
daqe-center/src/main/java/com/lantone/daqe/dto/GetRegularPageDTO.java

@@ -0,0 +1,31 @@
+package com.lantone.daqe.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 获取正则式维护分页列表-接口出参
+ * @author: songxl
+ * @time: 2022/3/4 10:39
+ */
+@ApiModel(value = "获取正则式维护分页列表-接口出参")
+@Getter
+@Setter
+public class GetRegularPageDTO implements Serializable {
+
+    private static final long serialVersionUID = -6177667779756225188L;
+
+    @ApiModelProperty(value = "正则式名称")
+    private String name;
+
+    @ApiModelProperty(value = "正则式值")
+    private String val;
+
+    @ApiModelProperty(value = "描述")
+    private String description;
+
+}

+ 160 - 0
daqe-center/src/main/java/com/lantone/daqe/facade/RegularManagementFacade.java

@@ -0,0 +1,160 @@
+package com.lantone.daqe.facade;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.lantone.common.api.CommonResult;
+import com.lantone.common.enums.IsDeleteEnum;
+import com.lantone.common.exception.Asserts;
+import com.lantone.common.util.BeanUtil;
+import com.lantone.common.util.ListUtil;
+import com.lantone.common.util.StringUtil;
+import com.lantone.daqe.dto.ExportImportDiseaseErrDTO;
+import com.lantone.daqe.dto.GetDiseasePageDTO;
+import com.lantone.daqe.dto.GetMatchingDiseasePageDTO;
+import com.lantone.daqe.dto.GetRegularPageDTO;
+import com.lantone.daqe.entity.DiseaseInfo;
+import com.lantone.daqe.entity.RegularInfo;
+import com.lantone.daqe.entity.RegularMapping;
+import com.lantone.daqe.entity.RegularResult;
+import com.lantone.daqe.facade.base.DiseaseInfoFacade;
+import com.lantone.daqe.facade.base.RegularInfoFacade;
+import com.lantone.daqe.facade.base.RegularMappingFacade;
+import com.lantone.daqe.facade.base.RegularResultFacade;
+import com.lantone.daqe.service.impl.DiseaseInfoServiceImpl;
+import com.lantone.daqe.util.ExcelUtils;
+import com.lantone.daqe.vo.AddDiseaseVO;
+import com.lantone.daqe.vo.AddRegularVO;
+import com.lantone.daqe.vo.DelDiseaseByIdVO;
+import com.lantone.daqe.vo.DelRegularByIdVO;
+import com.lantone.daqe.vo.GetDiseasePageVO;
+import com.lantone.daqe.vo.GetMatchingDiseasePageVO;
+import com.lantone.daqe.vo.GetRegularPageVO;
+import com.lantone.daqe.vo.ImportDiseaseVO;
+import com.lantone.daqe.vo.MatchingDiseaseVO;
+import com.lantone.daqe.vo.UpDiseaseByIdVO;
+import com.lantone.daqe.vo.UpRegularByIdVO;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 正则式维护-业务处理类
+ * @author: songxl
+ * @time: 2022/3/4 10:39
+ */
+@Component
+public class RegularManagementFacade {
+
+    @Autowired
+    private RegularInfoFacade regularInfoFacade;
+
+    @Autowired
+    private RegularResultFacade regularResultFacade;
+
+    @Autowired
+    private RegularMappingFacade regularMappingFacade;
+
+    /**
+     * 获取正则式维护分页列表
+     *
+     * @param getRegularPageVO
+     * @Return com.baomidou.mybatisplus.core.metadata.IPage<com.lantone.daqe.dto.GetRegularPageDTO>
+     */
+    public IPage<GetRegularPageDTO> getRegularPage(GetRegularPageVO getRegularPageVO) {
+
+        Page<GetRegularPageDTO> getRegularPageDTOPage = new Page<>();
+        QueryWrapper<RegularInfo> regularInfoQueryWrapper = new QueryWrapper<>();
+        regularInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+        regularInfoQueryWrapper.like(StringUtil.isNotBlank(getRegularPageVO.getName()), "name", getRegularPageVO.getName());
+        Page<RegularInfo> regularInfoPage = new Page<>(getRegularPageVO.getCurrent(), getRegularPageVO.getSize());
+        regularInfoFacade.page(regularInfoPage, regularInfoQueryWrapper);
+        BeanUtil.copyProperties(regularInfoPage, getRegularPageDTOPage);
+        List<GetRegularPageDTO> getRegularPageDTOList = BeanUtil.listCopyTo(regularInfoPage.getRecords(), GetRegularPageDTO.class);
+
+        getRegularPageDTOPage.setRecords(getRegularPageDTOList);
+        return getRegularPageDTOPage;
+    }
+
+    /**
+     * 新增正则式 业务处理
+     *
+     * @param addRegularVO
+     * @return 是否新增成功
+     */
+    public Boolean addRegular(AddRegularVO addRegularVO) {
+        RegularInfo regularInfo = new RegularInfo();
+        BeanUtils.copyProperties(addRegularVO, regularInfo);
+        if (regularInfoFacade.isExist(regularInfo)) {
+            Asserts.fail("该正则式已存在!");
+        }
+        return regularInfoFacade.save(regularInfo);
+    }
+
+    /**
+     * 通过id修改正则式
+     *
+     * @param upRegularByIdVO
+     * @return 是否修改成功
+     */
+    public Boolean upRegularById(UpRegularByIdVO upRegularByIdVO) {
+        if (regularInfoFacade.getById(upRegularByIdVO.getId()) == null) {
+            Asserts.fail("该正则式不存在!");
+        }
+        //修改正则式
+        RegularInfo regularInfo = new RegularInfo();
+        BeanUtil.copyProperties(upRegularByIdVO, regularInfo);
+        //修改表字段的正则式校验结果表中的正则式
+        if (regularInfoFacade.updateById(regularInfo)) {
+            return regularResultFacade.update(new UpdateWrapper<RegularResult>()
+                    .eq(upRegularByIdVO.getHospitalId() != null, "hospital_id", upRegularByIdVO.getHospitalId())
+                    .eq("regular_id", upRegularByIdVO.getId())
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .set("regular_name", upRegularByIdVO.getName())
+                    .set("regular_val", upRegularByIdVO.getVal())
+                    .set("regular_des", upRegularByIdVO.getDescription()));
+        }
+        return false;
+    }
+
+    /**
+     * 通过id删除正则式
+     *
+     * @param delRegularByIdVO
+     * @return 是否删除成功
+     */
+    public Boolean delRegularById(DelRegularByIdVO delRegularByIdVO) {
+        if (regularInfoFacade.getById(delRegularByIdVO.getId()) == null) {
+            Asserts.fail("该正则式不存在!");
+        }
+        if (regularInfoFacade.removeById(delRegularByIdVO.getId())) {
+            //删除表字段的实际值与正则式关联关系
+            if (regularMappingFacade.update(new UpdateWrapper<RegularMapping>()
+                    .eq("regular_id", delRegularByIdVO.getId())
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .set("is_deleted", IsDeleteEnum.Y.getKey()))) {
+                //删除表字段的正则式校验结果表中的正则式
+                return regularResultFacade.update(new UpdateWrapper<RegularResult>()
+                        .eq(delRegularByIdVO.getHospitalId() != null, "hospital_id", delRegularByIdVO.getHospitalId())
+                        .eq("regular_id", delRegularByIdVO.getId())
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .set("is_deleted", IsDeleteEnum.Y.getKey()));
+            }
+
+        }
+        return false;
+    }
+
+
+}

+ 10 - 0
daqe-center/src/main/java/com/lantone/daqe/facade/base/RegularInfoFacade.java

@@ -1,5 +1,7 @@
 package com.lantone.daqe.facade.base;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.lantone.daqe.entity.RegularInfo;
 import com.lantone.daqe.service.impl.RegularInfoServiceImpl;
 import org.springframework.stereotype.Component;
 
@@ -10,5 +12,13 @@ import org.springframework.stereotype.Component;
  */
 @Component
 public class RegularInfoFacade extends RegularInfoServiceImpl {
+    public boolean isExist(RegularInfo regularInfo) {
+        boolean flag = false;
+        RegularInfo regular = this.getOne(new QueryWrapper<RegularInfo>().eq("name", regularInfo.getName()));
+        if (regular != null) {
+            flag = true;
+        }
+        return flag;
+    }
 
 }

+ 35 - 0
daqe-center/src/main/java/com/lantone/daqe/vo/AddRegularVO.java

@@ -0,0 +1,35 @@
+package com.lantone.daqe.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @Description: 新增正则式-接口入参
+ * @author: songxl
+ * @time: 2022/2/28 11:15
+ */
+@ApiModel(value = "新增正则式-接口入参")
+@Getter
+@Setter
+public class AddRegularVO implements Serializable {
+
+    private static final long serialVersionUID = 5604429365497054795L;
+
+    @ApiModelProperty(value = "正则式名称", required = true)
+    @NotBlank(message = "正则式名称不能为空")
+    private String name;
+
+    @ApiModelProperty(value = "正则式值", required = true)
+    @NotBlank(message = "正则式值不能为空")
+    private String val;
+
+    @ApiModelProperty(value = "描述")
+    private String description;
+
+}

+ 31 - 0
daqe-center/src/main/java/com/lantone/daqe/vo/DelRegularByIdVO.java

@@ -0,0 +1,31 @@
+package com.lantone.daqe.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @Description: 通过id删除正则式-接口入参
+ * @author: songxl
+ * @time: 2021/2/28 11:15
+ */
+@ApiModel(value = "通过id删除正则式-接口入参")
+@Getter
+@Setter
+public class DelRegularByIdVO implements Serializable {
+
+    private static final long serialVersionUID = -1295862612895001269L;
+
+    @ApiModelProperty(value = "组织机构ID")
+    private Long hospitalId;
+
+    @ApiModelProperty(value = "主键", required = true)
+    @NotNull(message = "主键不能为空")
+    private Long id;
+
+
+}

+ 25 - 0
daqe-center/src/main/java/com/lantone/daqe/vo/GetRegularPageVO.java

@@ -0,0 +1,25 @@
+package com.lantone.daqe.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 获取正则式维护分页列表-接口入参
+ * @author: songxl
+ * @time: 2022/3/4 10:39
+ */
+@ApiModel(value = "获取正则式维护分页列表-接口入参")
+@Getter
+@Setter
+public class GetRegularPageVO extends Page {
+
+    private static final long serialVersionUID = -4818027140373758194L;
+
+    @ApiModelProperty(value = "正则式名称")
+    private String name;
+
+
+}

+ 42 - 0
daqe-center/src/main/java/com/lantone/daqe/vo/UpRegularByIdVO.java

@@ -0,0 +1,42 @@
+package com.lantone.daqe.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @Description: 通过id修改正则式-接口入参
+ * @Author songxl
+ * @Date 2022/2/28
+ */
+@ApiModel(value = "通过id修改正则式-接口入参")
+@Getter
+@Setter
+public class UpRegularByIdVO implements Serializable {
+
+    private static final long serialVersionUID = -3965829133055502607L;
+
+    @ApiModelProperty(value = "组织机构ID")
+    private Long hospitalId;
+
+    @ApiModelProperty(value = "诊断ID", required = true)
+    @NotNull(message = "诊断ID不能为空")
+    private Long id;
+
+    @ApiModelProperty(value = "正则式名称", required = true)
+    @NotBlank(message = "正则式名称不能为空")
+    private String name;
+
+    @ApiModelProperty(value = "正则式值", required = true)
+    @NotBlank(message = "正则式值不能为空")
+    private String val;
+
+    @ApiModelProperty(value = "描述")
+    private String description;
+
+}

+ 70 - 0
daqe-center/src/main/java/com/lantone/daqe/web/RegularManagementController.java

@@ -0,0 +1,70 @@
+package com.lantone.daqe.web;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.lantone.common.api.CommonResult;
+import com.lantone.daqe.dto.GetDiseasePageDTO;
+import com.lantone.daqe.dto.GetMatchingDiseasePageDTO;
+import com.lantone.daqe.dto.GetRegularPageDTO;
+import com.lantone.daqe.facade.DiseaseManagementFacade;
+import com.lantone.daqe.facade.RegularManagementFacade;
+import com.lantone.daqe.vo.AddDiseaseVO;
+import com.lantone.daqe.vo.AddRegularVO;
+import com.lantone.daqe.vo.DelDiseaseByIdVO;
+import com.lantone.daqe.vo.DelRegularByIdVO;
+import com.lantone.daqe.vo.GetDiseasePageVO;
+import com.lantone.daqe.vo.GetMatchingDiseasePageVO;
+import com.lantone.daqe.vo.GetRegularPageVO;
+import com.lantone.daqe.vo.MatchingDiseaseVO;
+import com.lantone.daqe.vo.UpDiseaseByIdVO;
+import com.lantone.daqe.vo.UpRegularByIdVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+
+/**
+ * @Description: 正则式维护API
+ * @author: songxl
+ * @time: 2022/3/4 10:39
+ */
+@RestController
+@Api(value = "正则式维护API", tags = { "正则式维护API" })
+@RequestMapping("/regularManage")
+public class RegularManagementController {
+
+    @Autowired
+    private RegularManagementFacade regularManagementFacade;
+
+    @ApiOperation(value = "获取正则式维护分页列表 [by:songxl]", notes = "获取正则式维护分页列表")
+    @PostMapping("/getRegularPage")
+    public CommonResult<IPage<GetRegularPageDTO>> getRegularPage(@RequestBody GetRegularPageVO getRegularPageVO) {
+        return CommonResult.success(regularManagementFacade.getRegularPage(getRegularPageVO));
+    }
+
+    @ApiOperation(value = "新增正则式 [by:songxl]", notes = "新增正则式")
+    @PostMapping("/addRegular")
+    public CommonResult<Boolean> addRegular(@RequestBody @Valid AddRegularVO addRegularVO) {
+        return CommonResult.success(regularManagementFacade.addRegular(addRegularVO));
+    }
+
+    @ApiOperation(value = "通过id修改正则式 [by:songxl]", notes = "通过id修改正则式")
+    @PostMapping("/upRegularById")
+    public CommonResult<Boolean> upRegularById(@RequestBody @Valid UpRegularByIdVO upRegularByIdVO) {
+        return CommonResult.success(regularManagementFacade.upRegularById(upRegularByIdVO));
+    }
+
+    @ApiOperation(value = "通过id删除正则式 [by:songxl]", notes = "通过id删除正则式")
+    @PostMapping("/delRegularById")
+    public CommonResult<Boolean> delRegularById(@RequestBody @Valid DelRegularByIdVO delRegularByIdVO) {
+        return CommonResult.success(regularManagementFacade.delRegularById(delRegularByIdVO));
+    }
+
+}