Quellcode durchsuchen

总后台增加商城处方-未开放数据统计

cgp vor 2 Tagen
Ursprung
Commit
6500fdc7e1

+ 18 - 0
fs-admin/src/main/java/com/fs/his/controller/FsPrescribeDataScrmController.java

@@ -3,7 +3,9 @@ package com.fs.his.controller;
 
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
 import com.fs.his.domain.FsPrescribeDataScrm;
+import com.fs.his.dto.DoctorNotPrescribeQueryDto;
 import com.fs.his.service.IFsPrescribeDataScrmService;
 import com.fs.his.vo.CustomerInfoVO;
 import com.fs.his.vo.DoctorSignVO;
@@ -98,4 +100,20 @@ public class FsPrescribeDataScrmController extends BaseController
         return AjaxResult.success(vo);
     }
 
+    /**
+     * 获取医生不开方列表信息
+     * */
+    @PostMapping("/doctorNotPrescribeList")
+    public TableDataInfo doctorNotPrescribeList(@RequestBody DoctorNotPrescribeQueryDto queryDto)
+    {
+        startPage();
+        List<FsPrescribeDataScrm> list = fsPrescribeScrmService.doctorNotPrescribeList(queryDto);
+        for (FsPrescribeDataScrm vo : list){
+            if (vo.getPatientTel()!=null){
+                vo.setPatientTel(vo.getPatientTel().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+            }
+        }
+        return getDataTable(list);
+    }
+
 }

+ 17 - 0
fs-doctor-app/src/main/java/com/fs/app/controller/FsPrescribeDataScrmController.java

@@ -252,6 +252,23 @@ public class FsPrescribeDataScrmController extends BaseController
         return AjaxResult.success(recordDataScrmService.getAuditScrmPrescribeRecordListByPrescribeId(prescribeId));
     }
 
+    /**
+     * 医生--暂不开方
+     * */
+    @PostMapping("/doctorNotPrescribe")
+    public AjaxResult doctorNotPrescribe(@RequestBody FsPrescribeDataDoctorUpdateDto updateDto) {
+        String doctorId = getDoctorId();
+        if (StringUtils.isBlank(doctorId)) {
+            throw new CustomException("登录已过期,请重新登录");
+        }
+        updateDto.setDoctorId(Long.valueOf(doctorId));
+        int result = fsPrescribeScrmService.doctorNotPrescribe(updateDto);
+        if (result > 0) {
+            return AjaxResult.success();
+        }
+        return AjaxResult.error("网络错误,提交失败");
+    }
+
     /**
      * 获取当前登录医生id
      */

+ 7 - 1
fs-service/src/main/java/com/fs/his/domain/FsPrescribeDataScrm.java

