|
|
@@ -1,25 +1,33 @@
|
|
|
package com.fs.app.facade.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fs.app.facade.Hospital580FacadeService;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
+import com.fs.hospital580.dto.DiseaseDto;
|
|
|
import com.fs.hospital580.dto.PreDemandDto;
|
|
|
import com.fs.hospital580.dto.Result580;
|
|
|
import com.fs.hospital580.entity.FsStoreHospital580OrderScrmEntity;
|
|
|
-import com.fs.hospital580.entity.FsStoreHospital580ScrmEntity;
|
|
|
-import com.fs.hospital580.service.FsStoreHospital580OrderScrmService;
|
|
|
-import com.fs.hospital580.service.FsStoreHospital580ScrmService;
|
|
|
+import com.fs.hospital580.entity.FsStoreHospital580PrescriptionMedicineScrmEntity;
|
|
|
+import com.fs.hospital580.entity.FsStoreHospital580PrescriptionScrmEntity;
|
|
|
+import com.fs.hospital580.entity.FsStoreHospital580ProductPushScrmEntity;
|
|
|
import com.fs.hospital580.service.Hospital580Service;
|
|
|
-import com.fs.hospital580.vo.FsStoreHospital580OrderScrmVo;
|
|
|
+import com.fs.hospital580.vo.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class Hospital580FacadeServiceImpl implements Hospital580FacadeService {
|
|
|
@Autowired
|
|
|
private Hospital580Service hospital580Service;
|
|
|
@Autowired
|
|
|
- private FsStoreHospital580OrderScrmService fsStoreHospital580OrderScrmService;
|
|
|
+ private FsStoreHospital580ProductPushScrmEntity productPushScrm;
|
|
|
+
|
|
|
@Override
|
|
|
public R initPreDemand(FsStoreHospital580OrderScrmVo vo) {
|
|
|
FsStoreHospital580OrderScrmEntity order = new FsStoreHospital580OrderScrmEntity();
|
|
|
@@ -28,12 +36,80 @@ public class Hospital580FacadeServiceImpl implements Hospital580FacadeService {
|
|
|
PreDemandDto dto = new PreDemandDto();
|
|
|
BeanUtil.copyProperties(vo, dto);
|
|
|
dto.setBizOrderId(order.getOrderId().toString());
|
|
|
- Result580 result580 = hospital580Service.initPreDemand(dto);
|
|
|
- if (0 == result580.getErr() ){
|
|
|
- order.setJumpUrl(result580.getData());
|
|
|
- order.updateById();
|
|
|
- return R.ok().put("data",result580.getData());
|
|
|
+ return processResult(hospital580Service.initPreDemand(dto));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R diseaseQuery(DiseaseVo vo) {
|
|
|
+ return processResult(hospital580Service.disease(BeanUtil.copyProperties(vo, DiseaseDto.class)));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void prescription(Map<String, Object> map) {
|
|
|
+ FsStoreHospital580PrescriptionScrmVo properties = BeanUtil.copyProperties(map, FsStoreHospital580PrescriptionScrmVo.class);
|
|
|
+ FsStoreHospital580PrescriptionScrmEntity prescription = new FsStoreHospital580PrescriptionScrmEntity();
|
|
|
+ BeanUtil.copyProperties(properties, prescription);
|
|
|
+ prescription.setOrderId(properties.getBizOrderId());
|
|
|
+ // 插入处方记录
|
|
|
+ prescription.insert();
|
|
|
+
|
|
|
+ List<FsStoreHospital580PrescriptionMedicineScrmVo> drugRspList = properties.getDrugRspList();
|
|
|
+ drugRspList.forEach(item -> {
|
|
|
+ FsStoreHospital580PrescriptionMedicineScrmEntity entity = new FsStoreHospital580PrescriptionMedicineScrmEntity();
|
|
|
+ BeanUtil.copyProperties(item, entity);
|
|
|
+ // 插入药品信息
|
|
|
+ entity.insert();
|
|
|
+ });
|
|
|
+ // 修改问诊单处方状态
|
|
|
+ FsStoreHospital580OrderScrmEntity order = new FsStoreHospital580OrderScrmEntity();
|
|
|
+ order.setOrderId(Long.valueOf(properties.getBizOrderId()));
|
|
|
+ order.setPrescriptionStatus((byte) 1);
|
|
|
+ order.updateById();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void refusePrescription(Map<String, Object> map) {
|
|
|
+ // 修改处方信息
|
|
|
+ RefusePrescriptionVo prescriptionVo = BeanUtil.copyProperties(map, RefusePrescriptionVo.class);
|
|
|
+ FsStoreHospital580OrderScrmEntity order = new FsStoreHospital580OrderScrmEntity();
|
|
|
+ order.setOrderId(Long.valueOf(prescriptionVo.getBizOrderId()));
|
|
|
+ order.setPrescriptionStatus((byte) 2);
|
|
|
+ order.setReason(prescriptionVo.getReason());
|
|
|
+ order.updateById();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void reviewPrescription(Map<String, Object> map) {
|
|
|
+ ReviewPrescriptionVo prescriptionVo = BeanUtil.copyProperties(map, ReviewPrescriptionVo.class);
|
|
|
+ if (ObjectUtil.isEmpty(prescriptionVo) || ObjectUtil.isEmpty(prescriptionVo.getPid())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 修改处方信息
|
|
|
+ FsStoreHospital580PrescriptionScrmEntity prescription = new FsStoreHospital580PrescriptionScrmEntity();
|
|
|
+ prescription.update(new LambdaUpdateWrapper<FsStoreHospital580PrescriptionScrmEntity>()
|
|
|
+ .eq(FsStoreHospital580PrescriptionScrmEntity::getPid, prescriptionVo.getPid())
|
|
|
+ .set(FsStoreHospital580PrescriptionScrmEntity::getAuditStatus, prescriptionVo.getAuditStatus())
|
|
|
+ .set(FsStoreHospital580PrescriptionScrmEntity::getAudiTime, prescriptionVo.getAuditTime())
|
|
|
+ .set(FsStoreHospital580PrescriptionScrmEntity::getAuditApothecaryName, prescriptionVo.getAuditApothecaryName())
|
|
|
+ .set(FsStoreHospital580PrescriptionScrmEntity::getReason, prescriptionVo.getReason())
|
|
|
+ .set(FsStoreHospital580PrescriptionScrmEntity::getDstFilePath, prescriptionVo.getDstFilePath()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void medicineSync(Map<String, Object> map) {
|
|
|
+ MedicineSyncVo medicineSyncVo = BeanUtil.copyProperties(map, MedicineSyncVo.class);
|
|
|
+ productPushScrm.update(new LambdaUpdateWrapper<FsStoreHospital580ProductPushScrmEntity>()
|
|
|
+ .in(FsStoreHospital580ProductPushScrmEntity::getProductId, medicineSyncVo.getMedicineIds())
|
|
|
+ .set(FsStoreHospital580ProductPushScrmEntity::getPushStatus, medicineSyncVo.getErrCode().equals("0") ? 1 : 2)
|
|
|
+ .set(FsStoreHospital580ProductPushScrmEntity::getErrMsg, medicineSyncVo.getErrMsg()));
|
|
|
+ }
|
|
|
+
|
|
|
+ private R processResult(Result580 result580) {
|
|
|
+ if (0 == result580.getErr()) {
|
|
|
+ return R.ok().put("data", result580.getData());
|
|
|
}
|
|
|
return R.error(result580.getErrmsg());
|
|
|
}
|
|
|
+
|
|
|
}
|