Ver código fonte

医生基础字典手术分类和检验试管

lihong 2 meses atrás
pai
commit
7657377742

+ 80 - 0
src/main/java/thyyxxk/webserver/controller/dictionary/DoctorBaseZdController.java

@@ -0,0 +1,80 @@
+package thyyxxk.webserver.controller.dictionary;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.dictionary.DoctorBaseZd;
+import thyyxxk.webserver.service.datamodify.DoctorBaseZdDaoService;
+import thyyxxk.webserver.utils.ResultVoUtil;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2025/5/20
+ */
+@RestController
+@RequestMapping("/doctorBaseZd")
+public class DoctorBaseZdController {
+    @Resource
+    private DoctorBaseZdDaoService service;
+
+    @PostMapping("/queryDoctorBaseZd")
+    public ResultVo<List<DoctorBaseZd>> queryDoctorBaseZd(@RequestBody DoctorBaseZd param){
+        return ResultVoUtil.success(service.queryDoctorBaseZd(param));
+    }
+    @PostMapping("/updateDelFlag")
+    public ResultVo<String> updateDelFlag(@RequestBody DoctorBaseZd param){
+        service.updateDelFlag(param);
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE);
+    }
+
+    @PostMapping("/saveDoctorBaseZd")
+    public ResultVo<String> saveDoctorBaseZd(@RequestBody DoctorBaseZd param){
+        service.saveDoctorBaseZd(param);
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE,"保存成功");
+    }
+
+    /**
+     * @description:保存试管收费
+     * @author: lihong
+     * @date: 2025/5/20 10:09
+     * @param: param
+     * @return: thyyxxk.webserver.entity.ResultVo<java.lang.String>
+     **/
+    @PostMapping("/batchJyZdTubeCharge")
+    public ResultVo<String> batchJyZdTubeCharge(@RequestBody DoctorBaseZd param){
+        service.batchJyZdTubeCharge(param);
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE,"保存成功");
+    }
+
+    @PostMapping("/deleteZdTubeCharge")
+    public ResultVo<String> deleteZdTubeCharge(@RequestBody DoctorBaseZd param){
+        service.deleteZdTubeCharge(param);
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE,"删除成功");
+    }
+
+    @PostMapping("/queryZdItemChargePage")
+    public ResultVo queryZdItemChargePage(@RequestBody DoctorBaseZd param){
+        return service.queryZdItemChargePage(param);
+    }
+
+    /**
+     * @description: 查询试管收费
+     * @author: lihong
+     * @date: 2025/5/20 10:10
+     * @param: code
+     * @return: thyyxxk.webserver.entity.ResultVo
+     **/
+    @GetMapping("/queryJyZdTubeChargeByCode")
+    public ResultVo queryJyZdTubeChargeByCode(String code){
+        return ResultVoUtil.success(service.queryJyZdTubeChargeByCode(code));
+    }
+
+}

+ 100 - 0
src/main/java/thyyxxk/webserver/dao/his/dictionary/DoctorBaseZdDao.java