@@ -150,7 +150,7 @@ public class FsPrescribeDataScrm extends BaseEntity {
     /** 订单来源 */
     private Integer source;
 
-    /** 医生是否确认 0待医生开方 1已开方待药师审核 -1医生拒方 */
+    /** 医生是否确认 0待医生开方 1已开方待药师审核 -1医生拒方 -2暂不开方 */
     private Integer doctorConfirm;
 
     /** 医生开始操作时间(益寿缘从医生建议开始算) */
@@ -196,4 +196,10 @@ public class FsPrescribeDataScrm extends BaseEntity {
 
     /** 中医医嘱 */
     private String remarkChinese;
+
+    /** 医生不开方原因 */
+    private String notPrescribeReason;
+
+    /** 医生名称*/
+    private String doctorName;
 }

+ 28 - 0
fs-service/src/main/java/com/fs/his/dto/DoctorNotPrescribeQueryDto.java

@@ -0,0 +1,28 @@
+package com.fs.his.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * 医生不开方查询Dto
+ */
+@Data
+public class DoctorNotPrescribeQueryDto {
+
+    /** 患者名称 */
+    private String patientName;
+
+    /** 医生id */
+    private Long doctorId;
+
+    /** 开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private String beginTime;
+
+    /** 结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private String endTime;
+}

+ 3 - 0
fs-service/src/main/java/com/fs/his/dto/FsPrescribeDataDoctorUpdateDto.java

@@ -19,6 +19,9 @@ public class FsPrescribeDataDoctorUpdateDto {
     /** 拒方原因 */
     private String auditReason;
 
+    /** 医生不开方原因 */
+    private String notPrescribeReason;
+
     /** 医嘱 */
     private String remark;
 

+ 10 - 0
fs-service/src/main/java/com/fs/his/service/IFsPrescribeDataScrmService.java

@@ -119,4 +119,14 @@ public interface IFsPrescribeDataScrmService
      * 商城处方-医生执行开方
      * */
     int submitPrescribe(FsPrescribeDataSubmitDto submitDto);
+
+    /**
+     * 商城处方-医生不开方
+     * */
+    int doctorNotPrescribe(FsPrescribeDataDoctorUpdateDto updateDto);
+
+    /**
+     * 医生不开方列表
+     * */
+    List<FsPrescribeDataScrm> doctorNotPrescribeList(DoctorNotPrescribeQueryDto queryDto);
 }

+ 46 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsPrescribeDataScrmServiceImpl.java

@@ -90,6 +90,10 @@ public class FsPrescribeDataScrmServiceImpl implements IFsPrescribeDataScrmServi
     * */
     private static final Integer REJECT_PRESCRIBE = 5;
 
+    /**
+     * 暂不开方
+     * */
+    private static final Integer NOT_PRESCRIBE = 7;
 
     // ==================== 基础 CRUD ====================
     @Override
@@ -325,6 +329,48 @@ public class FsPrescribeDataScrmServiceImpl implements IFsPrescribeDataScrmServi
         return updateCount;
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int doctorNotPrescribe(FsPrescribeDataDoctorUpdateDto updateDto) {
+        if (getPrescribeIsDocument(updateDto.getPrescribeId())){
+            throw new CustomException("销售已制单,当前操作不可执行,请刷新后重试!");
+        }
+        // 医生不开方
+        if (StringUtils.isBlank(updateDto.getNotPrescribeReason())) {
+            throw new CustomException("原因不能为空");
+        }
+        updateDto.setNotPrescribeReason("暂不不开方:"+updateDto.getNotPrescribeReason());
+        // 1. 清除原有基础处方图片
+        clearPrescriptionImage(updateDto.getPrescribeId());
+
+        FsPrescribeDataScrm updatePrescribe = new FsPrescribeDataScrm();
+        BeanCopyUtils.copy(updateDto, updatePrescribe);
+        updatePrescribe.setDoctorConfirm(-2);//医生不开方
+        // 更新处方表记录
+        int result = fsPrescribeDataScrmMapper.updateFsPrescribeDataScrm(updatePrescribe);
+
+        // 更新客户信息表状态为已拒方
+        updateCustomerStatus(updateDto.getPrescribeId(), NOT_PRESCRIBE);
+        return result;
+    }
+
+    @Override
+    public List<FsPrescribeDataScrm> doctorNotPrescribeList(DoctorNotPrescribeQueryDto queryDto) {
+        FsPrescribeDataScrm fsPrescribeDataScrm = new FsPrescribeDataScrm();
+        BeanCopyUtils.copy(queryDto, fsPrescribeDataScrm);
+        fsPrescribeDataScrm.setDoctorConfirm(-2);//医生不开方
+        List<FsPrescribeDataScrm> fsPrescribeDataScrms = fsPrescribeDataScrmMapper.selectFsPrescribeDataScrmList(fsPrescribeDataScrm);
+        if (CollectionUtils.isEmpty(fsPrescribeDataScrms)){
+            return Collections.emptyList();
+        }
+        //收集医生id
+        Set<Long> doctorIds = fsPrescribeDataScrms.stream().map(FsPrescribeDataScrm::getDoctorId).collect(Collectors.toSet());
+        List<FsDoctor> doctorList = fsDoctorMapper.selectDoctorByIds(new ArrayList<>(doctorIds));
+        Map<Long, String> doctorMap = doctorList.stream().collect(Collectors.toMap(FsDoctor::getDoctorId, FsDoctor::getDoctorName));
+        fsPrescribeDataScrms.forEach(item -> item.setDoctorName(doctorMap.get(item.getDoctorId())));
+        return fsPrescribeDataScrms;
+    }
+
     /**
      * 全量覆盖药品列表:删除该处方所有旧药品,然后批量插入新列表
      */

+ 6 - 3
fs-service/src/main/java/com/fs/qw/service/impl/FsCompanyCustomerServiceImpl.java

@@ -100,7 +100,7 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
     private static final String QRC_RED_PACKAGE_CONFIG_KEY = "qrcRedPackage.config";
 
     private static final Set<Integer> ALLOWED_STATUSES =
-            Collections.unmodifiableSet(new HashSet<>(Arrays.asList(0, 5, 6))); // 允许操作完善客户信息的状态
+            Collections.unmodifiableSet(new HashSet<>(Arrays.asList(0, 5, 6, 7))); // 允许操作完善客户信息的状态
 
 
 
@@ -132,10 +132,13 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
         final Map<Long, String> prescriptionMap = CollectionUtils.isEmpty(fsPrescribeDataScrms)
                 ? Collections.emptyMap()
                 : fsPrescribeDataScrms.stream()
-                .filter(p -> Integer.valueOf(-1).equals(p.getDoctorConfirm()))//只给销售展示被医生拒方的原因
+                .filter(p -> Arrays.asList(-1, -2).contains(p.getDoctorConfirm()))//只给销售端展示被医生拒方、医生不开方的原因
                 .collect(Collectors.toMap(
                         FsPrescribeDataScrm::getPrescribeId,
-                        p -> p.getAuditReason() == null ? "" : p.getAuditReason()));
+                        p -> Integer.valueOf(-1).equals(p.getDoctorConfirm())
+                                ? (p.getAuditReason() == null ? "" : p.getAuditReason())
+                                : (p.getNotPrescribeReason() == null ? "" : p.getNotPrescribeReason())
+                ));
         //批量获取医生id
         List<Long> doctorIds = companyCustomers.stream().map(FsCompanyCustomer::getDoctorId).filter(Objects::nonNull).collect(Collectors.toList());
         //查询医生信息并用Map<Long,String>存起来key为医生id,value为医生名称

