Jelajahi Sumber

Merge remote-tracking branch 'origin/master_feat_ysy_20250929' into master_feat_ysy_20250929

wjj 1 Minggu lalu
induk
melakukan
99a50d2f92

+ 77 - 5
fs-service/src/main/java/com/fs/his/service/impl/FsPrescribeServiceImpl.java

@@ -548,8 +548,6 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
             o.setPatientGender(f.getPatientGender());
             o.setPatientAge(f.getPatientAge());
             o.setOutpatientId(f.getPrescribeCode());
-            o.setUrl(f.getUrl());
-            o.setDrugDoctorUrl(f.getDrugDoctorSignUrl());
             if (order != null) {
                 o.setBedId(order.getDeptName());
             } else {
@@ -575,11 +573,16 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
             // 在这里添加处方药品列表的值
             List<FsPrescribeDrug> PrescribeDrugList=filterNonDrugPrescribe(list);
             o.setPrescribeDrug(PrescribeDrugList);
+            //医生签名
+            o.setUrl(f.getUrl());
+            //药师签名
+            o.setDrugDoctorUrl(f.getDrugDoctorSignUrl());
+            //医生名称
             o.setDoctorName(f.getDoctorName());
+            //审核药师
             o.setAuditDoctor(f.getDoctorDrugName());
             o.setDispatcher("");
             o.setCheckDoctor("");
-            o.setDoctorName(f.getDoctorName());
             o.setTelPhone(f.getPatientTel());
             FsDoctor fsDoctor = doctorMapper.selectFsDoctorByDoctorId(f.getDoctorId());
             Asserts.notNull(fsDoctor,String.format("医生 %s 未找到!",f.getDoctorId()));
@@ -598,6 +601,75 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
         }
         return f.getPrescribeImgUrl();
     }
+
+
+    //更新处方单图片
+    private void prescriptionPicUpdate(PrescribeXyImgParam param,Long prescribeId){
+        FsPrescribeVO prescribeVO = fsPrescribeMapper.selectFsPrescribeByPrescribeIdVO(prescribeId);
+        Asserts.notNull(prescribeVO,String.format("处方 %d 未找到!",prescribeId));
+
+        FsStoreOrder fsStoreOrder = storeOrderService.selectFsStoreOrderByOrderId(prescribeVO.getStoreOrderId());
+        FsInquiryOrderVO order = fsInquiryOrderMapper.selectFsInquiryOrderVOByOrderId(prescribeVO.getInquiryOrderId());
+        if (StringUtils.isNotBlank(prescribeVO.getPrescribeImgUrl())) {
+            FsPrescribeDrug d = new FsPrescribeDrug();
+            d.setPrescribeId(prescribeVO.getPrescribeId());
+            List<FsPrescribeDrug> list = fsPrescribeDrugMapper.selectFsPrescribeDrugList(d);
+
+            if (CollectionUtils.isEmpty(list)) {
+                throw new IllegalArgumentException(String.format("处方单 %d 对应药品为空!",prescribeId));
+            }
+            PrescribeXyImgParam o = new PrescribeXyImgParam();
+            o.setStatus(fsStoreOrder.getStatus());
+            o.setTotalPrice(fsStoreOrder.getPayPrice());
+            o.setTime(prescribeVO.getCreateTime());
+            o.setPrescribeId(prescribeVO.getPrescribeCode());
+            o.setPatientName(prescribeVO.getPatientName());
+            o.setPatientGender(prescribeVO.getPatientGender());
+            o.setPatientAge(prescribeVO.getPatientAge());
+            o.setOutpatientId(prescribeVO.getPrescribeCode());
+            if (order != null) {
+                o.setBedId(order.getDeptName());
+            } else {
+                o.setBedId("中医科");
+            }
+            if (StringUtils.isNotBlank(prescribeVO.getRemark())){
+                o.setRemark(prescribeVO.getRemark());
+            } else {
+                o.setRemark("请按照用药说明书服用药品,如有不适,请及时就医!");
+            }
+            o.setHistoryAllergic(prescribeVO.getHistoryAllergic());
+            o.setDiagnose(prescribeVO.getDiagnose());
+            // 在这里添加处方药品列表的值
+            List<FsPrescribeDrug> PrescribeDrugList=filterNonDrugPrescribe(list);
+            o.setPrescribeDrug(PrescribeDrugList);
+
+
+            //医生名称
+            o.setDoctorName(prescribeVO.getDoctorName());
+            //审核药师
+            o.setAuditDoctor(prescribeVO.getDoctorDrugName());
+            o.setDispatcher("");
+            o.setCheckDoctor("");
+            o.setTelPhone(prescribeVO.getPatientTel());
+            FsDoctor fsDoctor = doctorMapper.selectFsDoctorByDoctorId(prescribeVO.getDoctorId());
+            Asserts.notNull(fsDoctor,String.format("医生 %s 未找到!",prescribeVO.getDoctorId()));
+            o.setDoctorNo(fsDoctor.getCertificateCode());
+            o.setDoctorTitle(fsDoctor.getPosition());
+            //TODO 在医生确认开放及以后阶段可赋值 医生签名
+            param.setUrl(prescribeVO.getUrl());
+            //TODO 在药师审核及以后阶段可赋值 药师签名
+            param.setDrugDoctorUrl(prescribeVO.getDrugDoctorSignUrl());
+            String url = prescriptionImageService.generatePrescriptionImage(o);
+            FsPrescribe fsPrescribe = new FsPrescribe();
+            fsPrescribe.setPrescribeImgUrl(url);
+            fsPrescribe.setPrescribeId(prescribeVO.getPrescribeId());
+            fsPrescribeMapper.updateFsPrescribe(fsPrescribe);
+            prescribeVO.setPrescribeImgUrl(url);
+
+        } else {
+            log.info("处方 {} 对应处方单已经被生成!",prescribeId);
+        }
+    }
     /**
      * 根据产品最新状态过滤处方单药品列表。
      * <p>
@@ -1239,7 +1311,7 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
             //确认完成后删除缓存
             redisCache.deleteObject("collectionPrescribeId:" + fsPrescribe.getPrescribeId());
             //同步用户信息采集进度
-            FsUserInformationCollectionSchedule schedule = scheduleMapper.selectFsUserInformationCollectionScheduleByCollectionId(collection.getId());
+            FsUserInformationCollectionSchedule schedule = scheduleMapper.selectCollectionScheduleByCollectionId(collection.getId());
             if (schedule != null){
                 //"待药师审核“节点
                 schedule.setCurrentStep(PrescriptionTaskStepEnum.WAITING_PHARMACIST_REVIEW.getCode());
@@ -1254,7 +1326,7 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
             }
         }
 
-        // 医生确认后生成处方单
+        //TODO 医生确认后生成处方单
         PrescriptionTaskRecord record = new PrescriptionTaskRecord();
         record.setPrescribeId(param.getPrescribeId());
         record.setCreateTime(LocalDateTime.now());

+ 9 - 1
fs-service/src/main/java/com/fs/qw/mapper/FsUserInformationCollectionScheduleMapper.java

@@ -26,7 +26,15 @@ public interface FsUserInformationCollectionScheduleMapper extends BaseMapper<Fs
      * @param collectionId 用户信息采集表主键
      * @return 用户信息采集进度
      */
