Procházet zdrojové kódy

优化号表设计逻辑

hurugang před 5 roky
rodič
revize
13cc2cb7a9

+ 9 - 1
src/main/java/cn/hnthyy/thmz/controller/EmployeeController.java

@@ -1,10 +1,12 @@
 package cn.hnthyy.thmz.controller;
 
 import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.his.Employee;
 import cn.hnthyy.thmz.entity.his.ZdMzClass;
 import cn.hnthyy.thmz.enums.ClassCodeEnum;
 import cn.hnthyy.thmz.service.his.EmployeeService;
 import cn.hnthyy.thmz.service.his.ZdMzClassService;
+import cn.hnthyy.thmz.service.his.ZdUnitCodeService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,6 +22,8 @@ import java.util.*;
 public class EmployeeController {
     @Autowired
     private EmployeeService employeeService;
+    @Autowired
+    private ZdUnitCodeService zdUnitCodeService;
     /**
      * 根据科室列表查询医生列表
      *
@@ -30,9 +34,13 @@ public class EmployeeController {
     public Map<String, Object> listEmployeeByDepts(@RequestParam("depts") String depts) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
+            List<Employee> employeeList=employeeService.queryEmployeeByDepts(depts);
+            employeeList.stream().forEach(e->{
+                e.setDeptName(zdUnitCodeService.queryDeptNameByIdInCache(e.getDeptCode()));
+            });
             resultMap.put("code", 0);
             resultMap.put("message", "根据科室列表查询医生列表成功");
-            resultMap.put("data", employeeService.queryEmployeeByDepts(depts));
+            resultMap.put("data", employeeList);
             return resultMap;
         }catch (Exception e){
             e.printStackTrace();

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/his/Employee.java

@@ -17,4 +17,8 @@ public class Employee {
     private Integer delFlag;
     //工作状态
     private Integer mark;
+    //科室编码
+    private String deptCode;
+    //科室编码
+    private String deptName;
 }

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/EmployeeMapper.java

@@ -24,7 +24,7 @@ public interface EmployeeMapper {
      * @return
      */
     @Select({"<script>",
-            "select rtrim(code) employee_code,rtrim(name) employee_name,del_flag,rtrim(mark) mark from a_employee_mi ",
+            "select rtrim(code) employee_code,rtrim(name) employee_name,del_flag,rtrim(mark) mark,rtrim(dept_code) dept_code from a_employee_mi ",
             "<when test='depts!=null'>",
             " where dept_code in",
             "<foreach item='item' index='index' collection='depts' open='(' separator=',' close=')'>",

+ 4 - 2
src/main/resources/static/js/request.js

@@ -752,7 +752,8 @@ function initDoctorSelect() {
     //医生列表
     $.ajax({
         type: "GET",
-        url: '/thmz/listEmployeeByDepts?depts=' + $('#deptNo').val(),
+        //url: '/thmz/listEmployeeByDepts?depts=' + $('#deptNo').val(),
+        url: '/thmz/listEmployeeByDepts?depts=null',
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
         success: function (res) {
@@ -762,7 +763,7 @@ function initDoctorSelect() {
             }
             var html = '';
             $.each(res.data, function (commentIndex, comment) {
-                html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + '</option>';
+                html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + ' ('+comment.deptName+') </option>';
             });
             $('#doctorParam').empty();
             $('#doctorParam').html(html);
@@ -821,6 +822,7 @@ function updateRequest(id) {
                 $('#ampm').selectpicker('refresh');
                 $('#deptNo').selectpicker('val', res.data.unitCode);
                 $('#deptNo').selectpicker('refresh');
+                //initDoctorSelect();
                 $('#doctorParam').selectpicker('val', res.data.doctorCode);
                 $('#doctorParam').selectpicker('refresh');
                 $('#chargeType').selectpicker('val', res.data.chargeType);

+ 1 - 1
src/main/resources/templates/request.html

@@ -121,7 +121,7 @@
                         </label>
                         <div class="col-md-6 col-sm-6 col-xs-12">
                             <select class="form-control selectpicker show-tick" data-live-search="true" required="required"
-                                    title="请选择"  id="deptNo" onchange="initDoctorSelect()">
+                                    title="请选择"  id="deptNo" >
                             </select>
                         </div>
                     </div>