Jelajahi Sumber

Merge branch 'master' into 'master'

优化追溯码上传,增加删除功能

See merge request lighter/web-server!144
huangshuhua 2 bulan lalu
induk
melakukan
3f2f7e2b1f

+ 11 - 0
src/main/java/thyyxxk/webserver/controller/medicine/YpInvinfoController.java

@@ -50,5 +50,16 @@ public class YpInvinfoController {
         return service.selectYpInvinfoResult(upload);
     }
 
+    /**
+     * @Description 删除药品库存变更上传信息
+     * @Author hsh
+     * @param list 药品库存变更上传信息
+     * @return map
+     * @Date 2025/6/12 0012 17:11
+     */
+    @PostMapping("/deleteYpInvinfoBatchByCode")
+    public ResultVo<Map<String, Object>> deleteYpInvinfoBatchByCode(@RequestBody @Validated List<YpCodgUpload> list){
+        return service.deleteYpInvinfoBatchByCode(list);
+    }
 
 }

+ 11 - 0
src/main/java/thyyxxk/webserver/controller/medicine/YpSelinfoSoldController.java

@@ -56,5 +56,16 @@ public class YpSelinfoSoldController {
         return service.selectYpSelinfoResult(upload);
     }
 
+    /**
+     * @Description 删除药品销售/销售退货上传信息
+     * @Author hsh
+     * @param list 药品销售/销售退货上传信息
+     * @return map
+     * @Date 2025/6/12 0012 17:09
+     */
+    @PostMapping("/deleteYpSelinfoSoldBatchByCode")
+    public ResultVo<Map<String, Object>> deleteYpSelinfoSoldBatchByCode(@RequestBody @Validated List<YpCodgUpload> list){
+        return service.deleteYpSelinfoSoldBatchByCode(list);
+    }
 
 }

+ 8 - 0
src/main/java/thyyxxk/webserver/dao/his/medicine/YpInvinfoDao.java

@@ -19,6 +19,14 @@ public interface YpInvinfoDao {
             " </script>")
     void deleteYpInvinfoBatchByIds(List<YpInvinfoModify> list);
 
+    @Delete("<script> " +
+            " delete from yp_invinfo_modify where fixmedins_bchno in " +
+            " <foreach collection='list' item='item' open='(' separator=',' close=')'> " +
+            " #{item.fixmedinsBchno} " +
+            " </foreach> " +
+            " </script>")
+    int deleteYpInvinfoBatchByCodes(List<YpCodgUpload> list);
+
     @Insert("<script> " +
             " insert into yp_invinfo_modify (med_list_codg, inv_chg_type, fixmedins_hilist_id, fixmedins_hilist_name, fixmedins_bchno, pric, cnt, rx_flag, inv_chg_time, inv_chg_opter_name, memo, trdn_flag, charge_code, charge_name, serial, upload_flag, msg_err, docu_no, seri, group_no, group_no_out, manu_no, producing_date, eff_date, create_time, inv_chg_type_name, type) values " +
             " <foreach collection='list' item='item'  separator=','> " +

+ 8 - 0
src/main/java/thyyxxk/webserver/dao/his/medicine/YpSelinfoSoldDao.java

@@ -22,6 +22,14 @@ public interface YpSelinfoSoldDao extends BaseMapper<YpSelinfoSold> {
             "</script>")
     void deleteYpSelinfoSoldBatchByIds(List<YpSelinfoSold> list);
 
+    @Delete("<script> " +
+            " <foreach collection='list' item='item' separator=';'> " +
+            "   delete from yp_selinfo_sold where pat_no = #{item.patNo} and times = #{item.times} " +
+            "   and receipt_no = #{item.receiptNo} and order_no = #{item.orderNo} and item_no = #{item.itemNo} " +
+            " </foreach> " +
+            "</script>")
+    int deleteYpSelinfoSoldBatchByCodes(List<YpCodgUpload> list);
+
     @Insert("<script> " +
             " insert into yp_selinfo_sold (med_list_codg, fixmedins_hilist_id, fixmedins_hilist_name, fixmedins_bchno, " +
             " prsc_dr_cert_type, prsc_dr_certno, prsc_dr_name, phar_cert_type, phar_certno, phar_name, phar_prac_cert_no, " +

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/medicine/YpTracCodgDao.java

@@ -171,7 +171,7 @@ public interface YpTracCodgDao {
     List<YpSelinfoSold> selectYpSelinfoSoldThDetailByXyf(@Param("dto") YpCodgUpload dto);
 
     @Select(" select drug_trac_codg as ypCodg, charge_item_code as chargeCode from ${tableName} " +
-            " where patient_id = #{patNo} and times = #{times} and charge_item_code = #{chargeCode} and serial = #{serial} ")
+            " where flag = '0' and patient_id = #{patNo} and times = #{times} and charge_item_code = #{chargeCode} and serial = #{serial} ")
     List<Map<String, String>> selectCodgInfoById(@Param("tableName") String tableName, @Param("patNo") String patNo, @Param("times") Integer times,
                                                  @Param("chargeCode") String chargeCode, @Param("serial") String serial);
 

+ 5 - 0
src/main/java/thyyxxk/webserver/entity/medicine/YpCodgUpload.java

@@ -29,4 +29,9 @@ public class YpCodgUpload {
      */
     private String invChgType;
 
+    private String times;
+    private String receiptNo;
+    private String orderNo;
+    private String itemNo;
+
 }

+ 11 - 0
src/main/java/thyyxxk/webserver/service/medicine/YpInvinfoService.java

@@ -58,4 +58,15 @@ public class YpInvinfoService {
         return ResultVoUtil.success(invinfoList);
     }
 
+    public ResultVo<Map<String, Object>> deleteYpInvinfoBatchByCode(List<YpCodgUpload> list) {
+        if(null == list || list.isEmpty()){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "药品库存变更上传信息不存在,请检查!");
+        }
+        Map<String, Object> map = new HashMap<>();
+        int count = dao.deleteYpInvinfoBatchByCodes(list);
+        map.put("count", count);
+        map.put("msg", "删除药品库存变更上传信息成功!");
+        return ResultVoUtil.success(map);
+    }
+
 }

