浏览代码

医生首页数据加载

hurugang 3 年之前
父节点
当前提交
86ad3a2ce7

+ 35 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/ClinicController.java

@@ -662,4 +662,39 @@ public class ClinicController {
         }
     }
 
+
+
+
+    /**
+     * 获取医生当天统计数据
+     *
+     * @return
+     */
+    @RequestMapping(value = "/getDoctorDateForDay", method = {RequestMethod.GET})
+    public Map<String, Object> getDoctorDateForDay(HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+
+            Date beginTime = DateUtil.getFirstSecond();
+            Date endTime =DateUtil.getLastSecond(beginTime);
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            Clinic clinic =new Clinic();
+            clinic.setBeginDate(DateUtil.fomart(beginTime,"yyyy-MM-dd HH:mm:ss"));
+            clinic.setEndDate(DateUtil.fomart(endTime,"yyyy-MM-dd HH:mm:ss"));
+            clinic.setOpId(tokenUser.getUserIdCode());
+            resultMap.put("numberOfPatient",clinicService.queryNumberOfPatient(clinic));
+            resultMap.put("numberOfPrescription",clinicService.queryNumberOfPrescription(clinic));
+            resultMap.put("numberOfIcdText",clinicService.queryNumberOfIcdText(clinic));
+            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;
+        }
+    }
+
 }

+ 28 - 0
src/main/java/cn/hnthyy/thmz/mapper/thmz/ClinicMapper.java

@@ -4,6 +4,7 @@ import cn.hnthyy.thmz.entity.thmz.Clinic;
 import org.apache.ibatis.annotations.*;
 
 import java.util.List;
+import java.util.Map;
 
 public interface ClinicMapper {
 
@@ -165,6 +166,33 @@ public interface ClinicMapper {
             "</script>"})
     Integer selectCountClinic(Clinic clinic);
 
+    /**
+     * 查询医生的处方数量
+     * @return
+     */
+    @Select("select sum(a.num) " +
+            "from (" +
+            "select count(patient_id) num from t_clinic where  op_day>=#{beginDate} and op_day<=#{endDate} and op_id=#{opId}  and clinic_status in(4,5,6) GROUP BY patient_id) a")
+    Integer selectNumberOfPrescription(Clinic clinic);
+
+    /**
+     * 查询医生的病人数量
+     * @return
+     */
+    @Select("select count(a.patient_id)  " +
+            "from (" +
+            "select patient_id from t_clinic where  op_day>=#{beginDate} and op_day<=#{endDate} and op_id=#{opId}  and clinic_status in(4,5,6) GROUP BY patient_id) a")
+    Integer selectNumberOfPatient(Clinic clinic);
+
+
+    /**
+     * 查询医生的诊断与数量
+     * @return
+     */
+    @Select("select icd_text,count(1) num from t_clinic where  op_day>=#{beginDate} and op_day<=#{endDate} and op_id=#{opId}  and clinic_status in(4,5,6) GROUP BY icd_text order by num desc ")
+    List<Map<String,Object>> selectNumberOfIcdText(Clinic clinic);
+
+
     /**
      * 修改就诊状态
      *

+ 16 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/ClinicServiceImpl.java

@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class ClinicServiceImpl implements ClinicService {
@@ -67,6 +68,21 @@ public class ClinicServiceImpl implements ClinicService {
         return clinicMapper.selectCountClinic(clinic);
     }
 
+    @Override
+    public Integer queryNumberOfPrescription(Clinic clinic) {
+        return clinicMapper.selectNumberOfPrescription(clinic);
+    }
+
+    @Override
+    public Integer queryNumberOfPatient(Clinic clinic) {
+        return clinicMapper.selectNumberOfPatient(clinic);
+    }
+
+    @Override
+    public List<Map<String,Object>> queryNumberOfIcdText(Clinic clinic) {
+        return clinicMapper.selectNumberOfIcdText(clinic);
+    }
+
     @Override
     public int modifyClinic(Clinic clinic) {
         return clinicMapper.updateClinic(clinic);

+ 20 - 0
src/main/java/cn/hnthyy/thmz/service/thmz/ClinicService.java

@@ -5,6 +5,7 @@ import cn.hnthyy.thmz.entity.thmz.Clinic;
 import cn.hnthyy.thmz.entity.thmz.User;
 
 import java.util.List;
+import java.util.Map;
 
 public interface ClinicService {
 
@@ -49,6 +50,25 @@ public interface ClinicService {
      */
     Integer queryCountClinic(Clinic clinic);
 