-    FsUserInformationCollectionSchedule selectFsUserInformationCollectionScheduleByCollectionId(Long collectionId);
+    FsUserInformationCollectionSchedule selectCollectionScheduleByCollectionId(Long collectionId);
+
+    /**
+     * 查询运行中的用户信息采集进度
+     *
+     * @param collectionId 用户信息采集表主键
+     * @return 用户信息采集进度
+     */
+    FsUserInformationCollectionSchedule selectCollectionScheduleRunningByCollectionId(Long collectionId);
 
     /**
      * 查询用户信息采集进度

+ 13 - 1
fs-service/src/main/resources/mapper/qw/FsUserInformationCollectionScheduleMapper.xml

@@ -129,7 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
-    <select id="selectFsUserInformationCollectionScheduleByCollectionId" parameterType="Long" resultMap="FsUserInformationCollectionScheduleResult">
+    <select id="selectCollectionScheduleByCollectionId" parameterType="Long" resultMap="FsUserInformationCollectionScheduleResult">
         SELECT
             id, collection_id, user_id, doctor_id,
             package_id, package_name, current_step, status, create_time,
@@ -144,6 +144,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where order_code = #{orderCode}
     </select>
 
+    <select id="selectCollectionScheduleRunningByCollectionId" parameterType="Long" resultMap="FsUserInformationCollectionScheduleResult">
+        SELECT
+            id, collection_id, user_id, doctor_id,
+            package_id, package_name, current_step, status, create_time,
+            completed_time, terminated_time, terminated_by, remark,order_code
+        FROM fs_user_information_collection_schedule
+        WHERE collection_id = #{collectionId}
+        AND status = 1
+        ORDER BY id DESC
+        LIMIT 1
+    </select>
+
 
     <insert id="insertFsUserInformationCollectionSchedule" parameterType="FsUserInformationCollectionSchedule" useGeneratedKeys="true" keyProperty="id">
         insert into fs_user_information_collection_schedule