Browse Source

Merge branch 'dev-1.1.4' into 'dev-1.1.4'

添加手动使用摆药机

See merge request lihong/thmz_system!23
huangshuhua 2 years ago
parent
commit
5a99a4b206

+ 48 - 0
src/main/java/cn/hnthyy/thmz/controller/yf/YfWardPrescriptionController.java

@@ -7,6 +7,8 @@ import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.yp.YpBaseYf;
 import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
 import cn.hnthyy.thmz.entity.his.yz.YzYpPageNo;
+import cn.hnthyy.thmz.entity.his.yz.YzYpZyOrder;
+import cn.hnthyy.thmz.entity.his.zy.Prescription;
 import cn.hnthyy.thmz.entity.his.zy.YpZyPatient;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.service.his.ResponceTypeService;
@@ -684,4 +686,50 @@ public class YfWardPrescriptionController {
             return resultMap;
         }
     }
+
+    /**
+     * @description: 根据药单号查询摆药机住院发药数据并使用摆药机
+     * @author: hsh
+     * @date: 2023/11/2 15:29
+     * @param: [pageNo]
+     * @return: Map<String,Object>
+     **/
+    @UserLoginToken
+    @RequestMapping(value = "/manualOperationByj", method = {RequestMethod.GET})
+    public Map<String, Object> manualOperationByj(@RequestParam Integer pageNo) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (pageNo == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", pageNo + "不正确,手动使用摆药机失败");
+                return resultMap;
+            }
+            List<Prescription> byjList = yfWardPrescriptionService.selectByjByPageNo(pageNo);
+            if (null != byjList && byjList.size() > 0) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "有初始摆药记录,手动使用摆药机失败");
+                return resultMap;
+            }
+            List<YpZyPatient> ypZyPatients = yfWardPrescriptionService.selectYpZyPatientForByj(pageNo);
+            if (ypZyPatients == null || ypZyPatients.size() == 0) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "未有发药记录或者还未发药,不能手动使用摆药机");
+                return resultMap;
+            }
+            if (yfWardPrescriptionService.savePrescription(ypZyPatients) > 0) {
+                resultMap.put("code", 0);
+                resultMap.put("message", "手动使用摆药机成功");
+            } else {
+                resultMap.put("code", -1);
+                resultMap.put("message", "手动使用摆药机失败");
+            }
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            resultMap.put("code", -1);
+            resultMap.put("message", "使用摆药机失败" + e.getMessage());
+            log.error("使用摆药机失败,系统异常,错误信息", e);
+            return resultMap;
+        }
+    }
 }

+ 16 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/zy/PrescriptionMapper.java

@@ -1,8 +1,13 @@
 package cn.hnthyy.thmz.mapper.his.zy;
 
 import cn.hnthyy.thmz.entity.his.zy.Prescription;
+import cn.hnthyy.thmz.entity.his.zy.YpZyPatient;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
+import java.util.List;
+
 /**
  * 住院药房摆药机中间表
  */
@@ -34,4 +39,15 @@ public interface PrescriptionMapper {
             "  #{administrationName},#{doctorComment},#{makeRecTime},#{hisId}" +
             ")")
     int insertPrescription(Prescription prescription);
+
+    /**
+     * 根据请领单号(药单号)查询摆药机明细
+     * @param hisId
+     * @return
+     */
+    @Select({
+        " select * from Prescription where HisId = #{hisId} and ProcFlg = '0' "
+        })
+    List<Prescription> selectByjByPageNo(@Param("hisId") String hisId);
+
 }

+ 44 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/zy/YpZyPatientMapper.java

@@ -264,4 +264,48 @@ public interface YpZyPatientMapper {
     })
     List<YzYpZyOrder> selectYpZyPatientFy(@Param("pageNo") String pageNo);
 
+    /**
+     * @description: 手动使用摆药机根据药单号查询发药明细
+     * @author: hsh
+     * @date: 2023/11/7 10:45
+     * @param: [pageNo]
+     * @return: List<YpZyPatient>
+     **/
+    @Select({
+            "select charge_code=rtrim(a.charge_code) ,\n" +
+                    "       serial =a.serial ,\n" +
+                    "       amount =a.amount ,\n" +
+                    "       retprice =a.retprice,\n" +
+                    "       page_no =a.page_no,\n" +
+                    "       inpatient_no=rtrim(a.inpatient_no),\n" +
+                    "       admiss_times=a.admiss_times,\n" +
+                    "       act_order_no=a.act_order_no,\n" +
+                    "       occ_time =a.order_date,\n" +
+                    "       order_date=a.order_date,\n" +
+                    "       name =a.name,\n" +
+                    "       bed_no =a.bed_no,\n" +
+                    "       ward_code =a.ward_code,\n" +
+                    "       dept_code =a.dept_code,\n" +
+                    "       infant_flag =a.infant_flag,\n" +
+                    "       drawer =a.drawer,\n" +
+                    "       always_flag =a.always_flag,\n" +
+                    "       self_flag =a.self_flag,\n" +
+                    "       separate_flag=a.separate_flag,\n" +
+                    "       suprice_flag =a.suprice_flag,\n" +
+                    "       drug_flag =a.drug_flag,\n" +
+                    "       pay_self =a.pay_self,\n" +
+                    "       doctor_name =a.doctor_name,\n" +
+                    "       zy_serial_no =a.zy_serial_no,\n" +
+                    "       group_no=a.group_no,\n" +
+                    "       doctor_name=a.doctor_name,\n" +
+                    "       page_class=a.page_type,\n" +
+                    "       drug_class=a.drug_class,\n" +
+                    "       confirm_time=a.confirm_time\n" +
+                    "from yp_zy_patient a WITH(NOLOCK)" +
+                    " where  a.page_no = #{pageNo} " +
+                    "  and a.amount > 0 " +
+                    "order by a.confirm_time "
+    })
+    List<YpZyPatient> selectYpZyPatientForByj(@Param("pageNo") Integer pageNo);
+
 }

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