+    /**
+     * 查询医生的处方数量
+     * @return
+     */
+    Integer queryNumberOfPrescription(Clinic clinic);
+
+    /**
+     * 查询医生的病人数量
+     * @return
+     */
+    Integer queryNumberOfPatient(Clinic clinic);
+
+
+    /**
+     * 查询医生的诊断与数量
+     * @return
+     */
+    List<Map<String,Object>> queryNumberOfIcdText(Clinic clinic);
+
     /**
      * 修改就诊状态
      * @param clinic

+ 45 - 10
src/main/resources/static/js/index.js

@@ -191,6 +191,41 @@ $(function () {
 
         }
     });
+
+
+    //获取医生工作统计数据
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getDoctorDateForDay',
+        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) {
+                $("#numberOfPatient").html(res.numberOfPatient);
+                $("#numberOfPrescription").html(res.numberOfPrescription);
+                var html='';
+                if(res.numberOfIcdText!=null && res.numberOfIcdText.length>0){
+                    for(var i=0;i<res.numberOfIcdText.length;i++){
+                        var obj=res.numberOfIcdText[i];
+                        html+=' <div class="work_detail_full">';
+                        html+='<div title="'+obj.icd_text+'" style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 300px);float: left;">';
+                        html+='<i class="fa fa-file-text" style="color: #6D31CF;margin-right: 10px;"></i>';
+                        html+=obj.icd_text+'</div>';
+                        html+='<div class="el-col el-col-4" style="float: right;text-align: right;margin-right: 5px;">';
+                        html+=obj.num;
+                        html+=' 张</div><div style="clear: both;"></div></div>';
+                    }
+                }
+                $("#numberOfIcdText").html(html);
+            }
+
+        }
+    });
+
 });
 
 
@@ -226,18 +261,18 @@ function getRePortRangeArrById(id) {
  * @returns {string}
  */
 function getBirthSlot(birthDay,nowDate) {
-    let birth = new Date(birthDay);
-    let now = new Date(nowDate);
-    let date1 = Date.parse(birth);
-    let date2 = Date.parse(now);
-    let day = Math.ceil((date2 - date1) / (60 * 60 * 1000 * 24));
-    let age = '';
-    let year = Math.floor(day / 365);
+    var birth = new Date(birthDay);
+    var now = new Date(nowDate);
+    var date1 = Date.parse(birth);
+    var date2 = Date.parse(now);
+    var day = Math.ceil((date2 - date1) / (60 * 60 * 1000 * 24));
+    var age = '';
+    var year = Math.floor(day / 365);
     if(year > 0) age += year + '岁';
-    let y = day % 365;
-    let month = Math.floor(y / 30);
+    var y = day % 365;
+    var month = Math.floor(y / 30);
     if(month > 0) age += month + '月';
-    let d = Math.floor(day % 365 % 30);
+    var d = Math.floor(day % 365 % 30);
     if(d > 0) age += d + '天';
     if(age.substring(0,age.indexOf('岁')) >= 7){
         age = age.substring(0,age.indexOf('岁')+1);

+ 39 - 4
src/main/resources/templates/index.html

@@ -133,18 +133,18 @@
                 <div class="x_content">
                     <div class="tile-stats" style="background-color: #EFF3FD;margin-bottom: 20px;">
                         <div class="today_work first_today_work">
-                            <label style="font-size: 16px;">3</label>
+                            <label style="font-size: 16px;" id="numberOfPatient">0</label>
                             &nbsp;人<br>接诊人数
                         </div>
                         <div class="today_work">
-                            <label style="font-size: 16px;">3</label>
+                            <label style="font-size: 16px;" id="numberOfPrescription">0</label>
                             &nbsp;张<br>开具处方
                         </div>
                     </div>
-                    <div class="work_detail">
+                    <div class="work_detail" style="max-height: 200px;overflow-y: auto;" id="numberOfIcdText">
                         <div class="work_detail_full">
                             <i class="fa fa-file-text" style="color: #6D31CF;"></i>
-                            <span title="慢性阻塞性肺疾病">慢性阻塞性肺疾病 <!----></span>
+                            <span title="慢性阻塞性肺疾病">慢性阻塞性肺疾病</span>
                             <div class="el-col el-col-4" style="float: right;text-align: right;">1
                             </div>
@@ -156,6 +156,41 @@
                             </div>
                         </div>
+                        <div class="work_detail_full">
+                            <i class="fa fa-file-text" style="color: #6D31CF;"></i>
+                            <span title="流行性乙型脑炎">流行性乙型脑炎 <!----></span>
+                            <div class="el-col el-col-4" style="float: right;text-align: right;">2
+                                张
+                            </div>
+                        </div>
+                        <div class="work_detail_full">
+                            <i class="fa fa-file-text" style="color: #6D31CF;"></i>
+                            <span title="流行性乙型脑炎">流行性乙型脑炎 <!----></span>
+                            <div class="el-col el-col-4" style="float: right;text-align: right;">2
+                                张
+                            </div>
+                        </div>
+                        <div class="work_detail_full">
+                            <i class="fa fa-file-text" style="color: #6D31CF;"></i>
+                            <span title="流行性乙型脑炎">流行性乙型脑炎 <!----></span>
+                            <div class="el-col el-col-4" style="float: right;text-align: right;">2
+                                张
+                            </div>
+                        </div>
+                        <div class="work_detail_full">
+                            <i class="fa fa-file-text" style="color: #6D31CF;"></i>
+                            <span title="流行性乙型脑炎">流行性乙型脑炎 <!----></span>
+                            <div class="el-col el-col-4" style="float: right;text-align: right;">2
+                                张
+                            </div>
+                        </div>
+                        <div class="work_detail_full">
+                            <i class="fa fa-file-text" style="color: #6D31CF;"></i>
+                            <span title="流行性乙型脑炎">流行性乙型脑炎 <!----></span>
+                            <div class="el-col el-col-4" style="float: right;text-align: right;">2
+                                张
+                            </div>
+                        </div>
                     </div>
                 </div>
             </div>