Browse Source

评价器功能开发完成

hurugang 3 years ago
parent
commit
99452f96a5
34 changed files with 1232 additions and 299 deletions
  1. 21 21
      pom.xml
  2. 12 0
      src/main/java/cn/hnthyy/thmz/Utils/TokenUtil.java
  3. 16 6
      src/main/java/cn/hnthyy/thmz/controller/LoginController.java
  4. 2 1
      src/main/java/cn/hnthyy/thmz/controller/NavigationController.java
  5. 158 0
      src/main/java/cn/hnthyy/thmz/controller/mz/EvaluationController.java
  6. 1 1
      src/main/java/cn/hnthyy/thmz/controller/mz/MzPharmacyController.java
  7. 67 0
      src/main/java/cn/hnthyy/thmz/entity/thmz/Evaluate.java
  8. 40 0
      src/main/java/cn/hnthyy/thmz/enums/EvaluateEnum.java
  9. 5 1
      src/main/java/cn/hnthyy/thmz/interceptor/AuthenticationInterceptor.java
  10. 81 0
      src/main/java/cn/hnthyy/thmz/mapper/thmz/EvaluateMapper.java
  11. 11 14
      src/main/java/cn/hnthyy/thmz/mapper/thmz/WindowsMapper.java
  12. 213 0
      src/main/java/cn/hnthyy/thmz/service/impl/thmz/EvaluationServiceImpl.java
  13. 17 0
      src/main/java/cn/hnthyy/thmz/service/impl/thmz/TokenServiceImpl.java
  14. 4 4
      src/main/java/cn/hnthyy/thmz/service/impl/thmz/WindowsServiceImpl.java
  15. 77 0
      src/main/java/cn/hnthyy/thmz/service/thmz/EvaluationService.java
  16. 6 6
      src/main/java/cn/hnthyy/thmz/service/thmz/WindowsService.java
  17. 170 0
      src/main/java/cn/hnthyy/thmz/socket/EvaluationWebSocket.java
  18. 33 0
      src/main/resources/static/js/common/date-util.js
  19. 60 0
      src/main/resources/static/js/common/evaluation-websocket.js
  20. 40 0
      src/main/resources/static/js/common/ip-util.js
  21. 30 60
      src/main/resources/static/js/common/pad-util.js
  22. 0 2
      src/main/resources/static/js/menu.js
  23. 19 28
      src/main/resources/static/js/mz/charge_list.js
  24. 62 2
      src/main/resources/static/js/mz/client_evaluate.js
  25. 23 1
      src/main/resources/static/js/mz/client_index.js
  26. 13 28
      src/main/resources/static/js/mz/client_price.js
  27. 1 0
      src/main/resources/static/js/mz/client_welcome.js
  28. 13 45
      src/main/resources/static/js/mz/registration.js
  29. 4 49
      src/main/resources/static/js/mz/toll_administration.js
  30. 0 2
      src/main/resources/static/js/zy/hospitalized.js
  31. 12 13
      src/main/resources/templates/mz/client_evaluate.html
  32. 9 6
      src/main/resources/templates/mz/client_index.html
  33. 10 9
      src/main/resources/templates/mz/client_price.html
  34. 2 0
      src/main/resources/templates/mz/client_welcome.html

+ 21 - 21
pom.xml

@@ -31,8 +31,8 @@
 
 
         <!--<dependency>-->
-            <!--<groupId>org.springframework.cloud</groupId>-->
-            <!--<artifactId>spring-cloud-starter-consul-discovery</artifactId>-->
+        <!--<groupId>org.springframework.cloud</groupId>-->
+        <!--<artifactId>spring-cloud-starter-consul-discovery</artifactId>-->
         <!--</dependency>-->
 
 
@@ -60,22 +60,22 @@
         </dependency>
         <!--&lt;!&ndash; 添加 HikariCP数据源 重要&ndash;&gt;-->
         <!--<dependency>-->
-            <!--<groupId>com.zaxxer</groupId>-->
-            <!--<artifactId>HikariCP</artifactId>-->
+        <!--<groupId>com.zaxxer</groupId>-->
+        <!--<artifactId>HikariCP</artifactId>-->
         <!--</dependency>-->
-       <!-- 动态切换数据源-->
-<!--        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-boot-starter</artifactId>
-            <version>3.2.0</version>
-        </dependency>
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
-            <version>2.5.6</version>
-        </dependency>-->
         <!-- 动态切换数据源-->
-       <!-- 添加 druid 数据源 重要-->
+        <!--        <dependency>
+                    <groupId>com.baomidou</groupId>
+                    <artifactId>mybatis-plus-boot-starter</artifactId>
+                    <version>3.2.0</version>
+                </dependency>
+                <dependency>
+                    <groupId>com.baomidou</groupId>
+                    <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+                    <version>2.5.6</version>
+                </dependency>-->
+        <!-- 动态切换数据源-->
+        <!-- 添加 druid 数据源 重要-->
         <dependency>
             <groupId>com.alibaba</groupId>
             <artifactId>druid-spring-boot-starter</artifactId>
@@ -165,13 +165,13 @@
             <version>20160810</version>
         </dependency>
         <!--<dependency>-->
-            <!--<groupId>org.springframework.boot</groupId>-->
-            <!--<artifactId>spring-boot-starter-activemq</artifactId>-->
+        <!--<groupId>org.springframework.boot</groupId>-->
+        <!--<artifactId>spring-boot-starter-activemq</artifactId>-->
         <!--</dependency>-->
         <!--<dependency>-->
-            <!--<groupId>org.apache.activemq</groupId>-->
-            <!--<artifactId>activemq-pool</artifactId>-->
-            <!--<version>5.14.5</version>-->
+        <!--<groupId>org.apache.activemq</groupId>-->
+        <!--<artifactId>activemq-pool</artifactId>-->
+        <!--<version>5.14.5</version>-->
         <!--</dependency>-->
         <!--生成拼音码-->
         <dependency>

+ 12 - 0
src/main/java/cn/hnthyy/thmz/Utils/TokenUtil.java

@@ -64,4 +64,16 @@ public class TokenUtil {
         return (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
     }
 
+
+
+    /**
+     * 获取用户
+     * @param token
+     * @return
+     */
+    public static User getUser(String token){
+        DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
+        return (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
+    }
+
 }

+ 16 - 6
src/main/java/cn/hnthyy/thmz/controller/mz/LoginController.java → src/main/java/cn/hnthyy/thmz/controller/LoginController.java

@@ -1,18 +1,18 @@
-package cn.hnthyy.thmz.controller.mz;
+package cn.hnthyy.thmz.controller;
 
-import cn.hnthyy.thmz.Utils.DateUtil;
-import cn.hnthyy.thmz.Utils.JsonUtil;
-import cn.hnthyy.thmz.Utils.Md5Util;
-import cn.hnthyy.thmz.Utils.TokenUtil;
+import cn.hnthyy.thmz.Utils.*;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.his.mz.Employee;
 import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.entity.thmz.Windows;
 import cn.hnthyy.thmz.enums.WorkingStatusEnum;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.service.his.mz.EmployeeService;
+import cn.hnthyy.thmz.service.thmz.EvaluationService;
 import cn.hnthyy.thmz.service.thmz.TokenService;
 import cn.hnthyy.thmz.service.thmz.UserService;
+import cn.hnthyy.thmz.service.thmz.WindowsService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,7 +31,10 @@ public class LoginController {
     private EmployeeService employeeService;
     @Autowired
     private TokenService tokenService;
-
+    @Autowired
+    private EvaluationService evaluationService;
+    @Autowired
+    private WindowsService windowsService;
     /**
      * 登录
      * @param userParam
@@ -124,6 +127,13 @@ public class LoginController {
             return resultMap;
         }
         tokenService.expiryToken(token);
+        String requestIp = HttpUtil.getIPAddress(request);
+        if (StringUtils.isNotBlank(requestIp)) {
+            Windows windows = windowsService.queryLastWindowsIpAddress(requestIp);
+            if (windows != null && StringUtils.isNotBlank(windows.getClientIpAddress())) {
+                evaluationService.loginOut(windows.getClientIpAddress());
+            }
+        }
         resultMap.put("code", 0);
         resultMap.put("token", token);
         resultMap.put("message", "注销登录成功!");

+ 2 - 1
src/main/java/cn/hnthyy/thmz/controller/NavigationController.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.controller;
 
+import cn.hnthyy.thmz.Utils.HttpUtil;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.entity.thmz.*;
 import cn.hnthyy.thmz.service.thmz.MenuService;
@@ -37,7 +38,7 @@ public class NavigationController {
      */
     @RequestMapping("/login/view")
     public String loginView(HttpServletRequest request) {
-        //System.out.println(HttpUtil.getIPAddress(request)+"---------------------");
+        System.out.println(HttpUtil.getIPAddress(request)+"---------------------");
         return "login";
     }
 

+ 158 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/EvaluationController.java

@@ -0,0 +1,158 @@
+package cn.hnthyy.thmz.controller.mz;
+
+import cn.hnthyy.thmz.Utils.HttpUtil;
+import cn.hnthyy.thmz.Utils.TokenUtil;
+import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.MzException;
+import cn.hnthyy.thmz.entity.thmz.Evaluate;
+import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.service.thmz.EvaluationService;
+import cn.hnthyy.thmz.service.thmz.WindowsService;
+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 javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 评价器接口
+ */
+@Slf4j
+@RestController
+public class EvaluationController {
+    @Autowired
+    private EvaluationService evaluationService;
+    @Autowired
+    private WindowsService windowsService;
+
+//    /**
+//     * 评价器欢迎页面跳转到主页面成功后的回调
+//     *
+//     * @return
+//     */
+//    @RequestMapping(value = "/welcomeToIndexSuccess", method = {RequestMethod.GET})
+//    public Map<String, Object> welcomeToIndexSuccess(HttpServletRequest httpServletRequest) {
+//        Map<String, Object> resultMap = new HashMap<>();
+//        try {
+//            evaluationService.welcomeToIndexSuccess(httpServletRequest);
+//            resultMap.put("code", 0);
+//            resultMap.put("message", "评价器欢迎页面跳转到主页面成功后的回调成功");
+//            resultMap.put("data", evaluationService.getUserInfo(httpServletRequest));
+//            return resultMap;
+//        }catch (Exception e){
+//            e.printStackTrace();
+//            log.error("评价器欢迎页面跳转到主页面成功后的回调失败,错误信息{}",e);
+//            resultMap.put("code", -1);
+//            resultMap.put("message", "评价器欢迎页面跳转到主页面成功后的回调失败");
+//            return resultMap;
+//        }
+//    }
+
+
+    /**
+     * 获取当前登录用户的信息
+     *
+     * @return
+     */
+    @RequestMapping(value = "/getUserInfo", method = {RequestMethod.GET})
+    public Map<String, Object> getUserInfo(HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            resultMap.put("code", 0);
+            resultMap.put("message", "获取当前登录用户的信息成功");
+            resultMap.put("data", evaluationService.getUserInfo(httpServletRequest));
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("获取当前登录用户的信息失败,错误信息{}", e);
+            resultMap.put("code", -1);
+            resultMap.put("message", "获取当前登录用户的信息失败");
+            return resultMap;
+        }
+    }
+
+    /**
+     * 推送价格信息
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/sendPriceInfo", method = {RequestMethod.POST})
+    public Map<String, Object> sendPriceInfo(@RequestBody Map<String, Object> params, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            evaluationService.sendPriceInfo(params, httpServletRequest);
+            resultMap.put("code", 0);
+            resultMap.put("message", "推送价格信息成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("推送价格信息失败,错误信息{}", e);
+            resultMap.put("code", -1);
+            resultMap.put("message", "推送价格信息失败");
+            return resultMap;
+        }
+    }
+
+
+    /**
+     * 跳转到评价页面
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/toEvaluation", method = {RequestMethod.GET})
+    public Map<String, Object> toEvaluation(@RequestParam("patientId") String patientId, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            evaluationService.toEvaluation(patientId, tokenUser, httpServletRequest);
+            resultMap.put("code", 0);
+            resultMap.put("message", "跳转到评价页面成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("跳转到评价页面失败,错误信息{}", e);
+            resultMap.put("code", -1);
+            resultMap.put("message", "跳转到评价页面失败");
+            return resultMap;
+        }
+    }
+
+
+    /**
+     * 保存评价内容
+     *
+     * @param evaluateCode       评分
+     * @param httpServletRequest
+     * @return
+     */
+    @RequestMapping(value = "/saveEvaluation", method = {RequestMethod.GET})
+    public Map<String, Object> saveEvaluation(@RequestParam("evaluateCode") Integer evaluateCode, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            String requestIp = HttpUtil.getIPAddress(httpServletRequest);
+            String audio=evaluationService.saveEvaluate(evaluateCode, requestIp);
+            resultMap.put("code", 0);
+            resultMap.put("message", "保存评价内容成功");
+            if(StringUtils.isNotBlank(audio)){
+                resultMap.put("audio", audio);
+            }
+            return resultMap;
+        } catch (MzException e1) {
+            resultMap.put("code", -1);
+            resultMap.put("message", e1.getMessage());
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("保存评价内容失败,错误信息{}", e);
+            resultMap.put("code", -1);
+            resultMap.put("message", "保存评价内容失败");
+            return resultMap;
+        }
+    }
+
+}

