Bläddra i källkod

药房特殊标志维护

WANGJIALIANG 4 år sedan
förälder
incheckning
359ee50b23

+ 13 - 0
src/main/java/cn/hnthyy/thmz/controller/NavigationController.java

@@ -813,4 +813,17 @@ public class NavigationController {
         }
         return "yf/yf_divide";
     }
+
+    /**
+     * 药房药品特殊标志维护
+     * @return
+     */
+    @RequestMapping("/yf-special-mark")
+    public String yfSpecialMark(HttpServletRequest httpServletRequest) throws Exception {
+        List<String> urls = getRoleUrls(httpServletRequest);
+        if (!urls.contains("/thmz/yf-special-mark")) {
+            throw new Exception("您没有此模块的权限,请联系管理员开通!");
+        }
+        return "yf/yf_special_mark";
+    }
 }

+ 262 - 0
src/main/java/cn/hnthyy/thmz/controller/yf/YfSpecialMarkController.java

@@ -0,0 +1,262 @@
+package cn.hnthyy.thmz.controller.yf;
+
+import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.his.YpBaseYf;
+import cn.hnthyy.thmz.entity.his.YpZdYpbh;
+import cn.hnthyy.thmz.entity.his.mz.YpZdClass;
+import cn.hnthyy.thmz.service.his.YpBaseYfService;
+import cn.hnthyy.thmz.service.his.YpZdYpbhService;
+import cn.hnthyy.thmz.service.his.mz.YpZdClassService;
+import cn.hnthyy.thmz.service.his.yf.YfSpecialMarkService;
+import cn.hnthyy.thmz.vo.YpZdBaseYfSpecialVo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description:药房特殊标志维护
+ * @author: WANGJIALIANG
+ * @time: 2021/9/18 10:38
+ */
+@Slf4j
+@RestController
+public class YfSpecialMarkController {
+
+    @Autowired
+    private YfSpecialMarkService yfSpecialMarkService;
+    @Autowired
+    private YpZdYpbhService ypZdYpbhService;
+    @Autowired
+    private YpZdClassService ypZdClassService;
+    @Autowired
+    private YpBaseYfService ypBaseYfService;
+
+    /**
+     * 药房特殊标志维护信息
+     * @param groupNo
+     * @param searchText
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getYpSpecialMark",method = {RequestMethod.GET,RequestMethod.POST})
+    public Map<String,Object> getYpSpecialMark(@RequestParam(value = "groupNo") String groupNo,@RequestParam(value = "searchText") String searchText){
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (StringUtils.isBlank(groupNo)) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询药房特殊标志维护信息失败,药房编码为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(searchText)) {
+                resultMap.put("code", 0);
+                return resultMap;
+            }
+            if(searchText.matches("[a-zA-Z]+")){
+                searchText = searchText.toUpperCase();
+            }
+            List<YpZdBaseYfSpecialVo> ypZdBaseYfSpecialVos = yfSpecialMarkService.queryYpSpecialMark(groupNo, searchText);
+            ypZdBaseYfSpecialVos.forEach(ypZdBaseYfSpecialVo ->{
+                List<YpZdClass> ypZdClasses = ypZdClassService.queryYpZdClassesByCode(ypZdBaseYfSpecialVo.getClassCode());
+                if(ypZdClasses.size() > 0){
+                    ypZdBaseYfSpecialVo.setClassName(ypZdClasses.get(0).getName());
+                }
+            });
+            resultMap.put("code", 0);
+            resultMap.put("message", "查询药房特殊标志维护信息成功");
+            resultMap.put("data", ypZdBaseYfSpecialVos);
+            return resultMap;
+        } catch (Exception e) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询药房特殊标志维护信息失败");
+            return resultMap;
+        }
+    }
+
+    /**
+     * 更新药房特殊标志维护
+     * @param ypBaseYf
+     * @return
+     */
+    @RequestMapping(value = "/modifYpSpecialMark",method = {RequestMethod.POST,RequestMethod.GET})
+    public Map<String,Object> modifYpSpecialMark(YpBaseYf ypBaseYf){
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+           if (ypBaseYf == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新药房特殊标志维护信息失败,药参数为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(ypBaseYf.getChargeCode())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新药房特殊标志维护信息失败,药品编码为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(ypBaseYf.getSerial())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新药房特殊标志维护信息失败,药品规格序号为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(ypBaseYf.getGroupNo())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新药房特殊标志维护信息失败,药房编码为空");
+                return resultMap;
+            }
+            int i = ypBaseYfService.modifyYpBaseYf(ypBaseYf);
+            if(i == 0){
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新药房特殊标志维护信息失败");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "更新药房特殊标志维护信息成功");
+            return resultMap;
+        } catch (Exception e) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "更新药房特殊标志维护信息失败");
+            return resultMap;
+        }
+    }
+
+    /**
+     * 药品批次查询
+     * @param chargeCode
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getYpZdYpbh",method = {RequestMethod.GET})
+    public Map<String,Object> getYpZdYpbh(@RequestParam(value = "chargeCode") String chargeCode){
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (StringUtils.isBlank(chargeCode)) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询药品批次失败,药品编码为空");
+                return resultMap;
+            }
+            List<YpZdYpbh> ypZdYpbhs = ypZdYpbhService.queryYpZdYpbhByChargeCode(chargeCode);
+            resultMap.put("code", 0);
+            resultMap.put("message", "查询药品批次成功");
+            resultMap.put("data", ypZdYpbhs);
+            return resultMap;
+        } catch (Exception e) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询药品批次失败");
+            return resultMap;
+        }
+    }
+
+    /**
+     * 更新药品批次
+     * @param ypZdYpbh
+     * @return
+     */
+    @RequestMapping(value = "/modifYpZdYpbh",method = {RequestMethod.POST,RequestMethod.GET})
+    public Map<String,Object> modifYpZdYpbh(YpZdYpbh ypZdYpbh){
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (ypZdYpbh == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新药品批次维护信息失败,药参数为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(ypZdYpbh.getChargeCode())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新药品批次维护信息失败,药品编码为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(ypZdYpbh.getYpbh())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新药品批次维护信息失败,药品批次为空");
+                return resultMap;
+            }
+            int i = ypZdYpbhService.modifYpZdYpbh(ypZdYpbh);
+            if(i == 0){
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新药品批次维护信息失败");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "更新药品批次维护信息成功");
+            return resultMap;
+        } catch (Exception e) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "更新药品批次维护信息失败");
+            return resultMap;
+        }
+    }
+
+    /**
+     * 新增药品批次
+     * @param ypZdYpbh
+     * @return
+     */
+    @RequestMapping(value = "/addYpZdYpbh",method = {RequestMethod.POST})
+    public Map<String,Object> addYpZdYpbh(@RequestBody YpZdYpbh ypZdYpbh){
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (ypZdYpbh == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "新增药品批次维护信息失败,药参数为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(ypZdYpbh.getChargeCode())) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "新增药品批次维护信息失败,药品编码为空");
+                return resultMap;
+            }
+            int i = ypZdYpbhService.addYpZdYpbh(ypZdYpbh);
+            if(i == 0){
+                resultMap.put("code", -1);
+                resultMap.put("message", "新增药品批次维护信息失败");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "新增药品批次维护信息成功");
+            return resultMap;
+        } catch (Exception e) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "新增药品批次维护信息失败");
+            return resultMap;
+        }
+    }
+
+    /**
+     * 删除药品批次
+     * @param chargeCode
+     * @param ypbh
+     * @return
+     */
+    @RequestMapping(value = "/removeYpZdYpbh",method = {RequestMethod.GET})
+    public Map<String,Object> removeYpZdYpbh(@RequestParam("chargeCode") String chargeCode,@RequestParam("ypbh") String ypbh){
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (StringUtils.isBlank(chargeCode)) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "删除药品批次维护信息失败,药品编码为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(ypbh)) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "删除药品批次维护信息失败,药品批号为空");
+                return resultMap;
+            }
+            int i = ypZdYpbhService.removeYpZdYpbh(chargeCode, ypbh);
+            if(i == 0){
+                resultMap.put("code", -1);
+                resultMap.put("message", "删除药品批次维护信息失败");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "删除药品批次维护信息成功");
+            return resultMap;
+        } catch (Exception e) {
+            resultMap.put("code", -1);
+            resultMap.put("message", "删除药品批次维护信息失败");
+            return resultMap;
+        }
+    }
+}

