Browse Source

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

优化门诊处方自动打印

See merge request lihong/thmz_system!37
huangshuhua 1 year ago
parent
commit
7426d13104

+ 39 - 0
src/main/java/cn/hnthyy/thmz/controller/SysParametersController.java

@@ -0,0 +1,39 @@
+package cn.hnthyy.thmz.controller;
+
+import cn.hnthyy.thmz.Utils.R;
+import cn.hnthyy.thmz.service.SysParametersService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @ClassName SysParametersController
+ * @Author hsh
+ * @Date 2024/1/9 10:09
+ * @Version 1.0
+ * @Description 系统字典
+ **/
+@Slf4j
+@RestController
+public class SysParametersController {
+
+    @Autowired
+    private SysParametersService sysParametersService;
+
+    /**
+     * @description 根据code获取系统字典值
+     * @author hsh
+     * @param
+     * @return
+     * @Date 2024/1/9 8:49
+     */
+    @RequestMapping(value = "/getSysParametersByCode", method = {RequestMethod.GET})
+    public R getSysParametersByCode(@RequestParam("code") String code) {
+        String value = sysParametersService.getSysParametersByCode(code);
+        return R.ok().put("data",value);
+    }
+
+}

+ 19 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/SysParametersMapper.java

@@ -0,0 +1,19 @@
+package cn.hnthyy.thmz.mapper.his;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+public interface SysParametersMapper {
+
+    /**
+     * @Description 查询系统字典
+     * @Author hsh
+     * @param code 编码
+     * @return name 值
+     * @Date 2024/1/9 9:37
+     */
+    @Select(" select name from sys_parameters where code = #{code} ")
+    String getSysParametersByCode(@Param("code") String code);
+
+}

+ 10 - 0
src/main/java/cn/hnthyy/thmz/service/SysParametersService.java

@@ -0,0 +1,10 @@
+package cn.hnthyy.thmz.service;
+
+public interface SysParametersService {
+
+    /**
+     * 根据code获取系统字典值
+     */
+    String getSysParametersByCode(String code);
+
+}

+ 27 - 0
src/main/java/cn/hnthyy/thmz/service/impl/SysParametersServiceImpl.java

@@ -0,0 +1,27 @@
+package cn.hnthyy.thmz.service.impl;
+
+import cn.hnthyy.thmz.mapper.his.SysParametersMapper;
+import cn.hnthyy.thmz.service.SysParametersService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @ClassName SysParametersServiceImpl
+ * @Author hsh
+ * @Date 2024/1/9 9:21
+ * @Version 1.0
+ * @Description 系统参数
+ **/
+@Slf4j
+@Service
+public class SysParametersServiceImpl implements SysParametersService {
+    @SuppressWarnings("all")
+    @Autowired
+    private SysParametersMapper sysParametersMapper;
+
+    @Override
+    public String getSysParametersByCode(String code) {
+        return sysParametersMapper.getSysParametersByCode(code);
+    }
+}

+ 31 - 0
src/main/resources/static/js/common/pharmacy-com.js

@@ -1068,4 +1068,35 @@ function getPageName(pageClass) {
             ypTypeName=pageClass;
     }
     return ypTypeName;
+}
+
+/**
+ * 根据系统字典编码获取字典值
+ * code: 编码
+ */
+function initSysParametersByCode(code) {
+    $.ajax({
+        type: "get",
+        url: '/thmz/getSysParametersByCode',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: {
+            code: code,
+        },
+        success: function (res) {
+            if (res === '401' || res === 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code === 0) {
+                if(res.data){
+                    timesLong = res.data;
+                    console.log(res.data)
+                }
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
 }

+ 4 - 1
src/main/resources/static/js/mz/west_pharmacy_dispensing.js

@@ -11,7 +11,9 @@ var printType = '';
 var temporaryKeyList="";
 var timer="";
 var printTimer = "";
+var timesLong = 5000;
 $(function () {
+    initSysParametersByCode("mzCfPrintTime")
     init_daterangepicker();
     if (groupNo == null || windowsNoYf == null) {
         return errorMesageSimaple('药房参数未设置,请在发药参数设置中设置');
@@ -41,7 +43,7 @@ $(function () {
                     printType = $(this).val();
                 });
                 if (!printTimer) {
-                    printTimer = setInterval("autoPrintMzCf()",2000);
+                    printTimer = setInterval("autoPrintMzCf()",timesLong);
                 }
             } else {
                 $(':checkbox[name=autoPrint]').removeAttr('checked');
@@ -1041,4 +1043,5 @@ function checkInput() {
 function autoPrintMzCf(){
     let v = $("#autoPrint").val();
     printPrescriptions(v);
+    initTable();
 }