Browse Source

缴费成功提示语改成配置的

hurugang 3 years ago
parent
commit
d66044699e

+ 4 - 0
src/main/java/cn/hnthyy/thmz/common/Constants.java

@@ -316,6 +316,10 @@ public class Constants {
      * 号表告警的人员配置的key
      */
     public static final String  ALARM_USER_KEY= "alarm_user";
+    /**
+     * 缴费成功的提示信息
+     */
+    public static final String  MESSAGE_TO_PHONE= "message_to_phone";
     /**
      * 医生的人员类型
      */

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

@@ -1128,4 +1128,19 @@ public class NavigationController {
         }
         return "mz/evaluation_list";
     }
+
+
+    /**
+     * 缴费成功提示语设置
+     *
+     * @return
+     */
+    @RequestMapping("/message-to-phone")
+    public String messageToPhone(HttpServletRequest httpServletRequest) throws Exception {
+        List<String> urls = getRoleUrls(httpServletRequest);
+        if (!urls.contains("/thmz/message-to-phone")) {
+            throw new Exception("您没有此模块的权限,请联系管理员开通!");
+        }
+        return "mz/message_to_phone";
+    }
 }

+ 1 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzyReqrecServiceImpl.java

@@ -671,7 +671,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
         }
         Calendar cal = Calendar.getInstance();
         cal.setTime(requestDayD);