+ 33 - 0
src/main/java/cn/hnthyy/thmz/entity/his/YpZdYpbh.java

@@ -0,0 +1,33 @@
+package cn.hnthyy.thmz.entity.his;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ *药品批次
+ */
+@Data
+public class YpZdYpbh {
+
+	/**
+	 * 药品编码
+	 */
+  private String chargeCode;
+	/**
+	 * 药品批号
+	 */
+  private String ypbh;
+	/**
+	 * 是否停用 0:否 1:是
+	 */
+  private String usingFlag;
+	/**
+	 * 入库时间
+	 */
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone="GMT+8")
+  private Date fDate;
+}

+ 60 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/YpZdYpbhMapper.java

@@ -0,0 +1,60 @@
+package cn.hnthyy.thmz.mapper.his;
+
+import cn.hnthyy.thmz.entity.his.YpZdYpbh;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.List;
+
+/**
+ * @description:药品批次
+ * @author: WANGJIALIANG
+ * @time: 2021/9/24 8:15
+ */
+public interface YpZdYpbhMapper {
+
+    /**
+     * 查询药品批次信息
+     * @param chargeCode
+     * @return
+     */
+    @Select("  SELECT using_flag,charge_code,ypbh,f_date FROM yp_zd_ypbh where charge_code = #{chargeCode} order by f_date desc")
+    List<YpZdYpbh> selectYpZdYpbhByChargeCode(@Param("chargeCode") String chargeCode);
+
+    /**
+     * 更新药品批次信息
+     * @return
+     */
+    @Update({"<script>",
+        "update yp_zd_ypbh ",
+        "<trim prefix='set' prefixOverrides=',' suffix=' where charge_code = #{chargeCode} and ypbh = #{ypbh} ' >",
+        "<when test='usingFlag!=null'>",
+        "using_flag =#{usingFlag,jdbcType=INTEGER}",
+        "</when>",
+        "<when test='fDate!=null'>",
+        ",f_date =#{fDate,jdbcType=TIMESTAMP}",
+        "</when>",
+        "</trim>",
+        "</script>"})
+    int updateYpZdYpbh(YpZdYpbh ypZdYpbh);
+
+    /**
+     * 新增药品批次信息
+     * @return
+     */
+    @Update({"<script>",
+        "insert into yp_zd_ypbh (charge_code,ypbh,using_flag,f_date) values(#{chargeCode},#{ypbh},#{usingFlag},#{fDate})",
+        "</script>"})
+    int insertYpZdYpbh(YpZdYpbh ypZdYpbh);
+
+    /**
+     * 删除药品批次信息
+     * @param chargeCode
+     * @param ypbh
+     * @return
+     */
+    @Delete("delete yp_zd_ypbh where charge_code = #{chargeCode} and ypbh =#{ypbh}")
+    int deleteYpZdYpbh(@Param("chargeCode") String chargeCode,@Param("ypbh") String ypbh);
+}