+ 1 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/MzPharmacyController.java

@@ -908,7 +908,7 @@ public class MzPharmacyController {
      * @param message
      * @return
      */
-    @UserLoginToken
+    //@UserLoginToken
     @RequestMapping(value = "/callNumberAudio", method = {RequestMethod.GET})
     public Map<String, Object> callNumberAudio(@RequestParam("message") String message) {
         Map<String, Object> resultMap = new HashMap<>();

+ 67 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/Evaluate.java

@@ -0,0 +1,67 @@
+package cn.hnthyy.thmz.entity.thmz;
+
+import java.io.Serializable;
+
+import cn.hnthyy.thmz.enums.EvaluateEnum;
+import cn.hnthyy.thmz.vo.PageParams;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @Description  评价表
+ * @Author  胡如刚
+ * @Date 2022-04-29 
+ */
+
+@Data
+public class Evaluate extends PageParams implements Serializable {
+
+	private static final long serialVersionUID =  6717056710551182634L;
+
+	/**
+	 * id
+	 */
+	private Long id;
+
+	/**
+	 * 门诊病人id
+	 */
+	private String patientId;
+	/**
+	 * 患者姓名
+	 */
+	private String patientName;
+	/**
+	 * 被评价人编码
+	 */
+	private String userIdCode;
+	/**
+	 * 被评价人姓名
+	 */
+	private String userName;
+	/**
+	 * 评价满意度  0 非常满意  1满意  2 态度不好  3 效率不高  4 业务不熟 5  有待提高
+	 * {@link EvaluateEnum }
+	 */
+	private Integer evaluate;
+
+	/**
+	 * 评价时间
+	 */
+	private Date evaluateTime;
+
+
+	/**
+	 * 开始时间 查询参数
+	 */
+	private String beginDate;
+	/**
+	 * 结束时间 查询参数
+	 */
+	private String endDate;
+	/**
+	 * 通用查询参数
+	 */
+	private String commonParams;
+
+}

+ 40 - 0
src/main/java/cn/hnthyy/thmz/enums/EvaluateEnum.java

@@ -0,0 +1,40 @@
+package cn.hnthyy.thmz.enums;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 满意度
+ */
+public enum EvaluateEnum {
+    GREAT_SATISFACTION(0, "非常满意"),
+    SATISFACTION(1, "满意"),
+    BAD_ATTITUDE(2, "态度不好"),
+    INEFFICIENCY(3, "效率不高"),
+    NOT_FAMILIAR(4, "业务不熟"),
+    NEED_TO_IMPROVE(5, "有待提高");
+
+    public Integer code;
+    public String name;
+
+    EvaluateEnum(Integer code, String name) {
+        this.code = code;
+        this.name = name;
+    }
+
+
+    /**
+     * 根据编码查询对应的类型
+     * @param code
+     * @return
+     */
+    public static EvaluateEnum geteEvaluateByCode(String code){
+        List<EvaluateEnum> evaluateEnums= Arrays.asList(values());
+        for (EvaluateEnum evaluateEnum:evaluateEnums){
+            if(evaluateEnum.code.equals(code)){
+                return evaluateEnum;
+            }
+        }
+        return null;
+    }
+}

+ 5 - 1
src/main/java/cn/hnthyy/thmz/interceptor/AuthenticationInterceptor.java

@@ -6,6 +6,7 @@ import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.AuthException;
 import cn.hnthyy.thmz.entity.thmz.Token;
+import cn.hnthyy.thmz.service.thmz.EvaluationService;
 import cn.hnthyy.thmz.service.thmz.TokenService;
 import com.auth0.jwt.JWT;
 import com.auth0.jwt.JWTVerifier;
@@ -26,7 +27,8 @@ import java.lang.reflect.Method;
 public class AuthenticationInterceptor implements HandlerInterceptor {
     @Autowired
     private TokenService tokenService;
-
+    @Autowired
+    private EvaluationService evaluationService;
     @Override
     public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object object) throws AuthException {
         // 从 http 请求头中取出 token
@@ -63,6 +65,8 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
                 //token超时
                 throw new AuthException("401");
             }
+            //用户已经登录。
+            evaluationService.login(httpServletRequest);
             return true;
         }
         return true;

+ 81 - 0
src/main/java/cn/hnthyy/thmz/mapper/thmz/EvaluateMapper.java

@@ -0,0 +1,81 @@
+package cn.hnthyy.thmz.mapper.thmz;
+
+import cn.hnthyy.thmz.entity.thmz.Evaluate;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Options;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface EvaluateMapper {
+    /**
+     * 保存评价记录
+     *
+     * @param evaluate
+     * @return
+     */
+    @Insert("INSERT INTO t_evaluate(patient_id,patient_name,user_id_code,user_name, evaluate, evaluate_time) VALUES " +
+            "(#{patientId}, #{patientName},#{userIdCode},#{userName}, #{evaluate}, #{evaluateTime})")
+    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+    int insertEvaluate(Evaluate evaluate);
+
+
+    /**
+     * 查询符合条件的总数
+     *
+     * @param evaluate
+     * @return
+     */
+    @Select({"<script>" +
+            "select count(1) from t_evaluate where 1=1" +
+            "<when test='beginDate!=null'>" +
+            " and evaluate_time  <![CDATA[>=]]>#{beginDate} " +
+            "</when>" +
+            "<when test='endDate!=null'>" +
+            " and evaluate_time  <![CDATA[<=]]>#{endDate}" +
+            "</when>" +
+            "<when test='patientId!=null'>" +
+            " and patient_id = #{patientId}" +
+            "</when>" +
+            "<when test='userIdCode!=null'>" +
+            " and user_id_code = #{userIdCode}" +
+            "</when>" +
+            "<when test='commonParams!=null'>" +
+            " and (patient_name like #{commonParams} or patient_id like #{commonParams} or user_id_code like #{commonParams} or user_name like #{commonParams})" +
+            "</when>" +
+            "</script>"})
+    Integer selectCountEvaluate(Evaluate evaluate);
+
+
+    /**
+     * 分页查询评价记录
+     *
+     * @param evaluate
+     * @return
+     */
+    @Select({"<script>" +
+            "select a.id,patient_id, patient_name,user_id_code,user_name,evaluate, evaluate_time from t_evaluate a join  (" +
+            "select id from t_evaluate where 1=1" +
+            "<when test='beginDate!=null'>" +
+            " and evaluate_time  <![CDATA[>=]]>#{beginDate} " +
+            "</when>" +
+            "<when test='endDate!=null'>" +
+            " and evaluate_time  <![CDATA[<=]]>#{endDate}" +
+            "</when>" +
+            "<when test='patientId!=null'>" +
+            " and patient_id = #{patientId}" +
+            "</when>" +
+            "<when test='userIdCode!=null'>" +
+            " and user_id_code = #{userIdCode}" +
+            "</when>" +
+            "<when test='commonParams!=null'>" +
+            " and (patient_name like #{commonParams} or patient_id like #{commonParams} or user_id_code like #{commonParams} or user_name like #{commonParams})" +
+            "</when>" +
+            " order by id desc limit #{offset},#{pageSize} )b on a.id=b.id"
+            + "</script>"})
+    List<Evaluate> selectEvaluateWithPage(Evaluate evaluate);
+
+
+
+
+}

+ 11 - 14
src/main/java/cn/hnthyy/thmz/mapper/thmz/WindowsMapper.java

@@ -15,20 +15,17 @@ public interface WindowsMapper {
     @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     int insertUser(Windows windows);
 
-//    /**
-//     * 查询用户的最后一个在使用中的窗口号
-//     *
-//     * @param userIdCode
-//     * @return
-//     */
-//    @Select({"<script>",
-//            "select id,dept_no,windows_no,print_index,zy_print_index,cg_print_index,user_id_code,ip_address, create_date,update_date from t_windows where user_id_code= #{userIdCode,jdbcType=VARCHAR} " +
-//            "<when test='ipAddress!=null'>",
-//            " or ip_address= #{ipAddress,jdbcType=VARCHAR} ",
-//            "</when>",
-//            "order by create_date desc limit 1",
-//            "</script>"})
-//    Windows selectLastWindowsByUserIdCode(@Param("userIdCode") String userIdCode, @Param("ipAddress") String ipAddress);
+    /**
+     * 查询用户的最后一个在使用中的窗口号
+     *
+     * @param userIdCode
+     * @return
+     */
+    @Select({"<script>",
+            "select id,dept_no,windows_no,print_index,zy_print_index,cg_print_index,user_id_code,ip_address, create_date,update_date from t_windows where user_id_code= #{userIdCode,jdbcType=VARCHAR} " +
+            "order by create_date desc limit 1",
+            "</script>"})
+    Windows selectLastWindowsByUserIdCode(@Param("userIdCode") String userIdCode);
 
 
     /**

+ 213 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/EvaluationServiceImpl.java

@@ -0,0 +1,213 @@
+package cn.hnthyy.thmz.service.impl.thmz;
+
+import cn.hnthyy.thmz.Utils.HttpUtil;
+import cn.hnthyy.thmz.Utils.TokenUtil;
+import cn.hnthyy.thmz.entity.MzException;
+import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
+import cn.hnthyy.thmz.entity.thmz.*;
+import cn.hnthyy.thmz.enums.GenderEnum;
+import cn.hnthyy.thmz.mapper.thmz.EvaluateMapper;
+import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
+import cn.hnthyy.thmz.service.his.mz.MzPharmacyService;
+import cn.hnthyy.thmz.service.thmz.EvaluationService;
+import cn.hnthyy.thmz.service.thmz.RoleService;
+import cn.hnthyy.thmz.service.thmz.UserRoleRelationService;
+import cn.hnthyy.thmz.service.thmz.WindowsService;
+import cn.hnthyy.thmz.socket.EvaluationWebSocket;
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+@Service
+public class EvaluationServiceImpl implements EvaluationService {
+    @Autowired
+    private EvaluationWebSocket evaluationWebSocket;
+    @Autowired
+    private WindowsService windowsService;
+    @Autowired
+    private UserRoleRelationService userRoleRelationService;
+    @Autowired
+    private RoleService roleService;
+    @Autowired
+    private MzPatientMiService mzPatientMiService;
+    @Autowired
+    private MzPharmacyService mzPharmacyService;
+    @SuppressWarnings("all")
+    @Autowired
+    private EvaluateMapper evaluateMapper;
+
+    /**
+     * 客户端与患者的对应关系
+     */
+    private static ConcurrentHashMap<String, Map<String,Object>> clientAndPatientMap = new ConcurrentHashMap<>();
+
+    @Override
+    public void login(HttpServletRequest httpServletRequest) {
+        String requestIp = HttpUtil.getIPAddress(httpServletRequest);
+        if (StringUtils.isBlank(requestIp)) {
+            return;
+        }
+        Windows windows = windowsService.queryLastWindowsIpAddress(requestIp);
+        if (windows == null || StringUtils.isBlank(windows.getClientIpAddress())) {
+            return;
+        }
+        evaluationWebSocket.login(windows.getClientIpAddress());
+    }
+
+    @Override
+    public void loginOut(String clientIpAddress) {
+        Map<String, Object> resultMap = new HashMap();
+        resultMap.put("type", "url");
+        resultMap.put("url", "/thmz/client-welcome");
+        evaluationWebSocket.appointSending(clientIpAddress, JSONObject.valueToString(resultMap));
+    }
+
+
+
+    @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();
+        }
+        return null;
+    }
+
+    @Override
+    public void sendPriceInfo(Map<String, Object> params, HttpServletRequest httpServletRequest) throws MzException {
+        if (params == null) {
+            throw new MzException("推送价格消息到评价器失败,参数为空!");
+        }
+        String patientId = (String) params.get("patientId");
+        if (StringUtils.isBlank(patientId)) {
+            throw new MzException("推送价格消息到评价器失败,患者ID参数为空!");
+        }
+        MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
+        if (mzPatientMi == null) {
+            throw new MzException("推送价格消息到评价器失败,患者信息不存在!");
+        }
+        String name = mzPatientMi.getName();
+        String call = "先生";
+        if(GenderEnum.WOMAN.code.equals(mzPatientMi.getSex())){
+            call = "女士";
+        }
+        if (mzPatientMi.getAge() != null && mzPatientMi.getAge() <= 16) {
+            call = "小朋友";
+        }
+        String requestIp = HttpUtil.getIPAddress(httpServletRequest);
+        if (StringUtils.isBlank(requestIp)) {
+            throw new MzException("推送价格消息到评价器失败,请求客户端IP为空!");
+        }
+        Windows windows = windowsService.queryLastWindowsIpAddress(requestIp);
+        if (windows == null || StringUtils.isBlank(windows.getClientIpAddress())) {
+            throw new MzException("推送价格消息到评价器失败,请求客户端对应的评价器IP为空!");
+        }
+        BigDecimal needPay = new BigDecimal((String) params.get("needPay")).setScale(2, BigDecimal.ROUND_HALF_UP);
+        BigDecimal pay = new BigDecimal((Integer) params.get("pay")).setScale(2, BigDecimal.ROUND_HALF_UP);
+        BigDecimal changeAmount=null;
+        try{
+            changeAmount = new BigDecimal((Integer) params.get("changeAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
+        }catch (ClassCastException e){
+            changeAmount = new BigDecimal((String) params.get("changeAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
+        }
+        params.put("name", name);
+        params.put("call", call);
+        params.put("needPay", needPay.toString());
+        params.put("pay", pay.toString());
+        params.put("changeAmount", changeAmount.toString());
+        String message = name + call + ",您好!您本次就诊,应付金额为" + needPay + "元,实际支付金额为" + pay + "元,应找零金额为" + changeAmount + "元。";
+        String res = mzPharmacyService.callNumberAudio(message);
+        JSONObject resObj = new JSONObject(res);
+        Integer code = (Integer) resObj.get("code");
+        if (code == 200) {
+            params.put("messageAudio", resObj.get("data").toString());
+        }
+        evaluationWebSocket.setPriceInfo(windows.getClientIpAddress(), params);
+        Map<String, Object> resultMap = new HashMap();
+        resultMap.put("type", "url");
+        resultMap.put("url", "/thmz/client-price");
+        evaluationWebSocket.appointSending(windows.getClientIpAddress(), JSONObject.valueToString(resultMap));
+    }
+
+    @Override
+    public void toEvaluation(String patientId,User tokenUser,HttpServletRequest httpServletRequest) {
+        String requestIp = HttpUtil.getIPAddress(httpServletRequest);
+        if (StringUtils.isBlank(requestIp)) {
+            return;
+        }
+        Windows windows = windowsService.queryLastWindowsIpAddress(requestIp);
+        if (windows == null || StringUtils.isBlank(windows.getClientIpAddress())) {
+            return;
+        }
+        Map<String,Object> clientMap = new HashMap<>();
+        clientMap.put("patientId",patientId);
+        clientMap.put("tokenUser",tokenUser);
+        clientAndPatientMap.put(windows.getClientIpAddress(),clientMap);
+        Map<String, Object> resultMap = new HashMap();
+        resultMap.put("type", "url");
+        resultMap.put("url", "/thmz/client-evaluate");
+        evaluationWebSocket.appointSending(windows.getClientIpAddress(), JSONObject.valueToString(resultMap));
+    }
+
+    @Override
+    public String saveEvaluate(Integer evaluateCode,String requestIp) throws MzException {
+        Map<String,Object> clientMap =clientAndPatientMap.get(requestIp);
+        if(clientMap==null){
+            throw new MzException("当前评价器没有患者信息");
+        }
+        String patientId=(String)clientMap.get("patientId");
+        if(StringUtils.isBlank(patientId)){
+            throw new MzException("当前评价器没有患者信息");
+        }
+        User tokenUser=(User)clientMap.get("tokenUser");
+        if(tokenUser==null || StringUtils.isBlank(tokenUser.getUserIdCode()) || StringUtils.isBlank(tokenUser.getUserName())){
+            throw new MzException("当前评价器没有被评价人信息");
+        }
+        MzPatientMi mzPatientMi=mzPatientMiService.queryByPatientId(patientId);
+        if(mzPatientMi==null || StringUtils.isBlank(mzPatientMi.getName())){
+            throw new MzException("患者信息不正确");
+        }
+        Evaluate evaluate= new Evaluate();
+        evaluate.setEvaluate(evaluateCode);
+        evaluate.setPatientId(patientId);
+        evaluate.setPatientName(mzPatientMi.getName());
+        evaluate.setUserIdCode(tokenUser.getUserIdCode());
+        evaluate.setUserName(tokenUser.getUserName());
+        evaluate.setEvaluateTime(new Date());
+        evaluateMapper.insertEvaluate(evaluate);
+        String res = mzPharmacyService.callNumberAudio("感谢您对我的评价,再见!");
+        JSONObject resObj = new JSONObject(res);
+        Integer code = (Integer) resObj.get("code");
+        if (code == 200) {
+            return resObj.get("data").toString();
+        }
+        return null;
+    }
+
+    @Override
+    public Integer queryCountEvaluate(Evaluate evaluate) {
+        return evaluateMapper.selectCountEvaluate(evaluate);
+    }
+
+    @Override
+    public List<Evaluate> queryEvaluateWithPage(Evaluate evaluate) {
+        return evaluateMapper.selectEvaluateWithPage(evaluate);
+    }
+}

+ 17 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/TokenServiceImpl.java

@@ -2,9 +2,14 @@ package cn.hnthyy.thmz.service.impl.thmz;
 
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.entity.thmz.Token;
+import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.entity.thmz.Windows;
 import cn.hnthyy.thmz.mapper.thmz.TokenMapper;
+import cn.hnthyy.thmz.service.thmz.EvaluationService;
 import cn.hnthyy.thmz.service.thmz.TokenService;
+import cn.hnthyy.thmz.service.thmz.WindowsService;
 import com.auth0.jwt.interfaces.DecodedJWT;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -15,6 +20,10 @@ public class TokenServiceImpl implements TokenService {
     @SuppressWarnings("all")
     @Autowired
     private TokenMapper tokenMapper;
+    @Autowired
+    private EvaluationService evaluationService;
+    @Autowired
+    private WindowsService windowsService;
     //token 缓存
     private Map<String,Token> catchMap = new HashMap<>();
 
@@ -72,6 +81,14 @@ public class TokenServiceImpl implements TokenService {
                 if(token!=null && token.getDeadTime().before(now)){
                     tokenMapper.deleteById(token.getId());
                     it.remove();
+                    User user= TokenUtil.getUser(token.getToken());
+                    if(user!=null && StringUtils.isNotBlank(user.getUserIdCode())){
+                        Windows windows= windowsService.queryLastWindowsByUserIdCode(user.getUserIdCode());
+                        if(windows!=null && StringUtils.isNotBlank(windows.getClientIpAddress())){
+                            evaluationService.loginOut(windows.getClientIpAddress());
+                        }
+                    }
+
                 }
             }
         }

+ 4 - 4
src/main/java/cn/hnthyy/thmz/service/impl/thmz/WindowsServiceImpl.java

@@ -23,10 +23,10 @@ public class WindowsServiceImpl implements WindowsService {
 
     }
 
-//    @Override
-//    public Windows queryLastWindowsByUserIdCode(String userIdCode,String ipAddress) {
-//        return windowsMapper.selectLastWindowsByUserIdCode(userIdCode,ipAddress);
-//    }
+    @Override
+    public Windows queryLastWindowsByUserIdCode(String userIdCode) {
+        return windowsMapper.selectLastWindowsByUserIdCode(userIdCode);
+    }
 
     @Override
     public Windows queryLastWindowsIpAddress(String ipAddress) {

+ 77 - 0
src/main/java/cn/hnthyy/thmz/service/thmz/EvaluationService.java

@@ -0,0 +1,77 @@
+package cn.hnthyy.thmz.service.thmz;
+
+
+import cn.hnthyy.thmz.entity.MzException;
+import cn.hnthyy.thmz.entity.thmz.Evaluate;
+import cn.hnthyy.thmz.entity.thmz.User;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+import java.util.Map;
+
+public interface EvaluationService {
+    /**
+     * 评价器登录  收费员的请求中会做拦截判断当前收费员是否登录,如果登录就判断是否已经跳到评价器主页,已跳转不做处理,未跳转就跳转
+     * @param httpServletRequest
+     */
+    void login(HttpServletRequest httpServletRequest);
+
+    /**
+     * 评价器退出登录  退出登录,客户端页面退回到欢迎页面
+     * @param clientIpAddress  评价器客户端的ip地址
+     */
+    void loginOut(String clientIpAddress);
+
+    /**
+     * 获取当前登录用户的信息
+     * @param httpServletRequest
+     * @return
+     */
+    Map<String,Object> getUserInfo(HttpServletRequest httpServletRequest);
+
+
+    /**
+     * 发送价格信息
+     * @param params
+     * @param httpServletRequest
+     * @return
+     */
+    void sendPriceInfo(Map<String,Object> params,HttpServletRequest httpServletRequest) throws MzException;
+
+    /**
+     * 跳转到评价页面
+     * @param patientId 门诊id
+     * @param tokenUser 当前操作人
+     * @param httpServletRequest
+     */
+    void toEvaluation(String patientId, User tokenUser, HttpServletRequest httpServletRequest);
+
+    /**
+     * 保存评价记录
+     *
+     * @param evaluateCode 评分
+     * @param requestIp 当前评价的评价器客户端的ip地址
+     * @return 感谢评价的播音
+     */
+
+    String saveEvaluate(Integer evaluateCode,String requestIp) throws MzException;
+
+
+    /**
+     * 查询符合条件的总数
+     *
+     * @param evaluate
+     * @return
+     */
+
+    Integer queryCountEvaluate(Evaluate evaluate);
+
+
+    /**
+     * 分页查询评价记录
+     *
+     * @param evaluate
+     * @return
+     */
+    List<Evaluate> queryEvaluateWithPage(Evaluate evaluate);
+}

+ 6 - 6
src/main/java/cn/hnthyy/thmz/service/thmz/WindowsService.java

@@ -11,12 +11,12 @@ public interface WindowsService {
      */
     int saveWindows(Windows windows);
 
-//    /**
-//     * 查询用户的最后一个在使用中的窗口号
-//     * @param userIdCode
-//     * @return
-//     */
-//    Windows queryLastWindowsByUserIdCode(String userIdCode,String ipAddress);
+    /**
+     * 查询用户的最后一个在使用中的窗口号
+     * @param userIdCode
+     * @return
+     */
+    Windows queryLastWindowsByUserIdCode(String userIdCode);
 
     /**
      * 查询IP地址的最后一个在使用中的窗口号

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

@@ -0,0 +1,170 @@
+package cn.hnthyy.thmz.socket;
+
+import lombok.extern.slf4j.Slf4j;
+import org.json.JSONObject;
+import org.springframework.stereotype.Component;
+
+import javax.websocket.OnClose;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.server.PathParam;
+import javax.websocket.server.ServerEndpoint;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+
+/**
+ * @Description: EvaluationWebSocket 评价器webSocket服务类
+ * @ServerEndpoint 这个注解有什么作用?
+ * <p>
+ * 这个注解用于标识作用在类上,它的主要功能是把当前类标识成一个WebSocket的服务端
+ * 注解的值用户客户端连接访问的URL地址
+ */
+
+@Slf4j
+@Component
+@ServerEndpoint("/evaluationWebSocket/{clientIp}/{source}")
+public class EvaluationWebSocket {
+
+    /**
+     * 与某个客户端的连接对话,需要通过它来给客户端发送消息
+     */
+    private Session session;
+
+    /**
+     * 标识当前连接客户端的IP
+     */
+    private String clientIp;
+
+    /**
+     * 请求的来源
+     */
+    private String source;
+
+    /**
+     * 用于存所有的连接服务的客户端,这个对象存储是安全的
+     */
+    private static ConcurrentHashMap<String, EvaluationWebSocket> webSocketSet = new ConcurrentHashMap<>();
+
+    /**
+     * 用于存所有待推送的价格信息,因为建立价格连接和推送消息是两步,会断开,所以缓存起来
+     */
+    private static ConcurrentHashMap<String, Map<String, Object>> priceMap = new ConcurrentHashMap<>();
+
+    /**
+     * 保存登录到换页的评价器ip
+     */
+    private static Set<String> welcomeSet = Collections.newSetFromMap(new ConcurrentHashMap<>(30));
+
+    @OnOpen
+    public void onOpen(Session session, @PathParam(value = "clientIp") String clientIp, @PathParam(value = "source") String source) {
+        this.session = session;
+        this.source = source;
+        this.clientIp = clientIp;
+        // clientIp是用来表示唯一客户端,如果需要指定发送,需要指定发送通过clientIp来区分
+        webSocketSet.put(clientIp, this);
+        if ("client_welcome".equals(source)) {
+            welcomeSet.add(clientIp);
+        }
+        Map<String, Object> messageMap = priceMap.get(clientIp);
+        if (messageMap != null) {
+            messageMap.put("type", "priceData");
+            appointSending(clientIp, JSONObject.valueToString(messageMap));
+            priceMap.remove(clientIp);
+        }
+        log.info("[WebSocket] 连接成功,当前连接人数为:={}", webSocketSet.size());
+    }
+
+
+    @OnClose
+    public void onClose() {
+        webSocketSet.remove(this.clientIp);
+        log.info("[WebSocket] 退出成功,当前连接人数为:={}", webSocketSet.size());
+    }
+
+    @OnMessage
+    public void onMessage(String message) {
+        log.info("[WebSocket] 收到消息:{}", message);
+        //判断是否需要指定发送,具体规则自定义
+        if (message.indexOf("TOUSER") == 0) {
+            String name = message.substring(message.indexOf("TOUSER") + 6, message.indexOf(";"));
+            appointSending(name, message.substring(message.indexOf(";") + 1, message.length()));
+        } else {
+            groupSending(message);
+        }
+
+    }
+
+    /**
+     * 群发
+     *
+     * @param message
+     */
+    public void groupSending(String message) {
+        for (String name : webSocketSet.keySet()) {
+            try {
+                webSocketSet.get(name).session.getBasicRemote().sendText(message);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * 指定发送
+     *
+     * @param clientIp
+     * @param message
+     */
+    public void appointSending(String clientIp, String message) {
+        try {
+            Session session = webSocketSet.get(clientIp).session;
+            synchronized (session) {
+                session.getBasicRemote().sendText(message);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 判断评价器客户端是否已经登录
+     *
+     * @param clientIp
+     * @return true 已经登录  false  没有登录
+     */
+    public boolean isLogin(String clientIp) {
+        return !welcomeSet.contains(clientIp);
+    }
+
+    /**
+     * 评价器客户端登录
+     *
+     * @param clientIp
+     */
+    public void login(String clientIp) {
+        if (isLogin(clientIp)) {
+            return;
+        }
+        welcomeSet.remove(clientIp);
+        Map<String, Object> resultMap = new HashMap();
+        resultMap.put("type", "url");
+        resultMap.put("url", "/thmz/client-index");
+        appointSending(clientIp, JSONObject.valueToString(resultMap));
+    }
+
+
+    /**
+     * 设置待发送的价格信息
+     *
+     * @param clientIp
+     * @param params
+     */
+    public void setPriceInfo(String clientIp, Map<String, Object> params) {
+        priceMap.put(clientIp, params);
+    }
+}

+ 33 - 0
src/main/resources/static/js/common/date-util.js

@@ -371,3 +371,36 @@ function daterangepickerWithIdAndCallBack(id,callback) {
     });
 }
 
+
+/**
+ * 获取星期
+ */
+function getWeek() {
+    var tempDate = new Date();
+    var days = tempDate.getDay();
+    var week;
+    switch(days) {
+        case 1:
+            week = '星期一';
+            break;
+        case 2:
+            week = '星期二';
+            break;
+        case 3:
+            week = '星期三';
+            break;
+        case 4:
+            week = '星期四';
+            break;
+        case 5:
+            week = '星期五';
+            break;
+        case 6:
+            week = '星期六';
+            break;
+        case 0:
+            week = '星期日';
+            break;
+    }
+    return week;
+}

+ 60 - 0
src/main/resources/static/js/common/evaluation-websocket.js

@@ -0,0 +1,60 @@
+var websocket = null;
+var ipAddress = "";
+
+/**
+ * 创建webSocket
+ * @param type
+ */
+function openEvaluationWebSocket(type) {
+    if (!ipAddress) {
+        getUserIP(function(ip) {
+            ipAddress = ip
+            if('WebSocket' in window){
+                websocket = new WebSocket("ws://172.16.32.161:81/thmz/evaluationWebSocket/"+ipAddress+"/"+type);
+            }else{
+                alert('当前浏览器不支持WebSocket,请更换浏览器');
+            }
+            websocket.onerror = function(){
+                console.log("连接出错");
+            }
+            websocket.onopen = function(){
+                console.log("连接成功");
+            }
+            websocket.onmessage  = function(event){
+                var data = JSON.parse(event.data);
+                if(data.type=="url"){
+                    window.open(data.url, '_self');
+                    return;
+                }
+                //推送价格
+                if(data.type=="priceData"){
+                    $("#pName").text(data.name);
+                    $("#pGender").text(data.call);
+                    $("#needPay").text(data.needPay);
+                    $("#pay").text(data.pay);
+                    $("#changeAmount").text(data.changeAmount);
+                    //播放语音
+                    var mp3 = new Audio(data.messageAudio);
+                    mp3.play();
+                    return;
+                }
+                console.log("收到消息" + event.data);
+            }
+            websocket.onclose = function(){
+                console.log("退出连接");
+            }
+            window.onbeforeunload = function(){
+                clos();
+            }
+
+            function clos(){
+                websocket.close(3000,"强制关闭");
+            }
+            function send(){
+                var msg = document.getElementById('text').value;
+                websocket.send(msg);
+            }
+        })
+    }
+}
+

+ 40 - 0
src/main/resources/static/js/common/ip-util.js

@@ -0,0 +1,40 @@
+// 获取用户ip
+function getUserIP(onNewIP) { //  onNewIp - your listener function for new IPs
+    //compatibility for firefox and chrome
+    var myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
+    var pc = new myPeerConnection({
+            iceServers: []
+        }),
+        noop = function () {
+        },
+        localIPs = {},
+        ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g
+
+    function iterateIP(ip) {
+        if (!localIPs[ip]) onNewIP(ip)
+        localIPs[ip] = true
+    }
+
+    //create a bogus data channel
+    pc.createDataChannel("")
+    // create offer and set local description
+    try {
+        pc.createOffer(function (sdp) {
+            sdp.sdp.split('\n').forEach(function (line) {
+                if (line.indexOf('candidate') < 0) return
+                line.match(ipRegex).forEach(iterateIP)
+            })
+
+            pc.setLocalDescription(sdp, noop, noop)
+        }, function (sdp) {
+            console.log('fail')
+        })
+    } catch (err) {
+        console.log(err)
+    }
+    //listen for candidate events
+    pc.onicecandidate = function (ice) {
+        if (!ice || !ice.candidate || !ice.candidate.candidate || !ice.candidate.candidate.match(ipRegex)) return
+        ice.candidate.candidate.match(ipRegex).forEach(iterateIP)
+    };
+}

+ 30 - 60
src/main/resources/static/js/common/pad-util.js

@@ -1,83 +1,53 @@
-function encodeUnicode(str) {
-    var res = [];
-    for (var i = 0; i < str.length; i++) {
-        res[i] = ("00" + str.charCodeAt(i).toString(16)).slice(-4);
-    }
-    return  "\\u" + res.join("\\u");
-}
-
-
-function sendData(d) {
-    console.log(d);
+/**
+ * 跳转到评价页面
+ * @param patientId 门诊病人id
+ */
+function toEvaluation(patientId) {
     $.ajax({
-        type:"get",
-        crossDomain:true,
-        url:"http://localhost:8320/api",
-        data: "data=" + d,
-        success:function (ret) {
-            console.log(ret);
-        },
-        error:function(){
-            console.error("get error");
+        type: "GET",
+        url: '/thmz/toEvaluation?patientId='+patientId,
+        contentType: "application/json;charset=UTF-8",
+        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;
+            }
+            if (res.code != 0) {
+                alert(res.message);
+            }
         }
     });
 }
 
-
-function postCMD(cmd,UserID,UserPsw,ItemName,Coast,Pay,Change,GuestName,Msg,Self,free,PatNo) {
-    var d = {}; // new object();
-    d.CMD = cmd;
-    d.UserID = UserID;
-    d.UserPsw = UserPsw;
-    d.ItemName = encodeUnicode(ItemName);
-    d.Coast = Coast;
-    d.Pay = Pay;
-    d.Change = Change;
-    d.GuestName=encodeUnicode(GuestName);
-    d.Msg = encodeUnicode(Msg);
-    d.Self = Self;
-    d.free = free;
-    d.PatNo = PatNo;
-    sendData(JSON.stringify(d));
-    //console.log(d);
-    //console.log(JSON.stringify(d));
-}
-
-
 /**
  * 推送价格信息
- * @param data 应收金额
+ * @param needPay 应收金额
  * @Pay Pay 实收金额
  * @param changeAmount  找零金额
- * @param message 语音消息
  * @param patientId 门诊病人id
- * @param name 病人姓名
  */
-function sendPeiceMessage(data,pay,changeAmount,message,patientId,name) {
+function sendPriceMessage(needPay,pay,changeAmount,patientId) {
     $.ajax({
-        type: "GET",
-        url: '/thmz/getByPatientId?patientId=' + patientId,
+        type: "POST",
+        url: '/thmz/sendPriceInfo',
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
+        data: JSON.stringify({
+            "patientId": patientId,
+            "needPay": needPay,
+            "pay": pay,
+            "changeAmount": changeAmount
+        }),
         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) {
-                if (res.data != null) {
-                    var gender= res.data.sex==1?"先生":"女士";
-                    var age=$("#age").val();
-                    if(age==undefined || age==null){
-                        age = res.data.age;
-                    }
-                    if(age<16){
-                        gender="小朋友";
-                    }
-                    message=name+gender+message;
-                    postCMD("price",localStorage.getItem("userID"),'000000','收费项目',parseFloat(data).toFixed(2),parseFloat(pay).toFixed(2),parseFloat(changeAmount).toFixed(2), name,message,parseFloat(data).toFixed(2),parseFloat(0).toFixed(2),res.data.phoneNo);
-                }
+            if (res.code != 0) {
+                alert(res.message);
             }
         }
     });

+ 0 - 2
src/main/resources/static/js/menu.js

@@ -74,7 +74,6 @@ $(function () {
         }
 
     });
-    postCMD("connect",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
 });
 
 
@@ -145,7 +144,6 @@ function loginOut() {
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
         success: function (result) {
             if (result == '401' || result == 401 || result.code == 0) {
-                postCMD("logout",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
                 window.location.href = '/thmz/login/view'
                 return;
             }

+ 19 - 28
src/main/resources/static/js/mz/charge_list.js

@@ -97,8 +97,8 @@ function initChargeListByPatient() {
                 align: "center",
                 valign: 'middle',
                 formatter: function (value, row, index) {
-                    if(value==null || value==undefined){
-                        value="";
+                    if (value == null || value == undefined) {
+                        value = "";
                     }
                     var text = value;
                     if (row.serial_no < 0) {
@@ -155,13 +155,7 @@ function initChargeListByPatient() {
             var ress = eval(res);
             if (ress.code == -1) {
                 if (ress.message != null && ress.message != '') {
-                    new PNotify({
-                        title: '错误提示',
-                        text: ress.message,
-                        type: 'error',
-                        hide: true,
-                        styling: 'bootstrap3'
-                    });
+                    errorMesage(ress);
                 }
                 return {
                     "total": 0,//总页数
@@ -305,21 +299,20 @@ function print() {
     LODOP.ADD_PRINT_HTM(26, "5%", "90%", 109, document.getElementById("right_title").innerHTML);
     LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
     LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
-    LODOP.ADD_PRINT_HTM(950,"5%","90%",54,document.getElementById("foot").innerHTML);
-    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
-    LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);
+    LODOP.ADD_PRINT_HTM(950, "5%", "90%", 54, document.getElementById("foot").innerHTML);
+    LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
+    LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
     LODOP.PRINT();
     //LODOP.PREVIEW();
 }
 
 
-
 /**
  * 查询同一病人所有收费明细
  */
 function fitAllfymx() {
-    var patientId=$("#patientId").val();
-    if(patientId ==undefined || patientId==null || patientId==""){
+    var patientId = $("#patientId").val();
+    if (patientId == undefined || patientId == null || patientId == "") {
         return;
     }
     var rePortRangeArr = getRePortRangeArr();
@@ -333,7 +326,7 @@ function fitAllfymx() {
             patientId: $("#patientId").val(),
             beginDate: rePortRangeArr[0],
             endDate: rePortRangeArr[1]
-           // ,hisData: $('#hisData').is(':checked') ? 0 : 1
+            // ,hisData: $('#hisData').is(':checked') ? 0 : 1
         }),
         success: function (res) {
             if (res == '401' || res == 401) {
@@ -393,17 +386,15 @@ function fitfymx(patientId, serialNo) {
 }
 
 
-
-
 function formatMx(res) {
     $("#receiptBillList").empty();
     $("#receiptBillList").append('<div style="font-weight: 700;margin-left: 8px;padding-top: 4px;padding-bottom: 4px;"><span style="margin-left: 32px;font-size: 13px;">发票:</span><span id="receipt_no" style="margin-left: 50px;"></span></div>');
     if (res.data != null && res.data.length > 0) {
         $("#serialNo_t").html("机制号:" + res.data[0].real_no);
         $("#doctor").html("医生:" + res.data[0].doctor_code);
-        if(res.mzReceiptSerial!=undefined && res.mzReceiptSerial!=null){
+        if (res.mzReceiptSerial != undefined && res.mzReceiptSerial != null) {
             $("#cashId").html("收费员:" + res.mzReceiptSerial.operatorId);
-        }else {
+        } else {
             $("#cashId").html("收费员:" + res.data[0].op_id);
         }
         $("#patientId_t").html("门诊号:" + res.data[0].patient_id);
@@ -431,19 +422,19 @@ function formatMx(res) {
             html += ' <td width="6%" style="padding-left: 8px;padding-top: 4px;">' + temp.total_price.toFixed(2) + '</td>';
             html += "</tr>";
         }
-        html+='<tr><td colspan="8"><div style="border:0;border-top:1px solid #000;overflow:hidden;font-size: 13px;"><div style="float: right;font-weight: 700;padding-top: 4px;padding-bottom: 4px;"><span>金额合计:</span><span id="total_count" style="margin-left: 50px;"></span></div></div></td></tr>';
+        html += '<tr><td colspan="8"><div style="border:0;border-top:1px solid #000;overflow:hidden;font-size: 13px;"><div style="float: right;font-weight: 700;padding-top: 4px;padding-bottom: 4px;"><span>金额合计:</span><span id="total_count" style="margin-left: 50px;"></span></div></div></td></tr>';
         $("#fymx_table_body").html(html);
-        if (res.mzReceiptSerial!= undefined && res.mzReceiptSerial != null) {
+        if (res.mzReceiptSerial != undefined && res.mzReceiptSerial != null) {
             $("#receipt_no").html(res.mzReceiptSerial.receiptBill);
-        }else {
+        } else {
             $("#receipt_no").html("");
         }
-        if (res.receiptBillList!=null && res.receiptBillList.length>0){
-            for (var i=0;i<res.receiptBillList.length;i++){
-                if(i==0){
+        if (res.receiptBillList != null && res.receiptBillList.length > 0) {
+            for (var i = 0; i < res.receiptBillList.length; i++) {
+                if (i == 0) {
                     $("#receipt_no").html(res.receiptBillList[0]);
-                }else if (i>0){
-                    $("#receiptBillList").append('<div style="font-weight: 700;margin-left: 8px;padding-top: 4px;padding-bottom: 4px;"><span style="margin-left: 32px;font-size: 13px;color: white;">发票:</span><span style="margin-left: 50px;">'+res.receiptBillList[i]+'</span></div>');
+                } else if (i > 0) {
+                    $("#receiptBillList").append('<div style="font-weight: 700;margin-left: 8px;padding-top: 4px;padding-bottom: 4px;"><span style="margin-left: 32px;font-size: 13px;color: white;">发票:</span><span style="margin-left: 50px;">' + res.receiptBillList[i] + '</span></div>');
                 }
             }
         }

+ 62 - 2
src/main/resources/static/js/mz/client_evaluate.js

@@ -1,6 +1,66 @@
 //@ sourceURL=client_evaluate.js
 $(function (){
-    imgFun("/thmz/download-client-profile", "headImage");
-});
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getUserInfo',
+        contentType: "application/json;charset=UTF-8",
+        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;
+            }
+            if (res.code == 0) {
+                $("#name").text(res.data.name);
+                $("#role").text(res.data.role);
+                $("#userCode").text(res.data.userCode);
+                imgFun("/thmz/download?id="+res.data.clientProfileImage, "headImage");
+                var date = new Date();
+                $("#dateNow").text(format(date, "yyyy-MM-dd"));
+                $("#time").text(format(date, "HH:mm")+" "+getWeek());
+            }
+        }
+    });
+    //生成语音
+    $.ajax({
+        type: "GET",
+        url: '/thmz/callNumberAudio?message=请您对我的服务进行评价',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res.code == 0) {
+                //播放后台生成的叫号语音
+                var mp3 = new Audio(res.data);
+                mp3.play();
+            }
+        }
+    });
 
+});
 
+/**
+ * 提交评分
+ * @param evaluateCode
+ */
+function saveEvaluation(evaluateCode) {
+    $.ajax({
+        type: "GET",
+        url: '/thmz/saveEvaluation?evaluateCode='+evaluateCode,
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res.code == 0) {
+                if(res.audio!=undefined && res.audio!=null)
+                //播放后台生成的叫号语音
+                var mp3 = new Audio(res.audio);
+                mp3.play();
+                setTimeout(function () {
+                    window.location.href='/thmz/client-index';
+                }, 3000);
+            }
+        }
+    });
+}

+ 23 - 1
src/main/resources/static/js/mz/client_index.js

@@ -1,6 +1,28 @@
 //@ sourceURL=client_index.js
 $(function (){
-    imgFun("/thmz/download-client-profile", "headImage");
+    openEvaluationWebSocket("client_index");
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getUserInfo',
+        contentType: "application/json;charset=UTF-8",
+        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;
+            }
+            if (res.code == 0) {
+                $("#name").text(res.data.name);
+                $("#role").text(res.data.role);
+                $("#userCode").text(res.data.userCode);
+                imgFun("/thmz/download?id="+res.data.clientProfileImage, "headImage");
+                var date = new Date();
+                $("#dateNow").text(format(date, "yyyy-MM-dd"));
+                $("#time").text(format(date, "HH:mm")+" "+getWeek());
+            }
+        }
+    });
 });
 
 

+ 13 - 28
src/main/resources/static/js/mz/client_price.js

@@ -1,43 +1,28 @@
 //@ sourceURL=client_price.js
 $(function (){
-    imgFun("/thmz/download-client-profile", "headImage");
-
-    //生成语音
-    var message="刘阳女士,您好!您本次就诊,应付金额为580.00元, 实际支付金额为600.00元,应找零金额为20.00元。";
+    openEvaluationWebSocket("client_price");
     $.ajax({
         type: "GET",
-        url: '/thmz/callNumberAudio?message='+message,
+        url: '/thmz/getUserInfo',
         contentType: "application/json;charset=UTF-8",
         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;
+            }
             if (res.code == 0) {
-                //播放后台生成的叫号语音
-                var mp3 = new Audio(res.data);
-                mp3.play();
+                $("#name").text(res.data.name);
+                $("#role").text(res.data.role);
+                $("#userCode").text(res.data.userCode);
+                imgFun("/thmz/download?id="+res.data.clientProfileImage, "headImage");
+                var date = new Date();
+                $("#dateNow").text(format(date, "yyyy-MM-dd"));
+                $("#time").text(format(date, "HH:mm")+" "+getWeek());
             }
         }
     });
-
-
-    // setInterval(function () {
-    //     //生成语音
-    //     var message="刘阳女士,您好!您本次就诊,应付金额为580.00元, 实际支付金额为600.00元,应找零金额为20.00元。";
-    //     $.ajax({
-    //         type: "GET",
-    //         url: '/thmz/callNumberAudio?message='+message,
-    //         contentType: "application/json;charset=UTF-8",
-    //         dataType: "json",
-    //         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
-    //         success: function (res) {
-    //             if (res.code == 0) {
-    //                 //播放后台生成的叫号语音
-    //                 var mp3 = new Audio(res.data);
-    //                 mp3.play();
-    //             }
-    //         }
-    //     });
-    // }, 10000);
 });
 
 

+ 1 - 0
src/main/resources/static/js/mz/client_welcome.js

@@ -1,6 +1,7 @@
 //@ sourceURL=client_welcome.js
 $(function (){
     $.backstretch("../../thmz/images/backgrounds/back3.jpg");
+    openEvaluationWebSocket("client_welcome");
 });
 
 

+ 13 - 45
src/main/resources/static/js/mz/registration.js

@@ -7,7 +7,7 @@ var pageIndex = 0;
 var LODOP; //声明为全局变量
 //默认打印机下标
 var printIndex = -1;
-var clipboard=null;
+var clipboard = null;
 var TableInit = function () {
     var oTableInit = new Object();
     //初始化Table
@@ -357,12 +357,6 @@ $(function () {
     $("#userName").change(function (e) {
         queryUserInfoByName();
     });
-
-    // postCMD("connect",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
-    // setTimeout(function () {
-    //     postCMD("login",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
-    // }, 600);
-    postCMD("login", localStorage.getItem("userID"), '000000', '收费项目', 0, 0, 0, '', '祝您早日康复', 0, 0, 0);
     setTimeout(function () {
         getLodop();
     }, 800);
@@ -789,7 +783,7 @@ function confirmFeeModal() {
     $("#cash").val($("#amountMoneyConfirm").text());
     //$("#cash").val(null);
     $("#confirmFeeModal").modal();
-    sendPeiceMessage($("#amountMoneyConfirm").text(), 0, 0, '您本次应付金额为' + $("#amountMoneyConfirm").text() + '元', $("#patientId").val(), $("#userNameReadOnly").val());
+    sendPriceMessage($("#amountMoneyConfirm").text(), 0, 0, $("#patientId").val());
 }
 
 /**
@@ -886,32 +880,20 @@ function checkFee() {
     realMoney = realMoney.toFixed(2);
     $("#realMoney").val(realMoney)
     if (cash < realMoney) {
-        new PNotify({
-            title: '错误提示',
-            text: "收款金额不能少于实收金额!",
-            type: 'error',
-            hide: true,
-            styling: 'bootstrap3'
-        });
+        errorMesageSimaple("收款金额不能少于实收金额!");
         return;
     } else if (cash > realMoney) {
         if ($("#payType").val() == 1) {
             var changeAmount = cash - realMoney;
             $("#changeAmount").val(changeAmount.toFixed(2));
-            sendPeiceMessage(realMoney, cash, changeAmount.toFixed(2), '实际支付金额为' + cash + '元,应找零' + changeAmount + '元', $("#patientId").val(), $("#userNameReadOnly").val());
+            sendPriceMessage(realMoney, cash, changeAmount.toFixed(2), $("#patientId").val());
         } else {
-            new PNotify({
-                title: '错误提示',
-                text: "非现金收款金额不能大于实收金额!",
-                type: 'error',
-                hide: true,
-                styling: 'bootstrap3'
-            });
+            errorMesageSimaple("非现金收款金额不能大于实收金额!");
             return;
         }
     } else {
         $("#changeAmount").val(0.00);
-        sendPeiceMessage(realMoney, cash, 0.00, '实际支付金额为' + cash + '元', $("#patientId").val(), $("#userNameReadOnly").val());
+        sendPriceMessage(realMoney, cash, 0.00, $("#patientId").val());
     }
     //计算和设置折扣比例
     var amountMoneyConfirm = parseFloat($("#amountMoneyConfirm").text());
@@ -1518,27 +1500,15 @@ function saveMzyReqrec() {
                 return;
             }
             if (res.code == 0) {
-                new PNotify({
-                    title: '操作提示',
-                    text: res.message,
-                    type: 'success',
-                    hide: true,
-                    styling: 'bootstrap3'
-                });
+                successMesage(res);
                 $('#confirmFeeModal').modal('hide');
                 prn1Print(patientId, -1);
                 // loadTableCount();
                 // loadRegistrationList(true);
                 clearRegistration();
-                postCMD("appraise", localStorage.getItem("userID"), '000000', '收费项目', 0, 0, 0, '', '祝您早日康复', 0, 0, 0);
+                toEvaluation(patientId);
             } else {
-                new PNotify({
-                    title: '错误提示',
-                    text: res.message,
-                    type: 'error',
-                    hide: true,
-                    styling: 'bootstrap3'
-                });
+                errorMesage(res);
             }
             $("#saveConfirmFee").attr("disabled", false);
         }
@@ -1684,7 +1654,7 @@ function siReadCard() {
             }
         }
     });
-   // window.open('ReadCard://'+prm, '_self')
+    // window.open('ReadCard://'+prm, '_self')
 }
 
 
@@ -2009,8 +1979,6 @@ function chargeFeeNucleicAcid() {
 }
 
 
-
-
 /**
  * 创建核酸检查(混检)处方并保存
  */
@@ -2074,11 +2042,11 @@ function chargeFeeHybridTest() {
  * 复制地址
  */
 function copyAddress() {
-    if(clipboard!=null){
+    if (clipboard != null) {
         clipboard.destroy();
     }
-    clipboard = new ClipboardJS('#copyAddress',{
-        text: function(trigger) {
+    clipboard = new ClipboardJS('#copyAddress', {
+        text: function (trigger) {
             alert("复制成功!");
             return trigger.getAttribute('data-clipboard-text');
         }

+ 4 - 49
src/main/resources/static/js/mz/toll_administration.js

@@ -39,45 +39,6 @@ $(function () {
         getLodop();
     }, 800);
 
-    // $("#editPrint").on("click", function (t) {
-    //     CreatePrinterList();
-    //     $("#editPrintModal").modal();
-    // });
-
-//     /**
-//      * 设置窗口号
-//      */
-//     $("#editWindows").on("click", function (t) {
-//         $.ajax({
-//             type: "GET",
-//             url: '/thmz/getLastWindowsByCurrentUser',
-//             contentType: "application/json;charset=UTF-8",
-//             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;
-//                 }
-//                 if (res.code == 0) {
-//                     $("#windowsNum").val(res.data.windowsNo)
-//                 } else {
-//                     new PNotify({
-//                         title: '错误提示',
-//                         text: res.message,
-//                         type: 'error',
-//                         hide: true,
-//                         styling: 'bootstrap3'
-//                     });
-//                 }
-//             }
-//         });
-//         $("#editWindowsModal").modal();
-//     });
-    postCMD("login", localStorage.getItem("userID"), '000000', '收费项目', 0, 0, 0, '', '祝您早日康复', 0, 0, 0);
-    // setTimeout(function () {
-    //     postCMD("login",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
-    // }, 3000);
 
     /**
      * 核酸检测跳转过来的直接刷新待收费列表
@@ -894,7 +855,7 @@ function confirmFeeModal(times, totalCharge, receiptNo) {
     $("#payType").selectpicker('refresh');
     $("#changeAmount").val(0.0);
     $("#surplusAmount").val(0.0);
-    sendPeiceMessage(realMoney, 0, 0, '您本次应付金额为' + realMoney + '元', $("#patientIdHaveTally").val(), $("#nameHaveTally").val());
+    sendPriceMessage(realMoney, 0, 0, $("#patientIdHaveTally").val());
 }
 
 
@@ -1075,7 +1036,7 @@ function checkFee(flag) {
             $("#changeAmount").val(changeAmount);
             $("#addPayType").parent().removeClass("in").addClass("hide");
             if (!flag) {
-                sendPeiceMessage(realMoney, totalAmount, changeAmount, '实际支付金额为' + totalAmount + '元,应找零' + changeAmount + '元', $("#patientIdHaveTally").val(), $("#nameHaveTally").val());
+                sendPriceMessage(realMoney, totalAmount, changeAmount,  $("#patientIdHaveTally").val());
             }
         }
         //设置收费首页找零与应收和实收金额
@@ -1292,13 +1253,7 @@ function initTallyDetailTable() {
             }
             var ress = eval(res);
             if (ress.code == -1) {
-                new PNotify({
-                    title: '错误提示',
-                    text: ress.message,
-                    type: 'error',
-                    hide: true,
-                    styling: 'bootstrap3'
-                });
+                errorMesage(ress);
                 return {
                     "total": 0,//总页数
                     "rows": {}   //数据
@@ -1375,7 +1330,7 @@ function saveConfirmFee() {
                 initFeeTable();
                 //默认光标在卡号输入框
                 $("#cardNo").focus();
-                postCMD("appraise", localStorage.getItem("userID"), '000000', '收费项目', 0, 0, 0, '', '祝您早日康复', 0, 0, 0);
+                toEvaluation(patientId);
             } else {
                 errorMesage(res);
             }

+ 0 - 2
src/main/resources/static/js/zy/hospitalized.js

@@ -213,8 +213,6 @@ $(function () {
         queryUserInfoByName();
     });
 
-
-    postCMD("login", localStorage.getItem("userID"), '000000', '收费项目', 0, 0, 0, '', '祝您早日康复', 0, 0, 0);
     setTimeout(function () {
         getLodop();
     }, 800);

+ 12 - 13
src/main/resources/templates/mz/client_evaluate.html

@@ -21,6 +21,7 @@
     <link rel="apple-touch-icon-precomposed" href="/thmz/ico/apple-touch-icon-57-precomposed.png">
     <script src="/thmz/js/dependent/jquery.backstretch.min.js"></script>
     <script src="/thmz/js/common/file.js"></script>
+    <script src="/thmz/js/common/date-util.js"></script>
     <script src="/thmz/js/mz/client_evaluate.js"></script>
     <title>评价评价页面</title>
     <style>
@@ -52,17 +53,17 @@
              style="height: 50px;width:50px;float: left;margin-left: 20px;border-radius: 25px;">
         <span style="margin-left: 30px;">湖南泰和医院</span></div>
     <div class="col-sm-4 col-sm-4 col-xs-12" style="text-align: right;"><i class="fa fa-clock-o">&nbsp;&nbsp;</i><span
-            id="dateNow">2022-04-13</span></div>
+            id="dateNow"></span></div>
 </div>
 <div class="col-sm-12 col-sm-12 col-xs-12 gao100">
     <div class="col-sm-3 col-sm-3 col-xs-12" style="height: 100%;background: white;">
         <img id="headImage" style="margin-top: 10px;width: 80%;">
         <div style="margin-top: 30px;font-size: 35px;color: black;text-align: left;"><i class="fa fa-user">&nbsp;&nbsp;姓名:</i><span
-                id="name">胡如刚</span></div>
+                id="name"></span></div>
         <div style="margin-top: 30px;font-size: 35px;color: black;text-align: left;"><i class="fa fa-user-md">&nbsp;&nbsp;岗位:</i><span
-                id="role">管理员</span></div>
+                id="role"></span></div>
         <div style="margin-top: 30px;font-size: 35px;color: black;text-align: left;"><i class="fa fa-bookmark-o">&nbsp;&nbsp;<span
-                style="margin-left: 2px;">工号:</span></i><span id="userCode">3210</span></div>
+                style="margin-left: 2px;">工号:</span></i><span id="userCode"></span></div>
     </div>
     <div class="col-sm-9 col-sm-9 col-xs-12" style="height: 100%;padding-right: 0px;">
         <div style="height: 100%;">
@@ -72,20 +73,18 @@
                 </div>
                 <div>
                     <div style="padding-top: 60px;">
-                        <a style="cursor: pointer"><img src="../../thmz/images/emoj/0.png" style="width: 140px;"></a>
-                        <a style="cursor: pointer"><img src="../../thmz/images/emoj/1.png" style="width: 140px;margin-left: 100px;"></a>
+                        <a style="cursor: pointer" onclick="saveEvaluation(0)"><img src="../../thmz/images/emoj/0.png" style="width: 140px;"></a>
+                        <a style="cursor: pointer" onclick="saveEvaluation(1)"><img src="../../thmz/images/emoj/1.png" style="width: 140px;margin-left: 100px;"></a>
                     </div>
                     <div style="margin-top: 30px">
-                        <a style="cursor: pointer"><img src="../../thmz/images/emoj/2.png" style="width: 100px;"></a>
-                        <a style="cursor: pointer"><img src="../../thmz/images/emoj/3.png" style="width: 100px;margin-left: 80px;"></a>
-                        <a style="cursor: pointer"><img src="../../thmz/images/emoj/4.png" style="width: 100px;margin-left: 80px;"></a>
-                        <a style="cursor: pointer"><img src="../../thmz/images/emoj/5.png" style="width: 100px;margin-left: 80px;"></a>
+                        <a style="cursor: pointer" onclick="saveEvaluation(2)"><img src="../../thmz/images/emoj/2.png" style="width: 100px;"></a>
+                        <a style="cursor: pointer" onclick="saveEvaluation(3)"><img src="../../thmz/images/emoj/3.png" style="width: 100px;margin-left: 80px;"></a>
+                        <a style="cursor: pointer" onclick="saveEvaluation(4)"><img src="../../thmz/images/emoj/4.png" style="width: 100px;margin-left: 80px;"></a>
+                        <a style="cursor: pointer" onclick="saveEvaluation(5)"><img src="../../thmz/images/emoj/5.png" style="width: 100px;margin-left: 80px;"></a>
                     </div>
                 </div>
             </div>
-            <div style="height: 80px;background-color: #6EC1AD;font-size: 40px;line-height: 80px;border-radius: 5px;margin-top: 10px;">
-                16:21 星期四
-            </div>
+            <div style="height: 80px;background-color: #6EC1AD;font-size: 40px;line-height: 80px;border-radius: 5px;margin-top: 10px;" id="time"></div>
         </div>
     </div>
 </div>

+ 9 - 6
src/main/resources/templates/mz/client_index.html

@@ -21,6 +21,9 @@
     <link rel="apple-touch-icon-precomposed" href="/thmz/ico/apple-touch-icon-57-precomposed.png">
     <script src="/thmz/js/dependent/jquery.backstretch.min.js"></script>
     <script src="/thmz/js/common/file.js"></script>
+    <script src="/thmz/js/common/ip-util.js"></script>
+    <script src="/thmz/js/common/evaluation-websocket.js"></script>
+    <script src="/thmz/js/common/date-util.js"></script>
     <script src="/thmz/js/mz/client_index.js"></script>
     <title>评价器登录后的首页</title>
     <style>
@@ -52,17 +55,17 @@
              style="height: 50px;width:50px;float: left;margin-left: 20px;border-radius: 25px;">
         <span style="margin-left: 30px;">湖南泰和医院</span></div>
     <div class="col-sm-4 col-sm-4 col-xs-12" style="text-align: right;"><i class="fa fa-clock-o">&nbsp;&nbsp;</i><span
-            id="dateNow">2022-04-13</span></div>
+            id="dateNow"></span></div>
 </div>
 <div class="col-sm-12 col-sm-12 col-xs-12 gao100">
     <div class="col-sm-3 col-sm-3 col-xs-12" style="height: 100%;background: white;">
         <img id="headImage" style="margin-top: 10px;width: 80%;">
         <div style="margin-top: 30px;font-size: 35px;color: black;text-align: left;"><i class="fa fa-user">&nbsp;&nbsp;姓名:</i><span
-                id="name">胡如刚</span></div>
+                id="name"></span></div>
         <div style="margin-top: 30px;font-size: 35px;color: black;text-align: left;"><i class="fa fa-user-md">&nbsp;&nbsp;岗位:</i><span
-                id="role">管理员</span></div>
+                id="role"></span></div>
         <div style="margin-top: 30px;font-size: 35px;color: black;text-align: left;"><i class="fa fa-bookmark-o">&nbsp;&nbsp;<span
-                style="margin-left: 2px;">工号:</span></i><span id="userCode">3210</span></div>
+                style="margin-left: 2px;">工号:</span></i><span id="userCode"></span></div>
     </div>
     <div class="col-sm-9 col-sm-9 col-xs-12" style="height: 100%;padding-right: 0px;">
         <div style="height: 100%;">
@@ -70,9 +73,9 @@
                 <div style="height: 30px;background-color: #C4E0F6;width: calc(100% - 10px);margin-left: 5px;border-radius: 5px;color: black;">
                     湖南泰和医院简介
                 </div>
-                <div style="line-height: 50px;margin-top: 100px;text-indent: 2.8cm;font-size: 40px;">湖南泰和医院是一家省级直属三级综合学科医院,医保/农合定点,全国诚信标杆医院,祝您早日康复,工作愉快!</div>
+                <div style="line-height: 100px;margin-top: 100px;text-indent: 2.8cm;font-size: 40px;">湖南泰和医院是一家省级直属三级综合学科医院,医保/农合定点,全国诚信标杆医院,祝您早日康复,工作愉快!</div>
             </div>
-            <div style="height: 80px;background-color: #6EC1AD;font-size: 40px;line-height: 80px;border-radius: 5px;margin-top: 10px;">16:21 星期四</div>
+            <div style="height: 80px;background-color: #6EC1AD;font-size: 40px;line-height: 80px;border-radius: 5px;margin-top: 10px;" id="time"></div>
         </div>
     </div>
 </div>

+ 10 - 9
src/main/resources/templates/mz/client_price.html

@@ -21,6 +21,9 @@
     <link rel="apple-touch-icon-precomposed" href="/thmz/ico/apple-touch-icon-57-precomposed.png">
     <script src="/thmz/js/dependent/jquery.backstretch.min.js"></script>
     <script src="/thmz/js/common/file.js"></script>
+    <script src="/thmz/js/common/ip-util.js"></script>
+    <script src="/thmz/js/common/evaluation-websocket.js"></script>
+    <script src="/thmz/js/common/date-util.js"></script>
     <script src="/thmz/js/mz/client_price.js"></script>
     <title>评价价格页面</title>
     <style>
@@ -52,17 +55,17 @@
              style="height: 50px;width:50px;float: left;margin-left: 20px;border-radius: 25px;">
         <span style="margin-left: 30px;">湖南泰和医院</span></div>
     <div class="col-sm-4 col-sm-4 col-xs-12" style="text-align: right;"><i class="fa fa-clock-o">&nbsp;&nbsp;</i><span
-            id="dateNow">2022-04-13</span></div>
+            id="dateNow"></span></div>
 </div>
 <div class="col-sm-12 col-sm-12 col-xs-12 gao100">
     <div class="col-sm-3 col-sm-3 col-xs-12" style="height: 100%;background: white;">
         <img id="headImage" style="margin-top: 10px;width: 80%;">
         <div style="margin-top: 30px;font-size: 35px;color: black;text-align: left;"><i class="fa fa-user">&nbsp;&nbsp;姓名:</i><span
-                id="name">胡如刚</span></div>
+                id="name"></span></div>
         <div style="margin-top: 30px;font-size: 35px;color: black;text-align: left;"><i class="fa fa-user-md">&nbsp;&nbsp;岗位:</i><span
-                id="role">管理员</span></div>
+                id="role"></span></div>
         <div style="margin-top: 30px;font-size: 35px;color: black;text-align: left;"><i class="fa fa-bookmark-o">&nbsp;&nbsp;<span
-                style="margin-left: 2px;">工号:</span></i><span id="userCode">3210</span></div>
+                style="margin-left: 2px;">工号:</span></i><span id="userCode"></span></div>
     </div>
     <div class="col-sm-9 col-sm-9 col-xs-12" style="height: 100%;padding-right: 0px;">
         <div style="height: 100%;">
@@ -71,13 +74,11 @@
                     缴费详情
                 </div>
                 <div style="padding-top: 60px;font-size: 50px;line-height: 120px;text-indent: 2.8cm;text-align: left;padding-left: 10px;padding-right: 10px;">
-                    <span id="pName">刘阳</span><span id="pGender">女士</span>,您好!您本次就诊,应付金额为<span id="needPay" style="border-bottom: black 2px solid;color: black;font-weight: 400;">580.00</span>元,
-                    实际支付金额为<span id="pay" style="border-bottom: black 2px solid;color: black;font-weight: 400;">600.00</span>元,应找零金额为<span id="changeAmount" style="border-bottom: black 2px solid;color: black;font-weight: 400;">20.00</span>元。
+                    <span id="pName"></span><span id="pGender"></span>,您好!您本次就诊,应付金额为<span id="needPay" style="border-bottom: black 2px solid;color: black;font-weight: 400;"></span>元,
+                    实际支付金额为<span id="pay" style="border-bottom: black 2px solid;color: black;font-weight: 400;"></span>元,应找零金额为<span id="changeAmount" style="border-bottom: black 2px solid;color: black;font-weight: 400;"></span>元。
                 </div>
             </div>
-            <div style="height: 80px;background-color: #6EC1AD;font-size: 40px;line-height: 80px;border-radius: 5px;margin-top: 10px;">
-                16:21 星期四
-            </div>
+            <div style="height: 80px;background-color: #6EC1AD;font-size: 40px;line-height: 80px;border-radius: 5px;margin-top: 10px;" id="time"></div>
         </div>
     </div>
 </div>

+ 2 - 0
src/main/resources/templates/mz/client_welcome.html

@@ -21,6 +21,8 @@
     <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/thmz/ico/apple-touch-icon-72-precomposed.png">
     <link rel="apple-touch-icon-precomposed" href="/thmz/ico/apple-touch-icon-57-precomposed.png">
     <script src="/thmz/js/dependent/jquery.backstretch.min.js"></script>
+    <script src="/thmz/js/common/ip-util.js"></script>
+    <script src="/thmz/js/common/evaluation-websocket.js"></script>
     <script src="/thmz/js/mz/client_welcome.js"></script>
     <title>打开评价器欢迎页面</title>
 </head>