Bladeren bron

Merge branch 'master' into 'master'

新增药品账页维护

See merge request lighter/web-server!74
huangshuhua 1 jaar geleden
bovenliggende
commit
89936390df

+ 11 - 0
src/main/java/thyyxxk/webserver/controller/yp/YpDictController.java

@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.inpatient.YpZdDict;
 import thyyxxk.webserver.entity.yp.YpZdChargeGroup;
 import thyyxxk.webserver.entity.yp.YpZdClass;
 import thyyxxk.webserver.entity.yp.YpZdDosage;
@@ -152,4 +153,14 @@ public class YpDictController {
         return service.delYpManuFactoryByCode(code);
     }
 
+    @GetMapping("/selectYpDict")
+    public ResultVo<List<YpZdDict>> selectYpDict(@RequestParam("text") String text){
+        return service.selectYpDict(text);
+    }
+
+    @GetMapping("/updateYpStopOrUsed")
+    public ResultVo<Map<String, Object>> updateYpStopOrUsed(@RequestParam("code") String code, @RequestParam("delFlag") String delFlag){
+        return service.updateYpStopOrUsed(code, delFlag);
+    }
+
 }

+ 24 - 1
src/main/java/thyyxxk/webserver/dao/his/yp/YpDictDao.java

@@ -1,15 +1,17 @@
 package thyyxxk.webserver.dao.his.yp;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 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.inpatient.YpZdDict;
 
 import java.util.List;
 import java.util.Map;
 
 @Mapper
-public interface YpDictDao {
+public interface YpDictDao extends BaseMapper<YpZdDict> {
 
     @Select(" select yf.charge_code as chargeCode,  " +
             " yf.serial,  " +
@@ -36,4 +38,25 @@ public interface YpDictDao {
     int updateYpVisibleFlag(@Param("chargeCode") String chargeCode, @Param("serial") String serial, @Param("groupNo") String groupNo,
                             @Param("visibleFlagMz") String visibleFlagMz, @Param("visibleFlagZy") String visibleFlagZy);
 
+    @Select(" select rtrim(zd.code) as code,  " +
+            " zd.serial,  " +
+            " rtrim(zd.name) as name,  " +
+            " zd.specification,  " +
+            " zd.pack_retprice as packRetprice,  " +
+            " isnull(zd.del_flag, '0') as delFlag,  " +
+            " zd.py_code as pyCode, " +
+            " zd.d_code as dCode " +
+            " from yp_zd_dict as zd " +
+            " where zd.code like '%${text}%' or zd.name like '%${text}%'  " +
+            " or zd.py_code like ('%' + upper(#{text}) + '%') " +
+            " or zd.d_code like ('%' + upper(#{text}) + '%') " +
+            " order by zd.code ")
+    List<YpZdDict> selectYpDict(@Param("text") String text);
+
+    @Select(" select * from yp_zd_dict where code = #{code} ")
+    YpZdDict selectYpDictByCode(@Param("code") String code);
+
+    @Update(" update yp_zd_dict set del_flag = #{delFlag} where code = #{code} ")
+    int updateYpDictDelFlagByCode(@Param("code") String code, @Param("delFlag") String delFlag);
+
 }

+ 43 - 0
src/main/java/thyyxxk/webserver/service/yp/YpDictService.java

@@ -12,6 +12,7 @@ import thyyxxk.webserver.dao.his.yp.YpZdManuFactoryDao;
 import thyyxxk.webserver.dao.his.yp.YpZdSupplyDao;
 import thyyxxk.webserver.dao.his.yp.YpZdUnitDao;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.inpatient.YpZdDict;
 import thyyxxk.webserver.entity.yp.YpZdChargeGroup;
 import thyyxxk.webserver.entity.yp.YpZdClass;
 import thyyxxk.webserver.entity.yp.YpZdDosage;
@@ -616,4 +617,46 @@ public class YpDictService {
         }
     }
 
+    /**
+     * @Description 查询药品账页字典
+     * @Author hsh
+     * @param text 关键字
+     * @return YpZdDict 药品账页字典信息
+     * @Date 2024/1/9 15:37
+     */
+    public ResultVo<List<YpZdDict>> selectYpDict(String text){
+        return ResultVoUtil.success(dao.selectYpDict(text));
+    }
+
+    /**
+     * @Description 药品账页字典更新delFlag(是否停用)标志
+     * @Author hsh
+     * @param code 药品编码,delFlag 停用状态(1:停用)
+     * @return map
+     * @Date 2024/1/9 16:07
+     */
+    public ResultVo<Map<String, Object>> updateYpStopOrUsed(String code, String delFlag){
+        if(StringUtil.isBlank(code)) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有药品编码,请检查!");
+        }
+
+        YpZdDict yp = dao.selectYpDictByCode(code);
+        if(null == yp){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "药品编码(" + code + ")的药品账页字典信息不存在,请检查!");
+        }
+
+        Map<String, Object> resultMap = new HashMap<>();
+        try{
+            int num = dao.updateYpDictDelFlagByCode(code, delFlag);
+            if(num == 0){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新药品账页字典停用或启用失败!");
+            }
+            resultMap.put("cg", "更新药品账页字典停用或启用成功!");
+            return ResultVoUtil.success(resultMap);
+        } catch(Exception e){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新药品账页字典停用或启用失败!");
+        }
+
+    }
+
 }