+ 99 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/yf/YfSpecialMarkMapper.java

@@ -0,0 +1,99 @@
+package cn.hnthyy.thmz.mapper.his.yf;
+
+import cn.hnthyy.thmz.vo.YpZdBaseYfSpecialVo;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+/**
+ * 药房特殊标志维护
+ */
+public interface YfSpecialMarkMapper {
+    /**
+     * 查询药品信息
+     * @param groupNo
+     * @param searchText
+     * @return
+     */
+    @Select({"<script>" +
+            "select  c.charge_code," +
+                    "serial=c.serial," +
+                    "name = max(yp_zd_dict.name)," +
+                    " class_code = max(yp_zd_dict.class_code)," +
+                    " specification =max(yp_zd_dict.specification)," +
+                    " manufactory_name=max(d.name)," +
+                    " pack_size = max(yp_zd_dict.pack_size) ," +
+                    " visible_flag_mz=max(c.visible_flag_mz)," +
+                    " visible_flag_zy=max(c.visible_flag_zy)," +
+                    " visible_flag_mz_b=max(c.visible_flag_mz)," +
+                    " visible_flag_zy_b=max(c.visible_flag_zy)," +
+                    " jsy_flag = max(c.jsy_flag)," +
+                    " jsy_flag_b=max(c.jsy_flag)," +
+                    " group_no=max(c.group_no)," +
+                    " stock_amount = max(c.stock_amount)," +
+                    " stock_amount_large=(select sum(case when x.serial <![CDATA[<]]> z.serial then x.stock_amount/z.pack_size else x.stock_amount end)" +
+                    " from  (select a.name,a.code,a.serial,a.specification,a.pack_size" +
+                    " from yp_zd_dict a," +
+                    " (select code,max(serial) serial from yp_zd_dict group by code) b" +
+                    " where a.code=b.code and a.serial=b.serial) z," +
+                    "   yp_base_yf x" +
+                    "   where z.code=x.charge_code and" +
+                    "   x.charge_code=c.charge_code and" +
+                    "   x.group_no =#{groupNo})," +
+                    "   visible_flag_stop = max(c.visible_flag_stop)," +
+                    "   stock_amount_virtual2=max(c.stock_amount_virtual2)," +
+                    "   open_virtual2 = max(c.open_virtual2)," +
+                    "   three_day_dosage=isnull(round(sum(case when datediff(day,confirm_time,getdate()) <![CDATA[>]]> 3 then 0 else quantity end),2),0)," +
+                    "   seven_day_dosage=isnull(round(sum(case when datediff(day,confirm_time,getdate())  <![CDATA[>]]> 7 then 0 else quantity end),2),0)," +
+                    "   fourteen_day_dosage=isnull(round(sum(case when datediff(day,confirm_time,getdate())  <![CDATA[>]]> 14 then 0 else quantity end),2),0)," +
+                    "   thirty_day_dosage=isnull(round(sum(case when datediff(day,confirm_time,getdate())  <![CDATA[>]]> 30 then 0 else quantity end),2),0)" +
+                    " FROM yp_zd_dict," +
+                    "     (select charge_code" +
+                    "      from yp_print_name" +
+                    "      where (py_code like '%${searchText}%' or" +
+                    "          d_code  like '%${searchText}%'  or" +
+                    "          charge_code  like '%${searchText}%' or" +
+                    "          print_name  like '%${searchText}%')" +
+                    "      group by charge_code)b," +
+                    "     yp_base_yf c ," +
+                    "     yp_zd_manufactory d," +
+                    "     (select" +
+                    "        c.name," +
+                    "        a.charge_item_code code," +
+                    "        c.serial," +
+                    "        round(sum(case when a.serial  <![CDATA[<]]> c.serial then quantity*cy_fy/pack_size else quantity*cy_fy end),2) quantity," +
+                    "        a.confirm_time" +
+                    "      from yp_mz_fytj a," +
+                    "           (select name =max(name),code,serial =max(serial),specification =max(specification),pack_size=max(pack_size) from yp_zd_dict group by code) c" +
+                    "      where a.charge_item_code=c.code and" +
+                    "          datediff(day,confirm_time,getdate())  <![CDATA[<]]> 31 and" +
+                    "          a.group_no=#{groupNo}" +
+                    "      group by c.name,a.charge_item_code,c.serial,a.confirm_time" +
+                    "      union all" +
+                    "      select" +
+                    "        c.name," +
+                    "        a.charge_code code," +
+                    "        c.serial," +
+                    "        round(sum(case when a.serial <![CDATA[<]]>  c.serial then amount/pack_size else amount end),2) quantity," +
+                    "        a.confirm_time" +
+                    "      from yp_zy_patient a," +
+                    "      (select name =max(name),code,serial =max(serial),specification =max(specification),pack_size=max(pack_size) from yp_zd_dict group by code) c" +
+                    "      where a.charge_code=c.code and" +
+                    "          datediff(day,confirm_time,getdate()) <![CDATA[<]]> 31 and" +
+                    "          a.group_no=#{groupNo}" +
+                    "      group by c.name,a.charge_code,c.serial,a.confirm_time) cc" +
+                    " where yp_zd_dict.code = b.charge_code and" +
+                    "      yp_zd_dict.code=c.charge_code and" +
+                    "      yp_zd_dict.serial=c.serial and" +
+                    "      yp_zd_dict.manu_code*=d.code and" +
+                    "      c.group_no =#{groupNo} and" +
+                    "      isnull(yp_zd_dict.del_flag,'')  <![CDATA[<>]]> '1' and" +
+                    "      yp_zd_dict.code*=cc.code and" +
+                    "      yp_zd_dict.serial*=cc.serial" +
+                    " group by" +
+                    "  c.charge_code," +
+                    "  c.serial" ,
+            " </script>"})
+    List<YpZdBaseYfSpecialVo> selectYpSpecialMark(@Param("groupNo")String groupNo, @Param("searchText") String searchText);
+}

