|
@@ -0,0 +1,56 @@
|
|
|
+package com.lantone.daqe.facade;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.lantone.common.util.BeanUtil;
|
|
|
+import com.lantone.common.util.StringUtil;
|
|
|
+import com.lantone.daqe.dto.GetDrugPageDTO;
|
|
|
+import com.lantone.daqe.entity.DrugInfo;
|
|
|
+import com.lantone.daqe.facade.base.DrugInfoFacade;
|
|
|
+import com.lantone.daqe.vo.GetDrugPageVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: 药品管理-业务处理类
|
|
|
+ * @author: rengb
|
|
|
+ * @time: 2021/7/20 12:39
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class DrugManagementFacade {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DrugInfoFacade drugInfoFacade;
|
|
|
+
|
|
|
+ public IPage<GetDrugPageDTO> getDrugPage(GetDrugPageVO getDrugPageVO) {
|
|
|
+ Page<GetDrugPageDTO> getDrugPageDTOPage = new Page<>();
|
|
|
+
|
|
|
+ QueryWrapper<DrugInfo> drugInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ drugInfoQueryWrapper.eq(getDrugPageVO.getHospitalId() != null, "hospital_id", getDrugPageVO.getHospitalId());
|
|
|
+ drugInfoQueryWrapper.like(StringUtil.isNotBlank(getDrugPageVO.getName()), "name", getDrugPageVO.getName());
|
|
|
+ drugInfoQueryWrapper.like(StringUtil.isNotBlank(getDrugPageVO.getApprovalNum()), "approval_num", getDrugPageVO.getApprovalNum());
|
|
|
+ drugInfoQueryWrapper.like(StringUtil.isNotBlank(getDrugPageVO.getStandard()), "standard", getDrugPageVO.getStandard());
|
|
|
+ drugInfoQueryWrapper.like(StringUtil.isNotBlank(getDrugPageVO.getDosageForm()), "standard", getDrugPageVO.getDosageForm());
|
|
|
+ if (StringUtil.isNotBlank(getDrugPageVO.getIsMapping())) {
|
|
|
+ if (getDrugPageVO.getIsMapping().equals("0")) {
|
|
|
+ drugInfoQueryWrapper.isNull("standard");
|
|
|
+ } else if (getDrugPageVO.getIsMapping().equals("1")) {
|
|
|
+ drugInfoQueryWrapper.isNotNull("standard");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Page<DrugInfo> drugInfoPage = new Page<>(getDrugPageVO.getCurrent(), getDrugPageVO.getSize());
|
|
|
+ drugInfoFacade.page(drugInfoPage, drugInfoQueryWrapper);
|
|
|
+ BeanUtil.copyProperties(drugInfoPage, getDrugPageDTOPage);
|
|
|
+ List<GetDrugPageDTO> getDrugPageDTOList = BeanUtil.listCopyTo(drugInfoPage.getRecords(), GetDrugPageDTO.class);
|
|
|
+ getDrugPageDTOList.forEach(i -> {
|
|
|
+ i.setIsMapping(StringUtil.isBlank(i.getIsMapping()) ? "未匹配" : "已匹配");
|
|
|
+ });
|
|
|
+
|
|
|
+ getDrugPageDTOPage.setRecords(getDrugPageDTOList);
|
|
|
+ return getDrugPageDTOPage;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|