@@ -0,0 +1,100 @@
+package thyyxxk.webserver.dao.his.dictionary;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import thyyxxk.webserver.entity.dictionary.DoctorBaseZd;
+import thyyxxk.webserver.entity.executeItem.ZdChargeItem;
+
+import java.util.List;
+
+/**
+ * @Description: 医生基础字典维护
+ * @Author:lihong
+ * @Date: 2025/5/20
+ */
+@Mapper
+public interface DoctorBaseZdDao {
+    /**
+     * @description: 查询  jy_zd_tube , ysh_zd_ss_type 字典
+     * @author: lihong
+     * @date: 2025/5/20 9:07
+     * @param: tableName
+     * @param: keyWard
+     * @return: java.util.List<thyyxxk.webserver.entity.dictionary.DoctorBaseZd>
+     **/
+    @Select("<script>" +
+            " select code,code new_code, name, py_code, d_code dCode, case when del_flag is null or del_flag ='' then '0' else del_flag end del_flag " +
+            " from ${tableName} " +
+            " <where>" +
+            " <if test=\" keyWard !=null and keyWard !='' \">" +
+            "<bind name=\"keyWardPatten\" value=\"'%'+keyWard+'%'\" />"+
+            " (code like #{keyWardPatten} or name like #{keyWardPatten} or py_code like #{keyWardPatten} or d_code like #{keyWardPatten}) " +
+            " </if>"+
+            "<if test=\" delFlag =='0'.toString \">"+
+            " and (del_flag is null or del_flag ='' or del_flag ='0') "+
+            "</if>"+
+            "<if test=\" delFlag =='1'.toString \">"+
+            " and del_flag ='1' "+
+            "</if>"+
+            " </where>" +
+            "</script>")
+    List<DoctorBaseZd> selectDoctorBaseZd(DoctorBaseZd doctorBaseZd);
+    /**
+     * @description: 更新删除标识
+     * @author: lihong
+     * @date: 2025/5/20 9:06
+     * @param: doctorBaseZd
+     * @return: int
+     **/
+    @Update(" update ${tableName} set del_flag = #{delFlag,jdbcType = CHAR} where code = #{code,jdbcType = CHAR}")
+    int updateDelFlag(DoctorBaseZd doctorBaseZd);
+
+    @Insert(" insert into  ${tableName} (code, name, del_flag, py_code, d_code) values (#{newCode},#{name},#{delFlag},#{pyCode},#{dCode}) ")
+    int insertDoctorBaseZd(DoctorBaseZd doctorBaseZd);
+    @Insert(" <script>" +
+            "insert into  jy_zd_tube_charge (code,charge_code,amount) values " +
+            " <foreach collection='list' item='item' separator=','>" +
+            " (#{item.code}, #{item.chargeCode}, #{item.amount})" +
+            " </foreach>" +
+            "</script>"
+    )
+    int batchJyZdTubeCharge(List<DoctorBaseZd> list);
+    @Select(" select a.code, " +
+            "       a.charge_code, " +
+            "       a.amount, " +
+            "       b.name, " +
+            "       b.charge_amount, " +
+            "       case when b.del_flag is null or b.del_flag ='' then '0' else b.del_flag end del_flag " +
+            " from jy_zd_tube_charge a,zd_charge_item b " +
+            " where a.charge_code = b.code and " +
+            "        a.code = #{code} ")
+    List<DoctorBaseZd> selectJyZdTubeChargeByCode(String code);
+    @Select(" select count(*) from  ${tableName} where  code = #{code}")
+    Integer countBycode(@Param("code") String code,@Param("tableName")String tableName);
+    @Update(" update ${tableName} set name =#{name},code = #{newCode},py_code=#{pyCode},d_code = #{dCode} where code = #{code}")
+    int updateDoctorBaseZd(DoctorBaseZd param);
+    @Delete("<script>" +
+            " delete from jy_zd_tube_charge where code =#{code}" +
+            " <if test=\" chargeCode !=null and chargeCode!='' \">" +
+            " and charge_code = #{chargeCode}"+
+            " </if>" +
+            "</script>")
+    int deleteJyZdTubeCharge(@Param("code") String code, @Param("chargeCode")String chargeCode);
+    @Select(" <script> " +
+            "select  code,name,charge_unit,charge_amount,self_flag,separate_flag,suppress_flag  " +
+            " from zd_charge_item  " +
+            " where (del_flag is null  " +
+            "    or del_flag = ''  " +
+            "    or del_flag = '0')  " +
+            "<if test=\" param.keyWard !=null and param.keyWard!='' \">"+
+            " <bind name=\"keyWardPatten\" value=\"'%'+param.keyWard+'%'\" />"+
+            "  and (code like #{keyWardPatten} or name like #{keyWardPatten} or py_code like #{keyWardPatten} or d_code like #{keyWardPatten})" +
+            " </if>" +
+            " </script> " )
+    List<ZdChargeItem> selectZdItemChargePage(@Param("page")IPage<ZdChargeItem> page, @Param("param")DoctorBaseZd param);
+}

+ 42 - 0
src/main/java/thyyxxk/webserver/entity/dictionary/DoctorBaseZd.java

@@ -0,0 +1,42 @@
+package thyyxxk.webserver.entity.dictionary;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @Description: 医生基础字典  jy_zd_tube ysh_zd_ss_type
+ * @Author:lihong
+ * @Date: 2025/5/20
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class DoctorBaseZd {
+
+    private String code;
+    private String newCode;
+    private String name;
+    private String pyCode;
+    private String dCode;
+    private String delFlag;
+    //项目收费编码 zd_charge_item
+    private String chargeCode;
+    //收费数量
+    private Integer amount;
+    private Integer currentPage;
+    private Integer pageSize;
+    //收费金额
+    private BigDecimal chargeAmount;
+    //表名 jy_zd_tube , ysh_zd_ss_type
+     private String tableName;
+     private String keyWard;
+     private boolean isEdit;
+
+    List<DoctorBaseZd> saveData;
+}

+ 111 - 0
src/main/java/thyyxxk/webserver/service/datamodify/DoctorBaseZdDaoService.java

