Browse Source

益寿缘医生端-优化统计拒方数量功能。

cgp 2 tuần trước cách đây
mục cha
commit
4498ac8c72

+ 28 - 1
fs-doctor-app/src/main/java/com/fs/app/controller/FsPrescribeController.java

@@ -1,20 +1,24 @@
 package com.fs.app.controller;
 
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.fs.app.utils.JwtUtils;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.core.redis.RedisCache;
 import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.SecurityUtils;
+import com.fs.common.utils.ServletUtils;
+import com.fs.his.domain.FsDoctor;
 import com.fs.his.domain.FsExportTask;
 import com.fs.his.domain.FsPatient;
 import com.fs.his.domain.FsPrescribe;
 import com.fs.his.dto.FsPrescribeRecordRejectDto;
 import com.fs.his.mapper.FsPatientMapper;
 import com.fs.his.param.FsPrescribeParam;
+import com.fs.his.service.IFsDoctorService;
 import com.fs.his.service.IFsExportTaskService;
 import com.fs.his.service.IFsPrescribeRecordService;
 import com.fs.his.service.IFsPrescribeService;
@@ -23,6 +27,7 @@ import com.fs.his.vo.FsPrescribeRecordRejectVo;
 import com.fs.his.vo.FsPrescribeVO;
 import com.fs.hisStore.service.IFsUserInformationCollectionService;
 import com.github.pagehelper.PageInfo;
+import io.jsonwebtoken.Claims;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
@@ -56,6 +61,14 @@ public class FsPrescribeController extends BaseController
     @Autowired
     private IFsPrescribeRecordService prescribeRecordService;
 
+    @Autowired
+    private IFsDoctorService doctorService;
+
+    @Autowired
+    JwtUtils jwtUtils;
+
+    @Autowired
+    RedisCache redisCache;
     /**
      * 确认处方
      * @param param 处方
@@ -104,6 +117,12 @@ public class FsPrescribeController extends BaseController
      * */
     @PostMapping("/rejectCount")
     public R refuseCount(@RequestBody FsPrescribeRecordRejectDto rejectDto){
+        FsDoctor doctor=doctorService.selectFsDoctorByDoctorId(Long.parseLong(getDoctorId()));
+        if (doctor==null){
+            return R.error("用户不存在");
+        }
+        //获取当前用户(药师id)
+        rejectDto.setDrugDoctorId(doctor.getDoctorId());
         PageInfo<FsPrescribeRecordRejectVo> fsPrescribeRecordRejectVoPageInfo = prescribeRecordService.calculateRejectCount(rejectDto);
         return R.ok().put("data", fsPrescribeRecordRejectVoPageInfo);
     }
@@ -240,4 +259,12 @@ public class FsPrescribeController extends BaseController
         return AjaxResult.success(prescribeRecordService.selectRecordListByPrescribeId(prescribeId));
     }
 
+    public String getDoctorId()
+    {
+        String headValue =  ServletUtils.getRequest().getHeader("APPToken");
+        Claims claims=jwtUtils.getClaimByToken(headValue);
+        String doctorId = claims.getSubject().toString();
+        return doctorId;
+    }
+
 }

+ 4 - 0
fs-service/src/main/java/com/fs/his/dto/FsPrescribeRecordRejectDto.java

@@ -6,6 +6,10 @@ import lombok.Data;
 public class FsPrescribeRecordRejectDto {
     //处方Id
     private Long prescribeId;
+    //药师Id
+    private Long drugDoctorId;
+    //医生Id
+    private Long doctorId;
     //处方编号
     private String prescribeCode;
     //医生名称

+ 6 - 0
fs-service/src/main/java/com/fs/his/vo/FsPrescribeRecordRejectVo.java

@@ -4,12 +4,18 @@ import lombok.Data;
 
 @Data
 public class FsPrescribeRecordRejectVo {
+    //医生Id
+    private Long doctorId;
+    //药师Id
+    private Long drugDoctorId;
     //处方Id
     private Long prescribeId;
     //处方编号
     private String prescribeCode;
     //医生名称
     private String doctorName;
+    //药师名称
+    private String drugDoctorName;
     //患者名称
     private String patientName;
     //审核时间

+ 12 - 3
fs-service/src/main/resources/mapper/his/FsPrescibeRecordMapper.xml

@@ -20,8 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <resultMap type="com.fs.his.vo.FsPrescribeRecordRejectVo" id="FsPrescribeRecordRejectResult">
         <result property="prescribeId"    column="prescribe_id"    />
+        <result property="drugDoctorId"    column="drug_doctor_id"    />
+        <result property="doctorId"    column="doctor_id"    />
         <result property="prescribeCode"    column="prescribe_code"    />
         <result property="doctorName"    column="doctor_name"    />
+        <result property="drugDoctorName"    column="drug_doctor_name"    />
         <result property="patientName"    column="patient_name"    />
         <result property="auditTime"    column="audit_time"    />
         <result property="auditReason"    column="audit_reason"    />
@@ -110,15 +113,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="calculateRejectCount" resultMap="FsPrescribeRecordRejectResult">
         SELECT
+            r.doctor_id,
             p.prescribe_id,
             p.prescribe_code,
             MAX(r.doctor_name) AS doctor_name,
+            MAX(r.drug_doctor_name) AS drug_doctor_name,
             p.patient_name,
             MIN(r.create_time) AS audit_time,
             MAX(r.audit_reason) AS audit_reason
         FROM fs_prescibe_record r
                  JOIN fs_prescribe p ON r.prescribe_id = p.prescribe_id
         WHERE r.status = 2
+        <!-- 药师ID -->
+        <if test="drugDoctorId != null">
+            AND r.drug_doctor_id = #{drugDoctorId}
+        </if>
         <!-- 处方ID -->
         <if test="prescribeId != null">
             AND p.prescribe_id = #{prescribeId}
@@ -127,13 +136,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="prescribeCode != null and prescribeCode != ''">
             AND p.prescribe_code = #{prescribeCode}
         </if>
-        <!-- 医生姓名(建议模糊?若需精确则保留 =)-->
+        <!-- 医生姓名-->
         <if test="doctorName != null and doctorName != ''">
-            AND r.doctor_name = #{doctorName}
+            AND r.doctor_name like concat('%', #{doctorName}, '%')
         </if>
         <!-- 患者姓名 -->
         <if test="patientName != null and patientName != ''">
-            AND p.patient_name = #{patientName}
+            AND p.patient_name like concat('%',#{patientName},'%')
         </if>
         <!-- 审核时间范围 -->
         <if test="beginAuditTime != null and beginAuditTime != ''">