@@ -3,6 +3,7 @@ package cn.hnthyy.thmz.service.his.yf;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.yz.YzYpPageNo;
 import cn.hnthyy.thmz.entity.his.yz.YzYpZyOrder;
+import cn.hnthyy.thmz.entity.his.zy.Prescription;
 import cn.hnthyy.thmz.entity.his.zy.YpZyPatient;
 import cn.hnthyy.thmz.vo.YfWardVo;
 import cn.hnthyy.thmz.vo.YzActOrderCyDetailVo;
@@ -162,4 +163,23 @@ public interface YfWardPrescriptionService {
      * @return
      */
     int modifyManuNo(List<YpZyPatient> ypZyPatients);
+
+    /**
+     * @description: 查询使用摆药机的发药的药单明细
+     * @author: hsh
+     * @date: 2023/11/7 9:29
+     * @param: [pageNo]
+     * @return: List<YpZyPatient>
+     **/
+    List<YpZyPatient> selectYpZyPatientForByj(Integer pageNo);
+
+    /**
+     * @description: 根据药单号查询摆药机信息
+     * @author: hsh
+     * @date: 2023/11/7 11:00
+     * @param: [pageNo]
+     * @return: List<Prescription>
+     **/
+    List<Prescription> selectByjByPageNo(Integer pageNo);
+
 }

+ 11 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/yf/YfWardPrescriptionServiceImpl.java

@@ -1084,4 +1084,15 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
         });
         return 0;
     }
+
+    @Override
+    public List<YpZyPatient> selectYpZyPatientForByj(Integer pageNo) {
+        return ypZyPatientMapper.selectYpZyPatientForByj(pageNo);
+    }
+
+    @Override
+    public List<Prescription> selectByjByPageNo(Integer pageNo) {
+        String hisId = String.valueOf(pageNo);
+        return prescriptionMapper.selectByjByPageNo(hisId);
+    }
 }

+ 48 - 1
src/main/resources/static/js/yf/ward_prescription.js

@@ -122,6 +122,12 @@ $(function () {
     $("#barCode").on('input', debounce(e => {
         autoBar(e.delegateTarget.value)
     }, 500));
+
+    //手动使用摆药机
+    $('#btn_byj').click(function () {
+        callByj();
+    });
+
 });
 
 
@@ -165,7 +171,7 @@ function autoBar(value) {
 /**
  * 列表类型按钮切换事件
  * @param object
- * @param realIndex 下标
+ * @param realIndex 下标(0:请领单;1:汇总;2:明细)
  */
 function initButtonChange(object, realIndex) {
     $("#initButton").find("button").each(function (index, element) {
@@ -194,9 +200,11 @@ function initButtonChange(object, realIndex) {
         $("#btn_query").removeAttr('disabled');
         $("#btn_clean").removeAttr('disabled');
         $("#barCode").attr('disabled', true);
+        $("#btn_byj").css('display', 'none');
         initTbTable();
     } else if (realIndex == 1) {
         setFrom();
+        $("#btn_byj").css('display', 'none');
         $("#barCode").attr('disabled', true);
         loadSummarizingTable();
     } else if (realIndex == 2) {
@@ -204,6 +212,16 @@ function initButtonChange(object, realIndex) {
         $("#barCode").attr('disabled', false);
         $("#barCode").focus();
         loadDetailTable();
+        let ps = $("#pageClassSearch").val();
+        // 不是已发药状态或者是中药房不能手动使用摆药机
+        if("3" != $("#submitFlagSearch").val() || groupNo === '81'){
+            $("#btn_byj").css('display', 'none');
+        } else if("5" === ps || "6" === ps){
+            $("#btn_byj").css('display', "inline-flex");
+        } else {
+            $("#btn_byj").css('display', 'none');
+        }
+
     }
 }
 
@@ -1897,3 +1915,32 @@ function cancelXySubmit(pageNo, pageClass) {
     });
 }
 
+// 手动使用摆药机(用来摆药机未使用成功的药单重新使用一次摆药机)
+function callByj(){
+    if(!confirm("是否需要重新使用摆药机?")){
+        return;
+    }
+    $.ajax({
+        type: "GET",
+        url: '/thmz/manualOperationByj',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: {
+            pageNo: pageNo
+        },
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view';
+                return;
+            }
+            if (res.code == 0) {
+                successMesage(res);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+
+}
+

+ 3 - 0
src/main/resources/templates/yf/ward_prescription.html

@@ -114,6 +114,9 @@
                         <button type="button" id="btn_clean" class="btn btn-primary"
                                 title="重置"><i class="fa fa-rotate-left"></i>
                         </button>
+                        <button type="button" style="margin-left:3px; display:none;" id="btn_byj" class="btn btn-primary"
+                                title="使用摆药机"> 使用摆药机
+                        </button>
                         <button type="button" id="btn_ty"
                                 class="btn btn-primary hidden"
                                 title="退药完成"><i class="fa fa-check-square-o"></i>