+ 38 - 0
src/main/java/cn/hnthyy/thmz/service/his/YpZdYpbhService.java

@@ -0,0 +1,38 @@
+package cn.hnthyy.thmz.service.his;
+
+import cn.hnthyy.thmz.entity.his.YpZdYpbh;
+
+import java.util.List;
+
+/**
+ * 药品批次服务接口
+ */
+public interface YpZdYpbhService {
+
+    /**
+     * 查询药品批次信息
+     * @param chargeCode
+     * @return
+     */
+    List<YpZdYpbh> queryYpZdYpbhByChargeCode(String chargeCode);
+
+    /**
+     * 更新药品批次信息
+     * @param ypZdYpbh
+     * @return
+     */
+    int modifYpZdYpbh(YpZdYpbh ypZdYpbh);
+    /**
+     * 新增药品批次信息
+     * @param ypZdYpbh
+     * @return
+     */
+    int addYpZdYpbh(YpZdYpbh ypZdYpbh);
+    /**
+     * 删除药品批次信息
+     * @param chargeCode
+     * @param ypbh
+     * @return
+     */
+    int removeYpZdYpbh(String chargeCode,String ypbh);
+}

+ 20 - 0
src/main/java/cn/hnthyy/thmz/service/his/yf/YfSpecialMarkService.java

@@ -0,0 +1,20 @@
+package cn.hnthyy.thmz.service.his.yf;
+
+import cn.hnthyy.thmz.vo.YpZdBaseYfSpecialVo;
+
+import java.util.List;
+
+/**
+ * 药房特殊标志维护
+ */
+public interface YfSpecialMarkService {
+
+    /**
+     *
+     * 查询药品信息
+     * @param groupNo
+     * @param searchText
+     * @return
+     */
+    List<YpZdBaseYfSpecialVo> queryYpSpecialMark(String groupNo, String searchText);
+}

+ 40 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/YpZdYpbhServiceImpl.java