-        //设置了免费
+        //设置了免费 周末自助挂号免费
         Config config = configMapper.selectUserByKey("weekend_fee");
         if ((config != null && YesNoEnum.YES.code.toString().equals(config.getConfigValue()))
                 && ((cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && Constants.PM.equals(ampm)) || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)) {

+ 27 - 17
src/main/java/cn/hnthyy/thmz/service/impl/thmz/EvaluationServiceImpl.java

@@ -46,7 +46,10 @@ public class EvaluationServiceImpl implements EvaluationService {
      * 客户端与患者的对应关系
      */
     private static ConcurrentHashMap<String, Map<String,Object>> clientAndPatientMap = new ConcurrentHashMap<>();
-
+    /**
+     * 存储了所有评价器客户端IP与评价器对应的用户信息,因为建立价格连接和推送消息是两步,会断开,所以缓存起来
+     */
+    private static ConcurrentHashMap<String, User> userMap = new ConcurrentHashMap<>();
     @Override
     public void login(HttpServletRequest httpServletRequest) {
         String requestIp = HttpUtil.getIPAddress(httpServletRequest);
@@ -57,11 +60,20 @@ public class EvaluationServiceImpl implements EvaluationService {
         if (windows == null || StringUtils.isBlank(windows.getClientIpAddress())) {
             return;
         }
-        evaluationWebSocket.login(windows.getClientIpAddress());
+        User tokenUser = null;
+        try {
+            tokenUser = TokenUtil.getUser(httpServletRequest);
+        } catch (MzException e) {
+            e.printStackTrace();
+            return;
+        }
+        userMap.put(windows.getClientIpAddress(),tokenUser);
+        evaluationWebSocket.login(windows.getClientIpAddress(),tokenUser);
     }
 
     @Override
     public void loginOut(String clientIpAddress) {
+        userMap.remove(clientIpAddress);
         Map<String, Object> resultMap = new HashMap();
         resultMap.put("type", "url");
         resultMap.put("url", "/thmz/client-welcome");
@@ -72,22 +84,20 @@ public class EvaluationServiceImpl implements EvaluationService {
 
     @Override
     public Map<String, Object> getUserInfo(HttpServletRequest httpServletRequest) {
-        User tokenUser = null;
-        try {
-            tokenUser = TokenUtil.getUser(httpServletRequest);
-            List<UserRoleRelation> userRoleRelations = userRoleRelationService.queryByUserId(tokenUser.getId());
-            Role role = roleService.queryById(userRoleRelations.get(0).getRoleId());
-            Map<String, Object> resultMap = new HashMap();
-            resultMap.put("name", tokenUser.getUserName());
-            resultMap.put("role", role.getRoleName());
-            resultMap.put("userCode", tokenUser.getUserCode());
-            resultMap.put("clientProfileImage", tokenUser.getClientProfileImage());
-            resultMap.put("url", "client-index");
-            return resultMap;
-        } catch (MzException e) {
-            e.printStackTrace();
+        String requestIp = HttpUtil.getIPAddress(httpServletRequest);
+        User tokenUser=userMap.get(requestIp);
+        if(tokenUser==null){
+            return null;
         }
-        return null;
+        List<UserRoleRelation> userRoleRelations = userRoleRelationService.queryByUserId(tokenUser.getId());
+        Role role = roleService.queryById(userRoleRelations.get(0).getRoleId());
+        Map<String, Object> resultMap = new HashMap();
+        resultMap.put("name", tokenUser.getUserName());
+        resultMap.put("role", role.getRoleName());
+        resultMap.put("userCode", tokenUser.getUserCode());
+        resultMap.put("clientProfileImage", tokenUser.getClientProfileImage());
+        resultMap.put("url", "client-index");
+        return resultMap;
     }
 
     @Override

+ 7 - 1
src/main/java/cn/hnthyy/thmz/service/impl/thmz/OrderStatusChangeServiceImpl.java

@@ -3,11 +3,13 @@ package cn.hnthyy.thmz.service.impl.thmz;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.his.mz.*;
 import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
+import cn.hnthyy.thmz.entity.thmz.Config;
 import cn.hnthyy.thmz.enums.OrderStatusEnum;
 import cn.hnthyy.thmz.enums.PayMarkEnum;
 import cn.hnthyy.thmz.pageDto.MzChargeDetailPageDto;
 import cn.hnthyy.thmz.service.his.mz.*;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
+import cn.hnthyy.thmz.service.thmz.ConfigService;
 import cn.hnthyy.thmz.service.thmz.DispensingSocketService;
 import cn.hnthyy.thmz.service.thmz.HaiCiAdapterService;
 import cn.hnthyy.thmz.service.thmz.OrderStatusChangeService;
@@ -42,6 +44,8 @@ public class OrderStatusChangeServiceImpl implements OrderStatusChangeService {
     private MzYjReqService mzYjReqService;
     @Autowired
     private DispensingSocketService dispensingSocketService;
+    @Autowired
+    private ConfigService configService;
     //就诊状态通知开关
     @Value("${sendNoticeToPatient}")
     private boolean sendNoticeToPatient;
@@ -138,6 +142,8 @@ public class OrderStatusChangeServiceImpl implements OrderStatusChangeService {
                 if (execDeps == null || execDeps.size() == 0) {
                     return;
                 }
+                Config config= configService.queryUserByKey(Constants.MESSAGE_TO_PHONE);
+                String messageToPhone=(config==null || StringUtils.isBlank(config.getConfigValue()))?"抽血室在一楼急诊科,大小便标本在门诊大楼三楼医学检验科,一楼急诊科的核酸采样室。":config.getConfigValue();
                 for (String str : execDeps) {
                     zdUnitCode = zdUnitCodeService.queryByCode(str);
                     if (zdUnitCode == null) {
@@ -145,7 +151,7 @@ public class OrderStatusChangeServiceImpl implements OrderStatusChangeService {
                     }
                     if ("2010000".equals(str)) {
                         //检验
-                        haiCiAdapterService.commonMessageNotice(mzPatientMi.getIcCardNo(), "{\"data\":{\"first\":{\"color\":\"#FF0000\",\"value\":\"您好,您已完成缴费,请到指定地点进行检验检查。\"},\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + zdUnitCode.getName() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + zdUnitCode.getOfficePos() + "\"},\"remark\":{\"color\":\"#FF0000\",\"value\":\" 抽血室在一楼急诊科,大小便标本在门诊大楼三楼医学检验科,一楼急诊科的核酸采样室。\"}},\"miniprogram\":{\"appid\":\"\",\"pagepath\":\"\"},\"template_id\":\"amY5BinXb2IpwdXqcOyXxtZZ26XyQOIQ3j1ablSWxy0\",\"touser\":\"\",\"url\":\"\"}", new Date());
+                        haiCiAdapterService.commonMessageNotice(mzPatientMi.getIcCardNo(), "{\"data\":{\"first\":{\"color\":\"#FF0000\",\"value\":\"您好,您已完成缴费,请到指定地点进行检验检查。\"},\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + zdUnitCode.getName() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + zdUnitCode.getOfficePos() + "\"},\"remark\":{\"color\":\"#FF0000\",\"value\":\" "+messageToPhone+"\"}},\"miniprogram\":{\"appid\":\"\",\"pagepath\":\"\"},\"template_id\":\"amY5BinXb2IpwdXqcOyXxtZZ26XyQOIQ3j1ablSWxy0\",\"touser\":\"\",\"url\":\"\"}", new Date());
                     } else {
                         //检查
                         haiCiAdapterService.commonMessageNotice(mzPatientMi.getIcCardNo(), "{\"data\":{\"first\":{\"color\":\"#FF0000\",\"value\":\"您好,您已完成缴费,请到指定地点进行检验检查。\"},\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + zdUnitCode.getName() + "\"},\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + zdUnitCode.getOfficePos() + "\"},\"remark\":{\"color\":\"#FF0000\",\"value\":\" 感谢您的使用。\"}},\"miniprogram\":{\"appid\":\"\",\"pagepath\":\"\"},\"template_id\":\"amY5BinXb2IpwdXqcOyXxtZZ26XyQOIQ3j1ablSWxy0\",\"touser\":\"\",\"url\":\"\"}", new Date());

+ 3 - 3
src/main/java/cn/hnthyy/thmz/socket/EvaluationWebSocket.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.socket;
 
+import cn.hnthyy.thmz.entity.thmz.User;
 import lombok.extern.slf4j.Slf4j;
 import org.json.JSONObject;
 import org.springframework.stereotype.Component;
@@ -143,10 +144,10 @@ public class EvaluationWebSocket {
 
     /**
      * 评价器客户端登录
-     *
      * @param clientIp
+     * @param tokenUser
      */
-    public void login(String clientIp) {
+    public void login(String clientIp,User tokenUser) {
         if (isLogin(clientIp)) {
             return;
         }
@@ -157,7 +158,6 @@ public class EvaluationWebSocket {
         appointSending(clientIp, JSONObject.valueToString(resultMap));
     }
 
-
     /**
      * 设置待发送的价格信息
      *

+ 46 - 0
src/main/resources/static/js/mz/message-to-phone.js

@@ -0,0 +1,46 @@
+//@ sourceURL=message-to-phone.js
+$(function () {
+    //缴费成功提示语
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getConfigByKey?key=message_to_phone',
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            $("#message_to_phone").val(res.data.configValue);
+        }
+    });
+
+    $('#send').click(function () {
+        //修改缴费成功提示语
+        $.ajax({
+            type: "POST",
+            contentType: "application/json;charset=UTF-8",
+            url: '/thmz/setConfig',
+            dataType: "json",
+            data: JSON.stringify({"configKey": "message_to_phone","configValue": $("#message_to_phone").val()}),
+            headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+            success: function (res) {
+                if (res == '401' || res == 401) {
+                    window.location.href = '/thmz/login/view'
+                    return;
+                }
+                if (res.code == 0) {
+                    successMesage(res);
+                } else {
+                    errorMesage(res);
+                }
+            }
+        });
+    });
+
+
+});
+
+
+
+

+ 36 - 0
src/main/resources/templates/mz/message_to_phone.html

@@ -0,0 +1,36 @@
+<link rel="stylesheet" href="/thmz/css/custom.min.css"/>
+<link rel="stylesheet" href="/thmz/css/toll_administration.css"/>
+<script src="/thmz/js/mz/message-to-phone.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">
+            <div class="panel-body">
+            </div>
+
+            <div class="row" style="margin-top: -20px;">
+                <div>
+                    <form class="form-horizontal form-label-left" novalidate id="request_config_form" autocomplete="off">
+                        <span class="section">缴费成功提示语设置</span>
+                        <div class="item form-group">
+                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="message_to_phone">缴费成功提示语 <span class="required">*</span>
+                            </label>
+                            <div class="col-md-4 col-sm-4 col-xs-12">
+                                <input type="text" id="message_to_phone"  class="form-control col-md-7 col-xs-12">
+                            </div>
+                        </div>
+                        <div class="ln_solid"></div>
+                        <div class="form-group">
+                            <div class="col-md-6 col-md-offset-3">
+                                <button id="send" type="button" class="btn btn-success">提交</button>
+                            </div>
+                        </div>
+                    </form>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+
+