|
@@ -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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|