diff --git a/pom.xml b/pom.xml index 90f91a3..b4f8e0f 100644 --- a/pom.xml +++ b/pom.xml @@ -175,14 +175,6 @@ jjwt ${jwt.version} - - - org.springframework.boot - spring-boot-devtools - 3.4.0 - true - - pro.fessional diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwPrescriptionController.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwPrescriptionController.java new file mode 100644 index 0000000..44eed9b --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwPrescriptionController.java @@ -0,0 +1,105 @@ +package com.zhyc.module.biosafety.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.biosafety.service.ISwPrescriptionService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.biosafety.domain.SwPrescription; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 处方Controller + * + * @author ruoyi + * @date 2025-07-11 + */ +@RestController +@RequestMapping("/biosafety/prescription") +public class SwPrescriptionController extends BaseController +{ + @Autowired + private ISwPrescriptionService swPrescriptionService; + + /** + * 查询处方列表 + */ + @PreAuthorize("@ss.hasPermi('biosafety:prescription:list')") + @GetMapping("/list") + public TableDataInfo list(SwPrescription swPrescription) + { + startPage(); + List list = swPrescriptionService.selectSwPrescriptionList(swPrescription); + return getDataTable(list); + } + + /** + * 导出处方列表 + */ + @PreAuthorize("@ss.hasPermi('biosafety:prescription:export')") + @Log(title = "处方", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SwPrescription swPrescription) + { + List list = swPrescriptionService.selectSwPrescriptionList(swPrescription); + ExcelUtil util = new ExcelUtil(SwPrescription.class); + util.exportExcel(response, list, "处方数据"); + } + + /** + * 获取处方详细信息 + */ + @PreAuthorize("@ss.hasPermi('biosafety:prescription:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(swPrescriptionService.selectSwPrescriptionById(id)); + } + + /** + * 新增处方 + */ + @PreAuthorize("@ss.hasPermi('biosafety:prescription:add')") + @Log(title = "处方", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SwPrescription swPrescription) + { + return toAjax(swPrescriptionService.insertSwPrescription(swPrescription)); + } + + /** + * 修改处方 + */ + @PreAuthorize("@ss.hasPermi('biosafety:prescription:edit')") + @Log(title = "处方", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SwPrescription swPrescription) + { + return toAjax(swPrescriptionService.updateSwPrescription(swPrescription)); + } + + /** + * 删除处方 + */ + @PreAuthorize("@ss.hasPermi('biosafety:prescription:remove')") + @Log(title = "处方", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(swPrescriptionService.deleteSwPrescriptionByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwUnitController.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwUnitController.java new file mode 100644 index 0000000..db8dfe5 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwUnitController.java @@ -0,0 +1,105 @@ +package com.zhyc.module.biosafety.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.biosafety.domain.SwUnit; +import com.zhyc.module.biosafety.service.ISwUnitService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 药品单位Controller + * + * @author ruoyi + * @date 2025-07-11 + */ +@RestController +@RequestMapping("/biosafety/unit") +public class SwUnitController extends BaseController +{ + @Autowired + private ISwUnitService swUnitService; + + /** + * 查询药品单位列表 + */ + @PreAuthorize("@ss.hasPermi('biosafety:unit:list')") + @GetMapping("/list") + public TableDataInfo list(SwUnit swUnit) + { + startPage(); + List list = swUnitService.selectSwUnitList(swUnit); + return getDataTable(list); + } + + /** + * 导出药品单位列表 + */ + @PreAuthorize("@ss.hasPermi('biosafety:unit:export')") + @Log(title = "药品单位", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SwUnit swUnit) + { + List list = swUnitService.selectSwUnitList(swUnit); + ExcelUtil util = new ExcelUtil(SwUnit.class); + util.exportExcel(response, list, "药品单位数据"); + } + + /** + * 获取药品单位详细信息 + */ + @PreAuthorize("@ss.hasPermi('biosafety:unit:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(swUnitService.selectSwUnitById(id)); + } + + /** + * 新增药品单位 + */ + @PreAuthorize("@ss.hasPermi('biosafety:unit:add')") + @Log(title = "药品单位", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SwUnit swUnit) + { + return toAjax(swUnitService.insertSwUnit(swUnit)); + } + + /** + * 修改药品单位 + */ + @PreAuthorize("@ss.hasPermi('biosafety:unit:edit')") + @Log(title = "药品单位", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SwUnit swUnit) + { + return toAjax(swUnitService.updateSwUnit(swUnit)); + } + + /** + * 删除药品单位 + */ + @PreAuthorize("@ss.hasPermi('biosafety:unit:remove')") + @Log(title = "药品单位", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(swUnitService.deleteSwUnitByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPresDetail.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPresDetail.java new file mode 100644 index 0000000..ba52c9e --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPresDetail.java @@ -0,0 +1,107 @@ +package com.zhyc.module.biosafety.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.zhyc.common.annotation.Excel; +import com.zhyc.common.core.domain.BaseEntity; + +/** + * 处方详情对象 sw_pres_detail + * + * @author ruoyi + * @date 2025-07-11 + */ +public class SwPresDetail extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 处方id */ + private Long persId; + + /** 药品id */ + @Excel(name = "药品id") + private Integer mediId; + + /** 用量 */ + @Excel(name = "用量") + private BigDecimal dosage; + + /** 单位 */ + @Excel(name = "单位") + private Integer unitId; + + /** 使用方法 */ + @Excel(name = "使用方法") + private Integer usageId; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setPersId(Long persId) + { + this.persId = persId; + } + + public Long getPersId() + { + return persId; + } + public void setMediId(Integer mediId) + { + this.mediId = mediId; + } + + public Integer getMediId() + { + return mediId; + } + public void setDosage(BigDecimal dosage) + { + this.dosage = dosage; + } + + public BigDecimal getDosage() + { + return dosage; + } + public void setUnitId(Integer unitId) + { + this.unitId = unitId; + } + + public Integer getUnitId() + { + return unitId; + } + public void setUsageId(Integer usageId) + { + this.usageId = usageId; + } + + public Integer getUsageId() + { + return usageId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("persId", getPersId()) + .append("mediId", getMediId()) + .append("dosage", getDosage()) + .append("unitId", getUnitId()) + .append("usageId", getUsageId()) + .toString(); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPrescription.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPrescription.java new file mode 100644 index 0000000..9afe41d --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPrescription.java @@ -0,0 +1,131 @@ +package com.zhyc.module.biosafety.domain; + +import java.util.List; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.zhyc.common.annotation.Excel; +import com.zhyc.common.core.domain.BaseEntity; + +/** + * 处方对象 sw_prescription + * + * @author ruoyi + * @date 2025-07-11 + */ +public class SwPrescription extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 处方编号 */ + @Excel(name = "处方编号") + private String no; + + /** 处方名称 */ + @Excel(name = "处方名称") + private String name; + + /** 类型(免疫/保健/驱虫/消毒/疾病治疗) */ + @Excel(name = "类型", readConverterExp = "免=疫/保健/驱虫/消毒/疾病治疗") + private Integer persType; + + /** 备注 */ + @Excel(name = "备注") + private String comment; + + /** 状态(0禁用1启用) */ + @Excel(name = "状态(0禁用1启用)") + private Integer status; + + /** 处方详情信息 */ + private List swPresDetailList; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setNo(String no) + { + this.no = no; + } + + public String getNo() + { + return no; + } + + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + public void setPersType(Integer persType) + { + this.persType = persType; + } + + public Integer getPersType() + { + return persType; + } + + public void setComment(String comment) + { + this.comment = comment; + } + + public String getComment() + { + return comment; + } + + public void setStatus(Integer status) + { + this.status = status; + } + + public Integer getStatus() + { + return status; + } + + public List getSwPresDetailList() + { + return swPresDetailList; + } + + public void setSwPresDetailList(List swPresDetailList) + { + this.swPresDetailList = swPresDetailList; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("no", getNo()) + .append("name", getName()) + .append("persType", getPersType()) + .append("comment", getComment()) + .append("status", getStatus()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("swPresDetailList", getSwPresDetailList()) + .toString(); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUnit.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUnit.java new file mode 100644 index 0000000..2942b49 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUnit.java @@ -0,0 +1,29 @@ +package com.zhyc.module.biosafety.domain; + +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.zhyc.common.annotation.Excel; +import com.zhyc.common.core.domain.BaseEntity; + +/** + * 药品单位对象 sw_unit + * + * @author ruoyi + * @date 2025-07-11 + */ +@Data +public class SwUnit extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 编号 */ + private Long id; + + /** 单位 */ + @Excel(name = "单位") + private String name; + +/* 国际单位*/ + private String unit; +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwPrescriptionMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwPrescriptionMapper.java new file mode 100644 index 0000000..ee1c462 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwPrescriptionMapper.java @@ -0,0 +1,87 @@ +package com.zhyc.module.biosafety.mapper; + +import java.util.List; +import com.zhyc.module.biosafety.domain.SwPrescription; +import com.zhyc.module.biosafety.domain.SwPresDetail; + +/** + * 处方Mapper接口 + * + * @author ruoyi + * @date 2025-07-11 + */ +public interface SwPrescriptionMapper +{ + /** + * 查询处方 + * + * @param id 处方主键 + * @return 处方 + */ + public SwPrescription selectSwPrescriptionById(Long id); + + /** + * 查询处方列表 + * + * @param swPrescription 处方 + * @return 处方集合 + */ + public List selectSwPrescriptionList(SwPrescription swPrescription); + + /** + * 新增处方 + * + * @param swPrescription 处方 + * @return 结果 + */ + public int insertSwPrescription(SwPrescription swPrescription); + + /** + * 修改处方 + * + * @param swPrescription 处方 + * @return 结果 + */ + public int updateSwPrescription(SwPrescription swPrescription); + + /** + * 删除处方 + * + * @param id 处方主键 + * @return 结果 + */ + public int deleteSwPrescriptionById(Long id); + + /** + * 批量删除处方 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSwPrescriptionByIds(Long[] ids); + + /** + * 批量删除处方详情 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSwPresDetailByPersIds(Long[] ids); + + /** + * 批量新增处方详情 + * + * @param swPresDetailList 处方详情列表 + * @return 结果 + */ + public int batchSwPresDetail(List swPresDetailList); + + + /** + * 通过处方主键删除处方详情信息 + * + * @param id 处方ID + * @return 结果 + */ + public int deleteSwPresDetailByPersId(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUnitMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUnitMapper.java new file mode 100644 index 0000000..2d3cf64 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUnitMapper.java @@ -0,0 +1,62 @@ +package com.zhyc.module.biosafety.mapper; + +import com.zhyc.module.biosafety.domain.SwUnit; + +import java.util.List; + +/** + * 药品单位Mapper接口 + * + * @author ruoyi + * @date 2025-07-11 + */ +public interface SwUnitMapper +{ + /** + * 查询药品单位 + * + * @param id 药品单位主键 + * @return 药品单位 + */ + public SwUnit selectSwUnitById(Long id); + + /** + * 查询药品单位列表 + * + * @param swUnit 药品单位 + * @return 药品单位集合 + */ + public List selectSwUnitList(SwUnit swUnit); + + /** + * 新增药品单位 + * + * @param swUnit 药品单位 + * @return 结果 + */ + public int insertSwUnit(SwUnit swUnit); + + /** + * 修改药品单位 + * + * @param swUnit 药品单位 + * @return 结果 + */ + public int updateSwUnit(SwUnit swUnit); + + /** + * 删除药品单位 + * + * @param id 药品单位主键 + * @return 结果 + */ + public int deleteSwUnitById(Long id); + + /** + * 批量删除药品单位 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSwUnitByIds(Long[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwPrescriptionService.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwPrescriptionService.java new file mode 100644 index 0000000..97c79fc --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwPrescriptionService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.biosafety.service; + +import java.util.List; +import com.zhyc.module.biosafety.domain.SwPrescription; + +/** + * 处方Service接口 + * + * @author ruoyi + * @date 2025-07-11 + */ +public interface ISwPrescriptionService +{ + /** + * 查询处方 + * + * @param id 处方主键 + * @return 处方 + */ + public SwPrescription selectSwPrescriptionById(Long id); + + /** + * 查询处方列表 + * + * @param swPrescription 处方 + * @return 处方集合 + */ + public List selectSwPrescriptionList(SwPrescription swPrescription); + + /** + * 新增处方 + * + * @param swPrescription 处方 + * @return 结果 + */ + public int insertSwPrescription(SwPrescription swPrescription); + + /** + * 修改处方 + * + * @param swPrescription 处方 + * @return 结果 + */ + public int updateSwPrescription(SwPrescription swPrescription); + + /** + * 批量删除处方 + * + * @param ids 需要删除的处方主键集合 + * @return 结果 + */ + public int deleteSwPrescriptionByIds(Long[] ids); + + /** + * 删除处方信息 + * + * @param id 处方主键 + * @return 结果 + */ + public int deleteSwPrescriptionById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwUnitService.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwUnitService.java new file mode 100644 index 0000000..13ee078 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwUnitService.java @@ -0,0 +1,62 @@ +package com.zhyc.module.biosafety.service; + +import java.util.List; + +import com.zhyc.module.biosafety.domain.SwUnit; + +/** + * 药品单位Service接口 + * + * @author ruoyi + * @date 2025-07-11 + */ +public interface ISwUnitService +{ + /** + * 查询药品单位 + * + * @param id 药品单位主键 + * @return 药品单位 + */ + public SwUnit selectSwUnitById(Long id); + + /** + * 查询药品单位列表 + * + * @param swUnit 药品单位 + * @return 药品单位集合 + */ + public List selectSwUnitList(SwUnit swUnit); + + /** + * 新增药品单位 + * + * @param swUnit 药品单位 + * @return 结果 + */ + public int insertSwUnit(SwUnit swUnit); + + /** + * 修改药品单位 + * + * @param swUnit 药品单位 + * @return 结果 + */ + public int updateSwUnit(SwUnit swUnit); + + /** + * 批量删除药品单位 + * + * @param ids 需要删除的药品单位主键集合 + * @return 结果 + */ + public int deleteSwUnitByIds(Long[] ids); + + /** + * 删除药品单位信息 + * + * @param id 药品单位主键 + * @return 结果 + */ + public int deleteSwUnitById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwPrescriptionServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwPrescriptionServiceImpl.java new file mode 100644 index 0000000..62058e8 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwPrescriptionServiceImpl.java @@ -0,0 +1,134 @@ +package com.zhyc.module.biosafety.service.impl; + +import java.util.List; +import com.zhyc.common.utils.DateUtils; +import com.zhyc.module.biosafety.domain.SwPresDetail; +import com.zhyc.module.biosafety.domain.SwPrescription; +import com.zhyc.module.biosafety.mapper.SwPrescriptionMapper; +import com.zhyc.module.biosafety.service.ISwPrescriptionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.ArrayList; +import com.zhyc.common.utils.StringUtils; +import org.springframework.transaction.annotation.Transactional; + +/** + * 处方Service业务层处理 + * + * @author ruoyi + * @date 2025-07-11 + */ +@Service +public class SwPrescriptionServiceImpl implements ISwPrescriptionService +{ + @Autowired + private SwPrescriptionMapper swPrescriptionMapper; + + /** + * 查询处方 + * + * @param id 处方主键 + * @return 处方 + */ + @Override + public SwPrescription selectSwPrescriptionById(Long id) + { + return swPrescriptionMapper.selectSwPrescriptionById(id); + } + + /** + * 查询处方列表 + * + * @param swPrescription 处方 + * @return 处方 + */ + @Override + public List selectSwPrescriptionList(SwPrescription swPrescription) + { + return swPrescriptionMapper.selectSwPrescriptionList(swPrescription); + } + + /** + * 新增处方 + * + * @param swPrescription 处方 + * @return 结果 + */ + @Transactional + @Override + public int insertSwPrescription(SwPrescription swPrescription) + { + swPrescription.setCreateTime(DateUtils.getNowDate()); + int rows = swPrescriptionMapper.insertSwPrescription(swPrescription); + insertSwPresDetail(swPrescription); + return rows; + } + + /** + * 修改处方 + * + * @param swPrescription 处方 + * @return 结果 + */ + @Transactional + @Override + public int updateSwPrescription(SwPrescription swPrescription) + { + swPrescription.setUpdateTime(DateUtils.getNowDate()); + swPrescriptionMapper.deleteSwPresDetailByPersId(swPrescription.getId()); + insertSwPresDetail(swPrescription); + return swPrescriptionMapper.updateSwPrescription(swPrescription); + } + + /** + * 批量删除处方 + * + * @param ids 需要删除的处方主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteSwPrescriptionByIds(Long[] ids) + { + swPrescriptionMapper.deleteSwPresDetailByPersIds(ids); + return swPrescriptionMapper.deleteSwPrescriptionByIds(ids); + } + + /** + * 删除处方信息 + * + * @param id 处方主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteSwPrescriptionById(Long id) + { + swPrescriptionMapper.deleteSwPresDetailByPersId(id); + return swPrescriptionMapper.deleteSwPrescriptionById(id); + } + + /** + * 新增处方详情信息 + * + * @param swPrescription 处方对象 + */ + public void insertSwPresDetail(SwPrescription swPrescription) + { + List swPresDetailList = swPrescription.getSwPresDetailList(); + Long id = swPrescription.getId(); + if (StringUtils.isNotNull(swPresDetailList)) + { + List list = new ArrayList(); + for (SwPresDetail swPresDetail : swPresDetailList) + { + swPresDetail.setPersId(id); + list.add(swPresDetail); + } + if (list.size() > 0) + { + swPrescriptionMapper.batchSwPresDetail(list); + } + } + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwUnitServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwUnitServiceImpl.java new file mode 100644 index 0000000..513c76d --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwUnitServiceImpl.java @@ -0,0 +1,95 @@ +package com.zhyc.module.biosafety.service.impl; + +import java.util.List; + +import com.zhyc.module.biosafety.domain.SwUnit; +import com.zhyc.module.biosafety.mapper.SwUnitMapper; +import com.zhyc.module.biosafety.service.ISwUnitService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + * 药品单位Service业务层处理 + * + * @author ruoyi + * @date 2025-07-11 + */ +@Service +public class SwUnitServiceImpl implements ISwUnitService +{ + @Autowired + private SwUnitMapper swUnitMapper; + + /** + * 查询药品单位 + * + * @param id 药品单位主键 + * @return 药品单位 + */ + @Override + public SwUnit selectSwUnitById(Long id) + { + return swUnitMapper.selectSwUnitById(id); + } + + /** + * 查询药品单位列表 + * + * @param swUnit 药品单位 + * @return 药品单位 + */ + @Override + public List selectSwUnitList(SwUnit swUnit) + { + return swUnitMapper.selectSwUnitList(swUnit); + } + + /** + * 新增药品单位 + * + * @param swUnit 药品单位 + * @return 结果 + */ + @Override + public int insertSwUnit(SwUnit swUnit) + { + return swUnitMapper.insertSwUnit(swUnit); + } + + /** + * 修改药品单位 + * + * @param swUnit 药品单位 + * @return 结果 + */ + @Override + public int updateSwUnit(SwUnit swUnit) + { + return swUnitMapper.updateSwUnit(swUnit); + } + + /** + * 批量删除药品单位 + * + * @param ids 需要删除的药品单位主键 + * @return 结果 + */ + @Override + public int deleteSwUnitByIds(Long[] ids) + { + return swUnitMapper.deleteSwUnitByIds(ids); + } + + /** + * 删除药品单位信息 + * + * @param id 药品单位主键 + * @return 结果 + */ + @Override + public int deleteSwUnitById(Long id) + { + return swUnitMapper.deleteSwUnitById(id); + } +} diff --git a/zhyc-module/src/main/resources/mapper/biosafety/SwPrescriptionMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/SwPrescriptionMapper.xml new file mode 100644 index 0000000..1bc45df --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/biosafety/SwPrescriptionMapper.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, no, name, pers_type, comment, status, update_by, update_time, create_by, create_time from sw_prescription + + + + + + + + + + insert into sw_prescription + + no, + name, + pers_type, + comment, + status, + update_by, + update_time, + create_by, + create_time, + + + #{no}, + #{name}, + #{persType}, + #{comment}, + #{status}, + #{updateBy}, + #{updateTime}, + #{createBy}, + #{createTime}, + + + + + update sw_prescription + + no = #{no}, + name = #{name}, + pers_type = #{persType}, + comment = #{comment}, + status = #{status}, + update_by = #{updateBy}, + update_time = #{updateTime}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from sw_prescription where id = #{id} + + + + delete from sw_prescription where id in + + #{id} + + + + + delete from sw_pres_detail where pers_id in + + #{persId} + + + + + delete from sw_pres_detail where pers_id = #{persId} + + + + insert into sw_pres_detail( id, pers_id, medi_id, dosage, unit_id, usage_id) values + + ( #{item.id}, #{item.persId}, #{item.mediId}, #{item.dosage}, #{item.unitId}, #{item.usageId}) + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/biosafety/SwUnitMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/SwUnitMapper.xml new file mode 100644 index 0000000..6943c33 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/biosafety/SwUnitMapper.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + select id, name,unit from sw_unit + + + + + + + + insert into sw_unit + + name, + unit, + + + #{name}, + #{unit}, + + + + + update sw_unit + + name = #{name}, + unit = #{unit}, + + where id = #{id} + + + + delete from sw_unit where id = #{id} + + + + delete from sw_unit where id in + + #{id} + + + \ No newline at end of file