@@ -0,0 +1,111 @@
+package thyyxxk.webserver.service.datamodify;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import thyyxxk.webserver.config.exception.BizException;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.dao.his.dictionary.DoctorBaseZdDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.dictionary.DoctorBaseZd;
+import thyyxxk.webserver.entity.executeItem.ZdChargeItem;
+import thyyxxk.webserver.utils.AssertUtil;
+import thyyxxk.webserver.utils.CommonUtil;
+import thyyxxk.webserver.utils.PingYinUtils;
+import thyyxxk.webserver.utils.ResultVoUtil;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2025/5/20
+ */
+@Service
+@Slf4j
+public class DoctorBaseZdDaoService {
+    @Resource
+    private DoctorBaseZdDao dao;
+
+    public List<DoctorBaseZd> queryDoctorBaseZd(DoctorBaseZd param) {
+        AssertUtil.isnotBlank(param.getTableName(), "表名不能为空");
+        if(StrUtil.isNotBlank(param.getKeyWard())){
+            param.setKeyWard(param.getKeyWard().toUpperCase());
+        }
+        return dao.selectDoctorBaseZd(param);
+    }
+
+    public int updateDelFlag(DoctorBaseZd param){
+        return dao.updateDelFlag(param);
+    }
+
+    public List<DoctorBaseZd> queryJyZdTubeChargeByCode(String code) {
+        List<DoctorBaseZd> doctorBaseZds = dao.selectJyZdTubeChargeByCode(code);
+        CommonUtil.BeanTrim(doctorBaseZds);
+        return doctorBaseZds;
+    }
+
+    public int saveDoctorBaseZd(DoctorBaseZd param){
+        AssertUtil.isnotBlank(param.getName(),"名称不能为空");
+        AssertUtil.isnotBlank(param.getTableName(),"表名不能为空");
+        AssertUtil.isnotBlank(param.getNewCode(),"编码不能为空");
+        //修改
+        param.setPyCode(PingYinUtils.pyShouZiMuDaXie(param.getName()));
+        param.setDCode(PingYinUtils.getWBCode(param.getName()));
+        if(StrUtil.isNotBlank(param.getCode())){
+            return dao.updateDoctorBaseZd(param);
+        }
+        //新增
+        Integer count = dao.countBycode(param.getNewCode(),param.getTableName());
+        if(count > 0){
+            throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR, "该编码已经存在");
+        }
+        param.setDelFlag("0");
+        return dao.insertDoctorBaseZd(param);
+    }
+    @Transactional(rollbackFor = Exception.class)
+    public int batchJyZdTubeCharge(DoctorBaseZd param){
+        AssertUtil.isnotBlank(param.getSaveData(),"保存的试管收费数据不能为空");
+        AssertUtil.isnotBlank(param.getCode(),"保存的试管编码不能为空");
+        for(DoctorBaseZd doctorBaseZd: param.getSaveData()){
+            AssertUtil.isnotBlank(doctorBaseZd,"试管收费数据不能为空");
+            AssertUtil.isnotBlank(doctorBaseZd.getChargeCode(),"试管收费编码不能为空");
+            AssertUtil.isnotBlank(doctorBaseZd.getAmount(),"试管收费数量不能为空");
+            doctorBaseZd.setCode(param.getCode());
+        }
+        Map<String, List<DoctorBaseZd>> chargeCodeMap = param.getSaveData().stream().collect(Collectors.groupingBy(DoctorBaseZd::getChargeCode));
+        for(String chargeCode : chargeCodeMap.keySet()){
+            if(chargeCodeMap.get(chargeCode).size() > 1){
+                throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR, "收费编码为[" + chargeCode + "]项目有重复!");
+            }
+        }
+        dao.deleteJyZdTubeCharge(param.getCode(),null);
+        return dao.batchJyZdTubeCharge(param.getSaveData());
+    }
+
+    public int deleteZdTubeCharge(DoctorBaseZd param) {
+        AssertUtil.isnotBlank(param.getCode(),"试管组编码不能为空");
+        AssertUtil.isnotBlank(param.getChargeCode(),"收费编码不能为空");
+        return dao.deleteJyZdTubeCharge(param.getCode(),param.getChargeCode());
+    }
+
+    public ResultVo queryZdItemChargePage(DoctorBaseZd param) {
+        IPage page = new Page(param.getCurrentPage(), param.getPageSize());
+        Map<String, Object> res = new HashMap<>(10);
+        if(StrUtil.isNotBlank(param.getKeyWard())){
+            param.setKeyWard(param.getKeyWard().toUpperCase());
+        }
+        List<ZdChargeItem> list = dao.selectZdItemChargePage(page,param);
+        CommonUtil.BeanTrim(list);
+        res.put("data", list);
+        res.put("total", page.getTotal());
+      return ResultVoUtil.success(res);
+    }
+}