@@ -0,0 +1,40 @@
+package cn.hnthyy.thmz.service.impl.his;
+
+import cn.hnthyy.thmz.entity.his.YpZdYpbh;
+import cn.hnthyy.thmz.mapper.his.YpZdYpbhMapper;
+import cn.hnthyy.thmz.service.his.YpZdYpbhService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @description:药品批次服务
+ * @author: WANGJIALIANG
+ * @time: 2021/9/24 8:22
+ */
+@Service
+public class YpZdYpbhServiceImpl implements YpZdYpbhService {
+    @Autowired
+    private YpZdYpbhMapper ypZdYpbhMapper;
+
+    @Override
+    public List<YpZdYpbh> queryYpZdYpbhByChargeCode(String chargeCode) {
+        return ypZdYpbhMapper.selectYpZdYpbhByChargeCode(chargeCode);
+    }
+
+    @Override
+    public int modifYpZdYpbh(YpZdYpbh ypZdYpbh) {
+        return ypZdYpbhMapper.updateYpZdYpbh(ypZdYpbh);
+    }
+
+    @Override
+    public int addYpZdYpbh(YpZdYpbh ypZdYpbh) {
+        return ypZdYpbhMapper.insertYpZdYpbh(ypZdYpbh);
+    }
+
+    @Override
+    public int removeYpZdYpbh(String chargeCode, String ypbh) {
+        return ypZdYpbhMapper.deleteYpZdYpbh(chargeCode,ypbh);
+    }
+}

+ 25 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/yf/YfSpecialMarkServiceImpl.java

@@ -0,0 +1,25 @@
+package cn.hnthyy.thmz.service.impl.his.yf;
+
+import cn.hnthyy.thmz.mapper.his.yf.YfSpecialMarkMapper;
+import cn.hnthyy.thmz.service.his.yf.YfSpecialMarkService;
+import cn.hnthyy.thmz.vo.YpZdBaseYfSpecialVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @description:药房特殊标志维护
+ * @author: WANGJIALIANG
+ * @time: 2021/9/17 11:42
+ */
+@Service
+public class YfSpecialMarkServiceImpl implements YfSpecialMarkService {
+    @Autowired
+    YfSpecialMarkMapper yfSpecialMarkMapper;
+
+    @Override
+    public List<YpZdBaseYfSpecialVo> queryYpSpecialMark(String groupNo, String searchText) {
+        return yfSpecialMarkMapper.selectYpSpecialMark(groupNo, searchText);
+    }
+}

+ 56 - 0
src/main/java/cn/hnthyy/thmz/vo/YpZdBaseYfSpecialVo.java

@@ -0,0 +1,56 @@
+package cn.hnthyy.thmz.vo;
+
+import lombok.Data;
+
+/**
+ * @description:药房药品特殊标志维护视图类
+ * @author: WANGJIALIANG
+ * @time: 2021/8/16 15:26
+ */
+@Data
+public class YpZdBaseYfSpecialVo {
+    //药品编码
+    private String chargeCode;
+    //药品名称
+    private String name;
+    //序号
+    private String serial;
+    //药品分类yp_zd_class
+    private String className;
+    //药品分类yp_zd_class
+    private String classCode;
+    //规格
+    private String specification;
+    //厂商编码
+    private String manuCode;
+    //厂商名称
+    private String manufactoryName;
+    //库存量
+    private Double stockAmount;
+    //大规格库存量
+    private Double stockAmountLarge;
+    //货位号
+    private String location;
+    //药房编码
+    private String groupNo;
+    //当前虚存
+    private Double stockAmountVirtual;
+    //门诊是否停用 0:未停用 1:已停用
+    private String visibleFlagMz;
+    //住院是否停用 0:未停用 1:已停用
+    private String visibleFlagZy;
+    //库存为0 0:否 1:是
+    private String visibleFlagStop;
+    //虚拟库存2
+    private Double stockAmountVirtual2;
+    //是否开启虚拟库存2 0否 1是
+    private String openVirtual2;
+    //3天用量
+    private Integer threeDayDosage;
+    //7天用量
+    private Integer sevenDayDosage;
+    //14天用量
+    private Integer fourteenDayDosage;
+    //30天用量
+    private Integer thirtyDayDosage;
+}

+ 267 - 0
src/main/resources/static/js/yf/yf_special_mark.js