+ 9 - 5
fs-service/src/main/resources/mapper/his/FsPrescribeDataScrmMapper.xml

@@ -67,6 +67,7 @@
         <result property="updateTime"                 column="update_time"                 />
         <result property="diagnoseChinese"            column="diagnose_chinese"            />
         <result property="remarkChinese"              column="remark_chinese"              />
+        <result property="notPrescribeReason"         column="not_prescribe_reason"              />
     </resultMap>
 
     <sql id="selectFsPrescribeDataScrmVo">
@@ -81,7 +82,7 @@
                end_operate_time, operate_second, third_party_user_id, is_send_to_third_party,
                handwrite_collection_id, company_customer_id,
                food_and_exercise_guidance, healing_area_json, note_taboos, facial_diagnosis,is_document,
-               diagnose_chinese,remark_chinese
+               diagnose_chinese,remark_chinese,not_prescribe_reason
         from fs_prescribe_data_scrm
     </sql>
 
@@ -127,11 +128,11 @@
                 and facial_diagnosis like concat('%', #{facialDiagnosis}, '%')
             </if>
             <!-- 按时间范围查询 -->
-            <if test="params != null and beginTime != null and beginTime != ''">
-                and create_time >= #{params.beginCreateTime}
+            <if test="beginTime != null and beginTime != ''">
+                and create_time >= #{beginTime}
             </if>
-            <if test="params != null and endTime != null and endTime != ''">
-                and create_time &lt;= #{params.endCreateTime}
+            <if test="endTime != null and endTime != ''">
+                and create_time &lt;= #{endTime}
             </if>
         </where>
         order by create_time desc
@@ -254,6 +255,7 @@
             <if test="isDocument != null">is_document,</if>
             <if test="diagnoseChinese != null">diagnose_chinese,</if>
             <if test="remarkChinese != null">remark_chinese,</if>
+            <if test="notPrescribeReason != null">not_prescribe_reason,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="prescribeType != null">#{prescribeType},</if>
@@ -314,6 +316,7 @@
             <if test="isDocument != null">#{isDocument},</if>
             <if test="diagnoseChinese != null">#{diagnoseChinese},</if>
             <if test="remarkChinese != null">#{remarkChinese},</if>
+            <if test="notPrescribeReason != null">#{notPrescribeReason},</if>
         </trim>
     </insert>
 
@@ -378,6 +381,7 @@
             <if test="isDocument != null">is_document = #{isDocument},</if>
             <if test="diagnoseChinese != null">diagnose_chinese = #{diagnoseChinese},</if>
             <if test="remarkChinese != null">remark_chinese = #{remarkChinese},</if>
+            <if test="notPrescribeReason != null">not_prescribe_reason = #{notPrescribeReason},</if>
         </trim>
         where prescribe_id = #{prescribeId}
     </update>