ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
@@ -567,7 +567,7 @@ return AjaxResult.success(tjCustomer); } } return null; return AjaxResult.error(object.getStr("ResultContent")); } /** @@ -622,7 +622,7 @@ // hisApiGetMethodService.save(object, "Outpincreateapply", hisApiConfig, JSONUtil.toJsonStr(BeanUtil.beanToMap(tjCustomer))); return AjaxResult.success(); } return AjaxResult.error(); return AjaxResult.error(object.getStr("ResultContent")); } return AjaxResult.success(); } ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjZhxmController.java
New file @@ -0,0 +1,162 @@ package com.ltkj.web.controller.system;/* * @作者 zjh * @时间 2024-06-26 9:44 * */ import cn.hutool.extra.pinyin.PinyinUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ltkj.common.annotation.Log; import com.ltkj.common.core.controller.BaseController; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.enums.BusinessType; import com.ltkj.hosp.domain.*; import com.ltkj.hosp.dto.QianDaoDto; import com.ltkj.hosp.service.ITjProjectService; import com.ltkj.hosp.service.TjZhxmService; import com.ltkj.hosp.service.TjZhxmglproService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @RestController @RequestMapping("/system/zhxm") @Api(tags = "PC端组合项目相关接口") @Slf4j public class TjZhxmController extends BaseController { @Autowired private TjZhxmglproService tjZhxmglproService; @Autowired private TjZhxmService zhxmService; @Resource private ITjProjectService tjProjectService; @Log(title = "体检组合项目", businessType = BusinessType.INSERT) @PostMapping @ApiOperation(value = "新增体检组合") @Transactional public AjaxResult add(@RequestBody @ApiParam(value = "体检组合对象") TjZhxm zhxm) { LambdaQueryWrapper<TjZhxm> wq = new LambdaQueryWrapper<>(); wq.eq(TjZhxm::getZhmc, zhxm.getZhmc()); TjZhxm one = zhxmService.getOne(wq); if (null != one) { return AjaxResult.error("该组合已存在,不可重复添加!"); } zhxm.setPym(PinyinUtil.getFirstLetter(zhxm.getZhmc(), "")); if (zhxmService.save(zhxm)) { List<TjZhxmglpro> zhxmglpros = zhxm.getZhxmglpros(); if (null != zhxmglpros && zhxmglpros.size() > 0) { for (TjZhxmglpro zhxmglpro : zhxmglpros) { TjZhxmglpro pro = new TjZhxmglpro(); pro.setZhId(zhxm.getId()); pro.setProId(zhxmglpro.getProId()); tjZhxmglproService.save(pro); } } return AjaxResult.success(); } return AjaxResult.error("新增失败"); } /** * 修改体检组合 */ @Log(title = "体检组合", businessType = BusinessType.UPDATE) @PutMapping @ApiOperation(value = "修改体检组合") @Transactional public AjaxResult edit(@RequestBody @ApiParam(value = "体检组合对象") TjZhxm zhxm) { zhxm.setPym(PinyinUtil.getFirstLetter(zhxm.getZhmc(), "")); if (zhxmService.updateById(zhxm)) { List<TjZhxmglpro> zhxmglpros = zhxm.getZhxmglpros(); if (null != zhxmglpros && zhxmglpros.size() > 0) { LambdaQueryWrapper<TjZhxmglpro> wq = new LambdaQueryWrapper<>(); wq.eq(TjZhxmglpro::getZhId, zhxm.getId()); tjZhxmglproService.remove(wq); for (TjZhxmglpro zhxmglpro : zhxmglpros) { TjZhxmglpro pro = new TjZhxmglpro(); pro.setZhId(zhxm.getId()); pro.setProId(zhxmglpro.getProId()); tjZhxmglproService.save(pro); } } return AjaxResult.success(); } return AjaxResult.error(); } @GetMapping("/listByZhId") @ApiOperation(value = "根据组合id获取体检组合详细信息") public AjaxResult listByZhId(@ApiParam(value = "体检组合id") @RequestParam Long zhId) { if (zhId != null) { TjZhxm zhxm = zhxmService.getById(zhId); if (null != zhxm) { LambdaQueryWrapper<TjZhxmglpro> wq = new LambdaQueryWrapper<>(); wq.eq(TjZhxmglpro::getZhId, zhxm.getId()); List<TjZhxmglpro> list = tjZhxmglproService.list(wq); StringBuilder allName = new StringBuilder(); // StringBuilder allSonName = new StringBuilder(); if (null != list && list.size() > 0) { List<TjProject> projectList = new ArrayList<>(); for (TjZhxmglpro zhxmglpro : list) { LambdaQueryWrapper<TjProject> wq1 = new LambdaQueryWrapper<>(); wq1.eq(TjProject::getProId, zhxmglpro.getProId()); wq1.eq(TjProject::getProParentId, 0); if (null != tjProjectService.getOne(wq1)) { projectList.add(tjProjectService.getOne(wq1)); allName.append(tjProjectService.getOne(wq1).getProName()).append(";"); } } zhxm.setAllProName(allName.toString()); // for (TjProject tjProject : projectList) { // LambdaQueryWrapper<TjProject> wq2 = new LambdaQueryWrapper<>(); // wq2.eq(TjProject::getProParentId, tjProject.getProId()); // tjProject.setTjProjectList(tjProjectService.list(wq2)); // for (TjProject project : tjProjectService.list(wq2)) { // allSonName.append(project.getProName()).append(";"); // } // tjProject.setAllSonProName(allSonName.toString()); // } zhxm.setZhxmglpros(list); return AjaxResult.success(zhxm); } } return success("暂时没有数据"); } return error("组合ID不能为空"); } @DeleteMapping("/{zhIds}") @ApiOperation(value = "删除体检组合") public AjaxResult remove(@PathVariable Long[] zhIds) { if (null != zhIds && zhIds.length > 0) { for (Long zhId : zhIds) { TjZhxm byId = zhxmService.getById(zhId); if (zhxmService.removeById(byId)) { LambdaQueryWrapper<TjZhxmglpro> wq = new LambdaQueryWrapper<>(); wq.eq(TjZhxmglpro::getZhId,zhId); tjZhxmglproService.remove(wq); } } return AjaxResult.success("删除成功"); } return AjaxResult.error("请选择要删除的组合"); } } ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjZhxm.java
New file @@ -0,0 +1,39 @@ package com.ltkj.hosp.domain;/* * @作者 zjh * @时间 2024-06-26 9:06 * */ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.ltkj.common.core.domain.BaseEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data public class TjZhxm extends BaseEntity { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键id") @TableId(type = IdType.AUTO) @JsonSerialize(using = ToStringSerializer.class) private Long id; private String zhmc; private String pym; private Integer xh; @TableField(exist = false) private List<TjZhxmglpro> zhxmglpros; @ApiModelProperty(value = "组合中所有子项目集合") @TableField(exist = false) private String allSonName; @ApiModelProperty(value = "父项目名称字符串") @TableField(exist = false) private String allProName; } ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjZhxmglpro.java
New file @@ -0,0 +1,27 @@ package com.ltkj.hosp.domain;/* * @作者 zjh * @时间 2024-06-26 9:30 * */ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; @Data public class TjZhxmglpro implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键id") @TableId(type = IdType.AUTO) @JsonSerialize(using = ToStringSerializer.class) private Long id; @JsonSerialize(using = ToStringSerializer.class) private Long zhId; @JsonSerialize(using = ToStringSerializer.class) private Long proId; } ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjZhxmMapper.java
New file @@ -0,0 +1,12 @@ package com.ltkj.hosp.mapper;/* * @作者 zjh * @时间 2024-06-26 9:35 * */ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ltkj.hosp.domain.TjZhxm; import org.apache.ibatis.annotations.Mapper; @Mapper public interface TjZhxmMapper extends BaseMapper<TjZhxm> { } ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjZhxmglproMapper.java
New file @@ -0,0 +1,12 @@ package com.ltkj.hosp.mapper;/* * @作者 zjh * @时间 2024-06-26 9:38 * */ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ltkj.hosp.domain.TjZhxmglpro; import org.apache.ibatis.annotations.Mapper; @Mapper public interface TjZhxmglproMapper extends BaseMapper<TjZhxmglpro> { } ltkj-hosp/src/main/java/com/ltkj/hosp/service/TjZhxmService.java
New file @@ -0,0 +1,10 @@ package com.ltkj.hosp.service;/* * @作者 zjh * @时间 2024-06-26 9:36 * */ import com.baomidou.mybatisplus.extension.service.IService; import com.ltkj.hosp.domain.TjZhxm; public interface TjZhxmService extends IService<TjZhxm> { } ltkj-hosp/src/main/java/com/ltkj/hosp/service/TjZhxmglproService.java
New file @@ -0,0 +1,10 @@ package com.ltkj.hosp.service;/* * @作者 zjh * @时间 2024-06-26 9:38 * */ import com.baomidou.mybatisplus.extension.service.IService; import com.ltkj.hosp.domain.TjZhxmglpro; public interface TjZhxmglproService extends IService<TjZhxmglpro> { } ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjZhxmServiceImpl.java
New file @@ -0,0 +1,14 @@ package com.ltkj.hosp.service.impl;/* * @作者 zjh * @时间 2024-06-26 9:36 * */ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ltkj.hosp.domain.TjZhxm; import com.ltkj.hosp.mapper.TjZhxmMapper; import com.ltkj.hosp.service.TjZhxmService; import org.springframework.stereotype.Service; @Service public class TjZhxmServiceImpl extends ServiceImpl<TjZhxmMapper, TjZhxm> implements TjZhxmService { } ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjZhxmglproServiceImpl.java
New file @@ -0,0 +1,14 @@ package com.ltkj.hosp.service.impl;/* * @作者 zjh * @时间 2024-06-26 9:39 * */ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ltkj.hosp.domain.TjZhxmglpro; import com.ltkj.hosp.mapper.TjZhxmglproMapper; import com.ltkj.hosp.service.TjZhxmglproService; import org.springframework.stereotype.Service; @Service public class TjZhxmglproServiceImpl extends ServiceImpl<TjZhxmglproMapper, TjZhxmglpro> implements TjZhxmglproService { }