@@ -0,0 +1,267 @@
+//@ sourceURL=yf_special_mark.js
+var pharmacyGroupNo;//药房编码
+var chargeNo;//药品表选中的行号
+var batchNo;//批次表选中的行号
+$(function () {
+    $(".selectpicker").selectpicker();
+    $("#pharmacyModal").modal("show");
+    $('#btn_search').on('click',function(e){
+        loadTbTable();
+    });
+    $('#searchText').on('blur',function(e){
+        loadTbTable();
+    });
+});
+
+
+/**
+ * 初始化参数
+ */
+function init() {
+    pharmacyGroupNo = $("#pharmacyGroupNo").val();
+    $("#pharmacyModal").modal("hide");
+    initTable();
+    initBatch();
+}
+
+/**
+ * 查询列表
+ */
+function initTable() {
+    $.jgrid.gridUnload("tb_table");
+    $("#tb_table").jqGrid({
+        datatype: 'local',
+        mtype: 'get',
+        url: '/thmz/getYpSpecialMark',
+        loadBeforeSend: function (jqXHR) {
+            jqXHR.setRequestHeader("Authorization", 'Bearer ' + localStorage.getItem("token"));
+            jqXHR.setRequestHeader("Accept", 'application/json');
+        },
+        styleUI: 'Bootstrap',
+        viewrecords: true,
+        autowidth: true,
+        rowNum: -1,//取消分页
+        height:  screen.height*0.3,
+        caption: '药品信息',
+        shrinkToFit:false,
+        autoScroll: false,
+        cellEdit: true,
+        cellsubmit: "remote",
+        cellurl: '/thmz/modifYpSpecialMark',
+        colNames: ['门诊停用','住院停用','库存为零','编码','序号', '药品名', '库存量', '大规格(汇总)', '规格', '虚存2','启用虚存2', '3天用量', '7天用量', '14天用量','30天用量','厂家','药性分类'],
+        colModel: [
+            {name: 'visibleFlagMz', index: 'visibleFlagMz',align:'center',width:100,formatter : "checkbox",editable : true,edittype:'checkbox', editoptions:{value:"1:0"}},
+            {name: 'visibleFlagZy', index: 'visibleFlagZy',align:'center',width:100,formatter : "checkbox",editable : true,edittype:'checkbox', editoptions:{value:"1:0"}},
+            {name: 'visibleFlagStop', index: 'visibleFlagStop',align:'center',width:100,formatter : "checkbox",editable : true,edittype:'checkbox', editoptions:{value:"1:0"}},
+            {name: 'chargeCode', index: 'chargeCode',align:'center',width:100},
+            {name: 'serial', index: 'serial',align:'center',width:100,hidden:true},
+            {name: 'name', index: 'name',width:180},
+            {name: 'stockAmount', index: 'stockAmount',align:'center',width:100},
+            {name: 'stockAmountLarge', index: 'stockAmountLarge',align:'center',width:100},
+            {name: 'specification', index: 'specification',align:'center',width:100},
+            {name: 'stockAmountVirtual2', index: 'stockAmountVirtual2',width:100,align:'center',editable : true,edittype:'text'
+                ,editrules: {edithidden:true,number:true,minValue:0}
+               },
+            {name: 'openVirtual2', index: 'openVirtual2',width:100,align:'center',formatter : "checkbox",editable : true,edittype:'checkbox', editoptions:{value:"1:0"}},
+            {name: 'threeDayDosage', index: 'threeDayDosage', formatter: 'number',align:'center',width:100},
+            {name: 'sevenDayDosage', index: 'sevenDayDosage', formatter: 'number',align:'center',width:100},
+            {name: 'fourteenDayDosage', index: 'fourteenDayDosage', formatter: 'number',align:'center',width:100},
+            {name: 'thirtyDayDosage', index: 'thirtyDayDosage', formatter: 'number',align:'center',width:100},
+            {name: 'manufactoryName', index: 'manufactoryName',width:180},
+            {name: 'className', index: 'className',width:100,align:'center'}
+        ],
+        jsonReader: {
+            root: "data", repeatitems: false
+        },
+        beforeSubmitCell:function(rowid, cellname, value, iRow, iCol){
+            let record = jQuery("#tb_table").getRowData(rowid);
+            let temp = eval('(' + '{ "'+cellname+'": "'+value+'"}' + ')');
+            temp.chargeCode = record.chargeCode;
+            temp.serial = record.serial;
+            temp.groupNo = pharmacyGroupNo;
+            return temp
+        },
+        onCellSelect: function(rowid,iCol,cellcontent,e){
+            let record = jQuery("#tb_table").getRowData(rowid);
+            loadBatch(record.chargeCode);
+            chargeNo = rowid;
+        },
+        loadComplete: function (res) { //加载完成(初始加载),回调函数
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view';
+                return;
+            }
+            if (res.code == -1) {
+                errorMesage(res);
+            }
+        }
+    });
+}
+
+/**
+ * 加载药品批次表格数据
+ */
+function loadTbTable() {
+    $("#tb_table").jqGrid('setGridParam', {
+        datatype:'json',
+        postData: { searchText: $("#searchText").val(), groupNo: pharmacyGroupNo }
+    }).trigger('reloadGrid');
+}
+
+/**
+ * 加载药品批次表格数据
+ * @param chargeCode
+ */
+function loadBatch(chargeCode) {
+    batchNo = null;
+    $("#tb_table_batch").jqGrid('setGridParam', {
+        datatype:'json',
+        postData: { chargeCode: chargeCode }
+    }).trigger('reloadGrid');
+}
+/**
+ * 初始化药品批次表格
+ */
+function initBatch() {
+    $.jgrid.gridUnload("tb_table_batch");
+    $("#tb_table_batch").jqGrid({
+        datatype: 'local',
+        mtype: 'get',
+        url: '/thmz/getYpZdYpbh',
+        loadBeforeSend: function (jqXHR) {
+            jqXHR.setRequestHeader("Authorization", 'Bearer ' + localStorage.getItem("token"));
+            jqXHR.setRequestHeader("Accept", 'application/json');
+        },
+        toolbar : [ true, "top" ],
+        styleUI: 'Bootstrap',
+        viewrecords: true,
+        autowidth: true,
+        rowNum: -1,//取消分页
+        caption: '药品批次维护',
+        cellEdit: true,
+        sortable: true,
+        loadonce:true, //一次加载全部数据到客户端,由客户端进行排序。
+        sortname: 'fDate', //设置默认的排序列
+        sortorder: 'desc',
+        cellsubmit: "remote",
+        cellurl: '/thmz/modifYpZdYpbh',
+        editurl: '/thmz/addYpZdYpbh',
+        colNames: ['停用标记','药品编号','药品批号','入库时间'],
+        colModel: [
+            {name: 'usingFlag', index: 'usingFlag',align:'center',width:100,formatter : "checkbox",editable : true,edittype:'checkbox', editoptions:{value:"1:0"}},
+            {name: 'chargeCode', index: 'chargeCode',align:'center',width:100},
+            {name: 'ypbh', index: 'ypbh',align:'center',width:100,editable : true,edittype:'text'},
+            {name: 'fDate', index: 'fDate',align:'center', formatter:"date", formatoptions: {srcformat:'Y-m-d H:i',newformat:'Y-m-d H:i'},sortable: true,width:100,
+                editable:true,
+                edittype:"text",editoptions: {
+                    size: 10, maxlengh: 10,
+                    dataInit: function(element) {
+                        $(element).datetimepicker({language:'zh-CN',dateFormat: 'yyyy-mm-dd hh:ii'})
+                    }
+                }
+            }
+        ],
+        jsonReader: {
+            root: "data", repeatitems: false
+        },
+        beforeSubmitCell:function(rowid, cellname, value, iRow, iCol){
+            let record = jQuery("#tb_table_batch").getRowData(rowid);
+            let temp = eval('(' + '{ "'+cellname+'": "'+value+'"}' + ')');
+            temp.chargeCode = record.chargeCode;
+            temp.ypbh = record.ypbh;
+            return temp
+        },
+        onCellSelect: function(rowid,iCol,cellcontent,e){
+            batchNo = rowid;
+        },
+        beforeEditCell: function(rowid,iCol,cellcontent,e){
+            batchNo = rowid;
+        },
+        loadComplete: function (res) { //加载完成(初始加载),回调函数
+            var ids = jQuery("#tb_table_batch").jqGrid("getDataIDs");
+            for (let i = 0; i < ids.length; i++) {
+                $("#tb_table_batch").jqGrid("setCell",ids[i],"ypbh",'','not-editable-cell');//列不可编辑
+            }
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view';
+                return;
+            }
+            if (res.code == -1) {
+                errorMesage(res);
+            }
+        }
+    });
+    $("#t_tb_table_batch").append("<button class='registration-no-color-foot-button' title='新增一行' id='addBatch' style='color: #35D082;margin-left: 10px;'><i class='fa fa-plus'></i></button>");
+    $("#t_tb_table_batch").append("<button class='registration-no-color-foot-button' title='删除一行' id='removeBatch'  style='color: red;margin-left: 10px;'><i class='fa fa-trash-o'></i></button>");
+    $("#t_tb_table_batch").append("<button class='registration-no-color-foot-button' title='保存新增行' id='saveBatch'  style='color: green;margin-left: 10px;'><i class='fa fa-floppy-o'></i></button>");
+    $("#addBatch").on('click',function(e){
+        var ids = jQuery("#tb_table_batch").jqGrid("getDataIDs");//得到jqgrid当前行数
+        var rowid = Math.max.apply(Math,ids);//获得当前最大行号
+        let record = jQuery("#tb_table").getRowData(chargeNo);
+        let data= {chargeCode:record['chargeCode'],usingFlag:0,ypbh:"",fDate:new Date()};
+        $("#tb_table_batch").addRowData(rowid+1, data,'first');
+        jQuery("#tb_table_batch").jqGrid('editRow', rowid+1);
+        batchNo =  rowid+1;
+    });
+    $("#removeBatch").on('click',function(e){
+        if(batchNo == null){
+            return errorMesageSimaple('请选择一行进行删除!');
+        }
+        let record = jQuery("#tb_table_batch").getRowData(batchNo);
+        if(!(record['ypbh'].indexOf("<input") != -1)){
+            let data= {chargeCode:record['chargeCode'],ypbh:record['ypbh']};
+            $.ajax({
+                type: "GET",
+                url: '/thmz/removeYpZdYpbh',
+                contentType: "application/json;charset=UTF-8",
+                dataType: "json",
+                headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+                data: data,
+                success: function (res) {
+                    if (res == '401' || res == 401) {
+                        window.location.href = '/thmz/login/view';
+                        return;
+                    }
+                    if (res.code == 0) {
+                        $("#tb_table_batch").jqGrid("delRowData", batchNo);
+                        batchNo = null;
+                        successMesage(res);
+                    } else {
+                        errorMesage(res);
+                    }
+                }
+            });
+        }else{
+            $("#tb_table_batch").jqGrid("delRowData", batchNo);
+        }
+    });
+    $("#saveBatch").on('click',function(e){
+        if(batchNo == null){
+            return errorMesageSimaple('没有可保存数据!');
+        }
+        let record = jQuery("#tb_table_batch").getRowData(batchNo);
+        let data= {usingFlag:record['usingFlag'],chargeCode:record['chargeCode'],ypbh:$('#'+batchNo+'_ypbh').val(),fDate:$('#'+batchNo+'_fDate').val()};
+        $.ajax({
+            type: "POST",
+            url: '/thmz/addYpZdYpbh',
+            contentType: "application/json;charset=UTF-8",
+            dataType: "json",
+            headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+            data: JSON.stringify(data),
+            success: function (res) {
+                if (res == '401' || res == 401) {
+                    window.location.href = '/thmz/login/view';
+                    return;
+                }
+                if (res.code == 0) {
+                    let record = jQuery("#tb_table").getRowData(chargeNo);
+                    loadBatch(record.chargeCode);
+                    batchNo = null;
+                    successMesage(res);
+                } else {
+                    errorMesage(res);
+                }
+            }
+        });
+    });
+}

