|
@@ -14,6 +14,7 @@ import com.fs.app.exception.FSException;
|
|
|
import com.fs.app.facade.Hospital580FacadeService;
|
|
import com.fs.app.facade.Hospital580FacadeService;
|
|
|
import com.fs.common.core.domain.PageResponse;
|
|
import com.fs.common.core.domain.PageResponse;
|
|
|
import com.fs.common.core.domain.Result;
|
|
import com.fs.common.core.domain.Result;
|
|
|
|
|
+import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.framework.aspectj.lock.DistributeLock;
|
|
import com.fs.framework.aspectj.lock.DistributeLock;
|
|
|
import com.fs.his.domain.FsDoctor;
|
|
import com.fs.his.domain.FsDoctor;
|
|
|
import com.fs.his.domain.FsPatient;
|
|
import com.fs.his.domain.FsPatient;
|
|
@@ -30,6 +31,7 @@ import com.fs.hospital580.service.Hospital580PrescriptionAnswerScrmService;
|
|
|
import com.fs.hospital580.service.Hospital580PrescriptionMedicineScrmService;
|
|
import com.fs.hospital580.service.Hospital580PrescriptionMedicineScrmService;
|
|
|
import com.fs.hospital580.service.Hospital580PrescriptionScrmService;
|
|
import com.fs.hospital580.service.Hospital580PrescriptionScrmService;
|
|
|
import com.fs.hospital580.service.Hospital580Service;
|
|
import com.fs.hospital580.service.Hospital580Service;
|
|
|
|
|
+import com.fs.hospital580.util.ThumbnailatorWatermark;
|
|
|
import com.fs.hospital580.vo.MedicineSyncVo;
|
|
import com.fs.hospital580.vo.MedicineSyncVo;
|
|
|
import com.fs.hospital580.vo.PrescriptionMedicineScrmVo;
|
|
import com.fs.hospital580.vo.PrescriptionMedicineScrmVo;
|
|
|
import com.fs.hospital580.vo.RefusePrescriptionVo;
|
|
import com.fs.hospital580.vo.RefusePrescriptionVo;
|
|
@@ -52,6 +54,7 @@ import java.time.ZoneId;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -78,6 +81,11 @@ public class Hospital580FacadeServiceImpl implements Hospital580FacadeService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsDoctorService doctorService;
|
|
private IFsDoctorService doctorService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private RedisCache redisCache;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ThumbnailatorWatermark thumbnailatorWatermark;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@DistributeLock(key = "#vo.userId", scene = "savePreDemand", waitTime = 5000, errorMsg = "新增问诊信息失败")
|
|
@DistributeLock(key = "#vo.userId", scene = "savePreDemand", waitTime = 5000, errorMsg = "新增问诊信息失败")
|
|
@@ -152,10 +160,14 @@ public class Hospital580FacadeServiceImpl implements Hospital580FacadeService {
|
|
|
FsStoreOrderScrm fsStoreOrderScrm = orderService.selectFsStoreOrderById(prescription.getStoreOrderId());
|
|
FsStoreOrderScrm fsStoreOrderScrm = orderService.selectFsStoreOrderById(prescription.getStoreOrderId());
|
|
|
// 查询药剂师
|
|
// 查询药剂师
|
|
|
FsDoctor fsDoctor = doctorService.findByStoreId(fsStoreOrderScrm.getStoreId());
|
|
FsDoctor fsDoctor = doctorService.findByStoreId(fsStoreOrderScrm.getStoreId());
|
|
|
- if (ObjectUtil.isNotEmpty(fsDoctor)){
|
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(fsDoctor)) {
|
|
|
prescription.setAuditApothecaryName(fsDoctor.getDoctorName());
|
|
prescription.setAuditApothecaryName(fsDoctor.getDoctorName());
|
|
|
prescription.setAuditApothecaryId(fsDoctor.getDoctorId());
|
|
prescription.setAuditApothecaryId(fsDoctor.getDoctorId());
|
|
|
}
|
|
}
|
|
|
|
|
+ // 处方图片
|
|
|
|
|
+ redisCache.setCacheObject("prescription:dstFilePath:" + prescription.getPreId(), vo.getDstFilePath(), 2, TimeUnit.DAYS);
|
|
|
|
|
+ // 处方添加待生效水印
|
|
|
|
|
+ prescription.setDstFilePath(thumbnailatorWatermark.addWatermarkToNetworkImage(prescription.getPreId(), fsStoreOrderScrm.getStatus(), null));
|
|
|
|
|
|
|
|
// 更新处方记录
|
|
// 更新处方记录
|
|
|
prescription.updateById();
|
|
prescription.updateById();
|
|
@@ -280,6 +292,25 @@ public class Hospital580FacadeServiceImpl implements Hospital580FacadeService {
|
|
|
@Override
|
|
@Override
|
|
|
public Result<PrescriptionDetailRes> prescriptionDetail(String userId, Long preId) {
|
|
public Result<PrescriptionDetailRes> prescriptionDetail(String userId, Long preId) {
|
|
|
Hospital580PrescriptionScrmEntity byId = orderScrmService.getById(preId);
|
|
Hospital580PrescriptionScrmEntity byId = orderScrmService.getById(preId);
|
|
|
|
|
+ // 判断处方阶段和订单阶段是否相同
|
|
|
|
|
+ Integer str = redisCache.getCacheObject("prescription:dstFilePath:phase" + preId);
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(str) && 3 == str) {
|
|
|
|
|
+ FsStoreOrderScrm fsStoreOrderScrm = orderService.selectFsStoreOrderById(byId.getStoreOrderId());
|
|
|
|
|
+ String singUrl = null;
|
|
|
|
|
+ if (byId.getAuditStatus() > 1) {
|
|
|
|
|
+ FsDoctor fsDoctor = doctorService.selectFsDoctorByDoctorId(byId.getAuditApothecaryId());
|
|
|
|
|
+ singUrl = fsDoctor.getSignUrl();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (fsStoreOrderScrm.getStatus().equals(-3)) {
|
|
|
|
|
+ // 订单已取消 设置为已失效
|
|
|
|
|
+ thumbnailatorWatermark.addWatermarkToNetworkImage(preId, 3, singUrl);
|
|
|
|
|
+ } else if (fsStoreOrderScrm.getStatus() > 0) {
|
|
|
|
|
+ // 订单已付款 设置为已生效
|
|
|
|
|
+ thumbnailatorWatermark.addWatermarkToNetworkImage(preId, 2, singUrl);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
PrescriptionDetailRes prescriptionScrmVo = BeanUtil.toBean(byId, PrescriptionDetailRes.class);
|
|
PrescriptionDetailRes prescriptionScrmVo = BeanUtil.toBean(byId, PrescriptionDetailRes.class);
|
|
|
prescriptionScrmVo.setDrugRspList(medicineScrmService.list(new LambdaQueryWrapper<Hospital580PrescriptionMedicineScrmEntity>()
|
|
prescriptionScrmVo.setDrugRspList(medicineScrmService.list(new LambdaQueryWrapper<Hospital580PrescriptionMedicineScrmEntity>()
|
|
|
.eq(Hospital580PrescriptionMedicineScrmEntity::getPreId, prescriptionScrmVo.getPreId()))
|
|
.eq(Hospital580PrescriptionMedicineScrmEntity::getPreId, prescriptionScrmVo.getPreId()))
|