+ 11 - 0
src/main/java/thyyxxk/webserver/service/medicine/YpSelinfoSoldService.java

@@ -63,4 +63,15 @@ public class YpSelinfoSoldService {
         return ResultVoUtil.success(purcinfoList);
     }
 
+    public ResultVo<Map<String, Object>> deleteYpSelinfoSoldBatchByCode(List<YpCodgUpload> list) {
+        if(null == list || list.isEmpty()){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "药品销售/销售退货上传信息不存在,请检查!");
+        }
+        Map<String, Object> map = new HashMap<>();
+        int count = dao.deleteYpSelinfoSoldBatchByCodes(list);
+        map.put("count", count);
+        map.put("msg", "删除药品销售/销售退货上传信息成功!");
+        return ResultVoUtil.success(map);
+    }
+
 }

+ 32 - 4
src/main/java/thyyxxk/webserver/service/medicine/YpTracCodgService.java

@@ -281,16 +281,28 @@ public class YpTracCodgService {
         if(null == list || list.isEmpty()){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有可删除的数据,请检查!");
         }
+
+        /*
+         * type: 1,2是商品采购与退货上传(目前是废弃状态) 3,4是商品销售与退货 0是商品库存变化 其他没有
+         */
         String type = list.get(0).getType();
         if(StringUtils.isBlank(type)){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "进销存数据类型【 " + type +  " 】为空,请检查!");
         }
         List<InvinfoDelete> invinfoList = new ArrayList<>();
         String invDataType = "";
-        if("1".equals(type) || "2".equals(type)){
-            invDataType = YpTracType.THREE.getCode();
-        } else if("3".equals(type) || "4".equals(type)){
-            invDataType = YpTracType.FOUR.getCode();
+        switch (type) {
+            case "1":
+            case "2":
+                invDataType = YpTracType.THREE.getCode();
+                break;
+            case "3":
+            case "4":
+                invDataType = YpTracType.FOUR.getCode();
+                break;
+            case "0":
+                invDataType = YpTracType.TWO.getCode();
+                break;
         }
         if(StringUtils.isBlank(invDataType)){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "对应的进销存数据类型【 " + invDataType +  " 】为不匹配,请检查!");
@@ -305,6 +317,20 @@ public class YpTracCodgService {
         if(YpDictConstant.ERROR_STATUS == str.getCode()) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, str.getMessage());
         }
+
+        switch (type) {
+            case "1":
+            case "2":
+                break;
+            case "3":
+            case "4":
+                soldService.deleteYpSelinfoSoldBatchByCode(list);
+                break;
+            case "0":
+                invinfoService.deleteYpInvinfoBatchByCode(list);
+                break;
+        }
+
         resultMap.put("sucMsg", str.getMessage());
         resultMap.put("msg", "删除药品"  + YpTracType.findName(invDataType) + "成功!");
         return ResultVoUtil.success(resultMap);
@@ -490,6 +516,8 @@ public class YpTracCodgService {
                         yp.setTrdnFlag("1");
                         yp.setFixmedinsBchno(StringUtils.trim(deal.getInDocuNo()) + "_" + deal.getInSeri());
                     }
+                } else {
+                    return "批量上传药品销售失败,根据追溯码【" + ypCodg + "】查出药品【" + ss.get(0).getDrugEntBaseDTO().getPhysicName() + "】品名与销售药品【" + yp.getChargeName() + "】品名不符合,请核对!" ;
                 }
             } else {
                 yp.setTrdnFlag("0");