From 75323b55ee0cd18a1161c88757fa221a183d68b5 Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Fri, 17 May 2024 11:01:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8D=AF=E5=93=81=E5=BA=93=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basedruginfo/BaseDrugInfoController.java | 91 ++++++++ .../domain/basedruginfo/BaseDrugInfo.java | 124 +++++++++++ .../basedruginfo/BaseDrugInfoMapper.java | 61 ++++++ .../basedruginfo/IBaseDrugInfoService.java | 61 ++++++ .../impl/BaseDrugInfoServiceImpl.java | 90 ++++++++ .../basedruginfo/BaseDrugInfoMapper.xml | 195 ++++++++++++++++++ 6 files changed, 622 insertions(+) create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/controller/basedruginfo/BaseDrugInfoController.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/domain/basedruginfo/BaseDrugInfo.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/mapper/basedruginfo/BaseDrugInfoMapper.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/basedruginfo/IBaseDrugInfoService.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/basedruginfo/impl/BaseDrugInfoServiceImpl.java create mode 100644 postdischarge-manage/src/main/resources/mapper/manage/basedruginfo/BaseDrugInfoMapper.xml diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/basedruginfo/BaseDrugInfoController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/basedruginfo/BaseDrugInfoController.java new file mode 100644 index 00000000..8e4fc2f2 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/basedruginfo/BaseDrugInfoController.java @@ -0,0 +1,91 @@ +package com.xinelu.manage.controller.basedruginfo; + +import com.xinelu.common.annotation.Log; +import com.xinelu.common.core.controller.BaseController; +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.common.enums.BusinessType; +import com.xinelu.common.utils.poi.ExcelUtil; +import com.xinelu.manage.domain.basedruginfo.BaseDrugInfo; +import com.xinelu.manage.service.basedruginfo.IBaseDrugInfoService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 药品库Controller + * + * @author xinelu + * @date 2024-05-17 + */ +@RestController +@RequestMapping("/system/baseDrug") +public class BaseDrugInfoController extends BaseController { + @Resource + private IBaseDrugInfoService baseDrugInfoService; + + /** + * 查询药品库列表 + */ + @PreAuthorize("@ss.hasPermi('system:baseDrug:list')") + @GetMapping("/list") + public TableDataInfo list(BaseDrugInfo baseDrugInfo) { + startPage(); + List list = baseDrugInfoService.selectBaseDrugInfoList(baseDrugInfo); + return getDataTable(list); + } + + /** + * 导出药品库列表 + */ + @PreAuthorize("@ss.hasPermi('system:baseDrug:export')") + @Log(title = "药品库", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BaseDrugInfo baseDrugInfo) { + List list = baseDrugInfoService.selectBaseDrugInfoList(baseDrugInfo); + ExcelUtil util = new ExcelUtil<>(BaseDrugInfo.class); + util.exportExcel(response, list, "药品库数据"); + } + + /** + * 获取药品库详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:baseDrug:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(baseDrugInfoService.selectBaseDrugInfoById(id)); + } + + /** + * 新增药品库 + */ + @PreAuthorize("@ss.hasPermi('system:baseDrug:add')") + @Log(title = "药品库", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BaseDrugInfo baseDrugInfo) { + return toAjax(baseDrugInfoService.insertBaseDrugInfo(baseDrugInfo)); + } + + /** + * 修改药品库 + */ + @PreAuthorize("@ss.hasPermi('system:baseDrug:edit')") + @Log(title = "药品库", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BaseDrugInfo baseDrugInfo) { + return toAjax(baseDrugInfoService.updateBaseDrugInfo(baseDrugInfo)); + } + + /** + * 删除药品库 + */ + @PreAuthorize("@ss.hasPermi('system:baseDrug:remove')") + @Log(title = "药品库", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(baseDrugInfoService.deleteBaseDrugInfoByIds(ids)); + } +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/basedruginfo/BaseDrugInfo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/basedruginfo/BaseDrugInfo.java new file mode 100644 index 00000000..f501bf33 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/basedruginfo/BaseDrugInfo.java @@ -0,0 +1,124 @@ +package com.xinelu.manage.domain.basedruginfo; + +import com.xinelu.common.annotation.Excel; +import com.xinelu.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 药品库对象 base_drug_info + * + * @author xinelu + * @date 2024-05-17 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "药品库对象", description = "base_drug_info") +public class BaseDrugInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 药品名称 + */ + @ApiModelProperty(value = "药品名称") + @Excel(name = "药品名称") + private String drugName; + + /** + * 适用症 + */ + @ApiModelProperty(value = "适用症") + @Excel(name = "适用症") + private String purpose; + + /** + * 给药途径 + */ + @ApiModelProperty(value = "给药途径") + @Excel(name = "给药途径") + private String applyWay; + + /** + * 用药频次 + */ + @ApiModelProperty(value = "用药频次") + @Excel(name = "用药频次") + private String applyFrequency; + + /** + * 服药说明 + */ + @ApiModelProperty(value = "服药说明") + @Excel(name = "服药说明") + private String applyRemark; + + /** + * 用法用量(服法剂量) + */ + @ApiModelProperty(value = "用法用量(服法剂量)") + @Excel(name = "用法用量(服法剂量)") + private String dosage; + + /** + * 副作用(不良反应) + */ + @ApiModelProperty(value = "副作用(不良反应)") + @Excel(name = "副作用(不良反应)") + private String sideEffects; + + /** + * 禁忌症 + */ + @ApiModelProperty(value = "禁忌症") + @Excel(name = "禁忌症") + private String contraindications; + + /** + * 存储条件 + */ + @ApiModelProperty(value = "存储条件") + @Excel(name = "存储条件") + private String storage; + + /** + * 漏服或过服的处理方法 + */ + @ApiModelProperty(value = "漏服或过服的处理方法") + @Excel(name = "漏服或过服的处理方法") + private String emergency; + + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("drugName", getDrugName()) + .append("purpose", getPurpose()) + .append("applyWay", getApplyWay()) + .append("applyFrequency", getApplyFrequency()) + .append("applyRemark", getApplyRemark()) + .append("dosage", getDosage()) + .append("sideEffects", getSideEffects()) + .append("contraindications", getContraindications()) + .append("storage", getStorage()) + .append("emergency", getEmergency()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/basedruginfo/BaseDrugInfoMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/basedruginfo/BaseDrugInfoMapper.java new file mode 100644 index 00000000..128bdf8b --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/basedruginfo/BaseDrugInfoMapper.java @@ -0,0 +1,61 @@ +package com.xinelu.manage.mapper.basedruginfo; + +import com.xinelu.manage.domain.basedruginfo.BaseDrugInfo; + +import java.util.List; + +/** + * 药品库Mapper接口 + * + * @author xinelu + * @date 2024-05-17 + */ +public interface BaseDrugInfoMapper { + /** + * 查询药品库 + * + * @param id 药品库主键 + * @return 药品库 + */ + BaseDrugInfo selectBaseDrugInfoById(Long id); + + /** + * 查询药品库列表 + * + * @param baseDrugInfo 药品库 + * @return 药品库集合 + */ + List selectBaseDrugInfoList(BaseDrugInfo baseDrugInfo); + + /** + * 新增药品库 + * + * @param baseDrugInfo 药品库 + * @return 结果 + */ + int insertBaseDrugInfo(BaseDrugInfo baseDrugInfo); + + /** + * 修改药品库 + * + * @param baseDrugInfo 药品库 + * @return 结果 + */ + int updateBaseDrugInfo(BaseDrugInfo baseDrugInfo); + + /** + * 删除药品库 + * + * @param id 药品库主键 + * @return 结果 + */ + int deleteBaseDrugInfoById(Long id); + + /** + * 批量删除药品库 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteBaseDrugInfoByIds(Long[] ids); +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/basedruginfo/IBaseDrugInfoService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/basedruginfo/IBaseDrugInfoService.java new file mode 100644 index 00000000..8d8673a6 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/basedruginfo/IBaseDrugInfoService.java @@ -0,0 +1,61 @@ +package com.xinelu.manage.service.basedruginfo; + +import com.xinelu.manage.domain.basedruginfo.BaseDrugInfo; + +import java.util.List; + +/** + * 药品库Service接口 + * + * @author xinelu + * @date 2024-05-17 + */ +public interface IBaseDrugInfoService { + /** + * 查询药品库 + * + * @param id 药品库主键 + * @return 药品库 + */ + BaseDrugInfo selectBaseDrugInfoById(Long id); + + /** + * 查询药品库列表 + * + * @param baseDrugInfo 药品库 + * @return 药品库集合 + */ + List selectBaseDrugInfoList(BaseDrugInfo baseDrugInfo); + + /** + * 新增药品库 + * + * @param baseDrugInfo 药品库 + * @return 结果 + */ + int insertBaseDrugInfo(BaseDrugInfo baseDrugInfo); + + /** + * 修改药品库 + * + * @param baseDrugInfo 药品库 + * @return 结果 + */ + int updateBaseDrugInfo(BaseDrugInfo baseDrugInfo); + + /** + * 批量删除药品库 + * + * @param ids 需要删除的药品库主键集合 + * @return 结果 + */ + int deleteBaseDrugInfoByIds(Long[] ids); + + /** + * 删除药品库信息 + * + * @param id 药品库主键 + * @return 结果 + */ + int deleteBaseDrugInfoById(Long id); +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/basedruginfo/impl/BaseDrugInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/basedruginfo/impl/BaseDrugInfoServiceImpl.java new file mode 100644 index 00000000..a47535db --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/basedruginfo/impl/BaseDrugInfoServiceImpl.java @@ -0,0 +1,90 @@ +package com.xinelu.manage.service.basedruginfo.impl; + +import com.xinelu.manage.domain.basedruginfo.BaseDrugInfo; +import com.xinelu.manage.mapper.basedruginfo.BaseDrugInfoMapper; +import com.xinelu.manage.service.basedruginfo.IBaseDrugInfoService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 药品库Service业务层处理 + * + * @author xinelu + * @date 2024-05-17 + */ +@Service +public class BaseDrugInfoServiceImpl implements IBaseDrugInfoService { + @Resource + private BaseDrugInfoMapper baseDrugInfoMapper; + + /** + * 查询药品库 + * + * @param id 药品库主键 + * @return 药品库 + */ + @Override + public BaseDrugInfo selectBaseDrugInfoById(Long id) { + return baseDrugInfoMapper.selectBaseDrugInfoById(id); + } + + /** + * 查询药品库列表 + * + * @param baseDrugInfo 药品库 + * @return 药品库 + */ + @Override + public List selectBaseDrugInfoList(BaseDrugInfo baseDrugInfo) { + return baseDrugInfoMapper.selectBaseDrugInfoList(baseDrugInfo); + } + + /** + * 新增药品库 + * + * @param baseDrugInfo 药品库 + * @return 结果 + */ + @Override + public int insertBaseDrugInfo(BaseDrugInfo baseDrugInfo) { + baseDrugInfo.setCreateTime(LocalDateTime.now()); + return baseDrugInfoMapper.insertBaseDrugInfo(baseDrugInfo); + } + + /** + * 修改药品库 + * + * @param baseDrugInfo 药品库 + * @return 结果 + */ + @Override + public int updateBaseDrugInfo(BaseDrugInfo baseDrugInfo) { + baseDrugInfo.setUpdateTime(LocalDateTime.now()); + return baseDrugInfoMapper.updateBaseDrugInfo(baseDrugInfo); + } + + /** + * 批量删除药品库 + * + * @param ids 需要删除的药品库主键 + * @return 结果 + */ + @Override + public int deleteBaseDrugInfoByIds(Long[] ids) { + return baseDrugInfoMapper.deleteBaseDrugInfoByIds(ids); + } + + /** + * 删除药品库信息 + * + * @param id 药品库主键 + * @return 结果 + */ + @Override + public int deleteBaseDrugInfoById(Long id) { + return baseDrugInfoMapper.deleteBaseDrugInfoById(id); + } +} diff --git a/postdischarge-manage/src/main/resources/mapper/manage/basedruginfo/BaseDrugInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/basedruginfo/BaseDrugInfoMapper.xml new file mode 100644 index 00000000..28aeb803 --- /dev/null +++ b/postdischarge-manage/src/main/resources/mapper/manage/basedruginfo/BaseDrugInfoMapper.xml @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + select id, drug_name, purpose, apply_way, apply_frequency, apply_remark, dosage, side_effects, contraindications, storage, emergency, create_time, create_by, update_by, update_time from base_drug_info + + + + + + + + insert into base_drug_info + + drug_name, + + purpose, + + apply_way, + + apply_frequency, + + apply_remark, + + dosage, + + side_effects, + + contraindications, + + storage, + + emergency, + + create_time, + + create_by, + + update_by, + + update_time, + + + + #{drugName}, + + #{purpose}, + + #{applyWay}, + + #{applyFrequency}, + + #{applyRemark}, + + #{dosage}, + + #{sideEffects}, + + #{contraindications}, + + #{storage}, + + #{emergency}, + + #{createTime}, + + #{createBy}, + + #{updateBy}, + + #{updateTime}, + + + + + + update base_drug_info + + drug_name = + #{drugName}, + + purpose = + #{purpose}, + + apply_way = + #{applyWay}, + + apply_frequency = + #{applyFrequency}, + + apply_remark = + #{applyRemark}, + + dosage = + #{dosage}, + + side_effects = + #{sideEffects}, + + contraindications = + #{contraindications}, + + storage = + #{storage}, + + emergency = + #{emergency}, + + create_time = + #{createTime}, + + create_by = + #{createBy}, + + update_by = + #{updateBy}, + + update_time = + #{updateTime}, + + + where id = #{id} + + + + delete from base_drug_info where id = #{id} + + + + delete from base_drug_info where id in + + #{id} + + + \ No newline at end of file