+ 75 - 0
src/main/resources/templates/yf/yf_special_mark.html

@@ -0,0 +1,75 @@
+<link rel="stylesheet" href="/thmz/css/custom.min.css">
+<link rel="stylesheet" href="/thmz/css/bootstrap/css/bootstrap-select.css"/>
+<link rel="stylesheet" href="/thmz/css/jqGrid/ui.jqgrid-bootstrap.css">
+<link rel="stylesheet" href="/thmz/css/toll_administration.css">
+<link rel="stylesheet" href="/thmz/css/bootstrap/css/bootstrap-datetimepicker.min.css">
+<script src="/thmz/js/dependent/bootstrap-datetimepicker.min.js"></script>
+<script src="/thmz/js/dependent/bootstrap-datetimepicker.zh-CN.js"></script>
+<script src="/thmz/js/dependent/bootstrap-select.js"></script>
+<script src="/thmz/js/jqGrid/grid.locale-cn.js"></script>
+<script src="/thmz/js/jqGrid/jquery.jqGrid.min.js"></script>
+<script src="/thmz/js/yf/yf_special_mark.js"></script>
+<title>药房特殊标志维护</title>
+<div class="row" style="height: calc(100% - 60px);overflow-y: auto;">
+    <div class="col-md-12 col-sm-12 col-xs-12">
+        <div class="x_panel" style="background: #EBEBE4;">
+            <div class="panel-body">
+                <form id="formSearch" class="form-horizontal" autocomplete="off">
+                    <label class="control-label col-md-1 col-sm-1 col-xs-12" for="searchText">药品
+                    </label>
+                    <div class="col-md-2 col-sm-2 col-xs-12">
+                        <input id="searchText" class="form-control optional" type="text">
+                    </div>
+                    <div class="form-group">
+                        <button type="button" id="btn_search" class="btn btn-primary"
+                                title="查询"><i class="glyphicon glyphicon-search"></i>
+                        </button>
+                </div>
+                </form>
+            </div>
+            <div id="tb_table_div">
+                <div class="col-md-12 col-sm-12 col-xs-12">
+                    <table id="tb_table"></table>
+                    <div class="col-md-5 col-sm-5 col-xs-12" style="padding-left: 0px;padding-top: 10px;">
+                        <table id="tb_table_batch"></table>
+                        <div id="pager_batch"></div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<!--选择展示药房弹窗开始-->
+<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="pharmacyModal">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content" style="width: 420px;margin-left: 250px;margin-top: 300px;">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
+                </button>
+                <h4 class="modal-title">请选择药房</h4>
+            </div>
+            <div class="modal-body">
+                <form class="form-horizontal form-label-left" novalidate  autocomplete="off">
+                    <div class="item form-group thmz_alert">
+                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="pharmacyGroupNo">药房 <span
+                                class="required">*</span>
+                        </label>
+                        <div class="col-md-6 col-sm-6 col-xs-12">
+                            <select class="form-control selectpicker show-tick" required="required" title="请选择"
+                                    id="pharmacyGroupNo">
+                                <option value="71" selected>门诊西药房</option>
+                                <option value="73">住院药房</option>
+                            </select>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-primary"  onclick="init()" id="btn_init">确定</button>
+                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+            </div>
+        </div>
+    </div>
+</div>
+<!--选择展示药房弹窗结尾-->