|
@@ -4,21 +4,13 @@ import cn.hutool.core.util.IdUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.fs.common.exception.CustomException;
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
import com.fs.common.utils.DateUtils;
|
|
|
-import com.fs.his.domain.FsDoctor;
|
|
|
|
|
-import com.fs.his.domain.FsPrescribe;
|
|
|
|
|
-import com.fs.his.domain.FsUser;
|
|
|
|
|
-import com.fs.his.domain.FsUserAddress;
|
|
|
|
|
|
|
+import com.fs.his.domain.*;
|
|
|
import com.fs.his.dto.*;
|
|
import com.fs.his.dto.*;
|
|
|
-import com.fs.his.mapper.FsDoctorMapper;
|
|
|
|
|
-import com.fs.his.mapper.FsPrescribeMapper;
|
|
|
|
|
-import com.fs.his.mapper.FsUserAddressMapper;
|
|
|
|
|
-import com.fs.his.mapper.FsUserMapper;
|
|
|
|
|
|
|
+import com.fs.his.mapper.*;
|
|
|
import com.fs.his.service.IFsQuestionAndAnswerService;
|
|
import com.fs.his.service.IFsQuestionAndAnswerService;
|
|
|
import com.fs.his.service.IPollingAssignDoctorService;
|
|
import com.fs.his.service.IPollingAssignDoctorService;
|
|
|
import com.fs.his.utils.IdCardUtil;
|
|
import com.fs.his.utils.IdCardUtil;
|
|
|
-import com.fs.his.vo.FsPrescribeListVO;
|
|
|
|
|
-import com.fs.his.vo.FsQuestionAndAnswerVO;
|
|
|
|
|
-import com.fs.his.vo.SubmitUserInformationVO;
|
|
|
|
|
|
|
+import com.fs.his.vo.*;
|
|
|
import com.fs.hisStore.domain.FsUserInformationCollection;
|
|
import com.fs.hisStore.domain.FsUserInformationCollection;
|
|
|
import com.fs.hisStore.mapper.FsUserInformationCollectionMapper;
|
|
import com.fs.hisStore.mapper.FsUserInformationCollectionMapper;
|
|
|
import com.fs.hisStore.service.IOpenApiCPWUserInformationService;
|
|
import com.fs.hisStore.service.IOpenApiCPWUserInformationService;
|
|
@@ -32,9 +24,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Calendar;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 对接-超拼网-信息采集服务实现类
|
|
* 对接-超拼网-信息采集服务实现类
|
|
@@ -61,6 +52,9 @@ public class OpenApiCPWUserInformationServiceImpl implements IOpenApiCPWUserInfo
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FsPrescribeMapper prescribeMapper;
|
|
private FsPrescribeMapper prescribeMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FsPrescribeDrugMapper prescribeDrugMapper;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FsDoctorMapper doctorMapper;
|
|
private FsDoctorMapper doctorMapper;
|
|
|
|
|
|
|
@@ -163,7 +157,7 @@ public class OpenApiCPWUserInformationServiceImpl implements IOpenApiCPWUserInfo
|
|
|
fsPrescribe.setPrescribeDoctorSignUrl(fsDoctor.getSignUrl());
|
|
fsPrescribe.setPrescribeDoctorSignUrl(fsDoctor.getSignUrl());
|
|
|
|
|
|
|
|
//分配在线的随机药师
|
|
//分配在线的随机药师
|
|
|
- fsPrescribe.setDrugDoctorId(515L);
|
|
|
|
|
|
|
+ fsPrescribe.setDrugDoctorId(514L);
|
|
|
fsPrescribe.setDrugDoctorSignUrl("https://ysy-1329817240.cos.ap-guangzhou.myqcloud.com/ysy/20251114/7a0d28df6aa94a9c819e025c9a230c6f.png");
|
|
fsPrescribe.setDrugDoctorSignUrl("https://ysy-1329817240.cos.ap-guangzhou.myqcloud.com/ysy/20251114/7a0d28df6aa94a9c819e025c9a230c6f.png");
|
|
|
// FsDoctor fsDrugDoctor = null;
|
|
// FsDoctor fsDrugDoctor = null;
|
|
|
// try {
|
|
// try {
|
|
@@ -240,8 +234,76 @@ public class OpenApiCPWUserInformationServiceImpl implements IOpenApiCPWUserInfo
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Object pushPrescription(String userId, String prescriptionId) {
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ public int prescriptionReceipt(List<Long> prescriptionIds) {
|
|
|
|
|
+ if (CollectionUtils.isEmpty(prescriptionIds)){
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("超拼网-推送回执处方id:{}", prescriptionIds);
|
|
|
|
|
+ return prescribeMapper.updateFsPrescribeListDataCPWByPrescribeIds(prescriptionIds);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<CPWPrescribeDataVO> pushPrescription() {
|
|
|
|
|
+ // 获取待推送到"超拼网"的处方数据
|
|
|
|
|
+ List<FsPrescribe> fsPrescribes = prescribeMapper.selectFsPrescribeListDataPushCPW();
|
|
|
|
|
+
|
|
|
|
|
+ if (CollectionUtils.isEmpty(fsPrescribes)) {
|
|
|
|
|
+ log.info("无待推送超拼网的处方");
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取所有处方的ID列表
|
|
|
|
|
+ List<Long> prescribeIds = fsPrescribes.stream()
|
|
|
|
|
+ .map(FsPrescribe::getPrescribeId)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ // 批量查询药品信息
|
|
|
|
|
+ List<FsPrescribeDrug> prescribeDrugList = prescribeDrugMapper.selectFsPrescribeDrugListByPrescribeIds(prescribeIds);
|
|
|
|
|
+
|
|
|
|
|
+ // 按处方ID分组药品
|
|
|
|
|
+ Map<Long, List<FsPrescribeDrug>> prescribeDrugMap = new HashMap<>();
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(prescribeDrugList)) {
|
|
|
|
|
+ prescribeDrugMap = prescribeDrugList.stream()
|
|
|
|
|
+ .collect(Collectors.groupingBy(FsPrescribeDrug::getPrescribeId));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 组装返回结果
|
|
|
|
|
+ List<CPWPrescribeDataVO> resultList = new ArrayList<>();
|
|
|
|
|
+ for (FsPrescribe item : fsPrescribes) {
|
|
|
|
|
+ CPWPrescribeDataVO resultVO = new CPWPrescribeDataVO();
|
|
|
|
|
+ resultVO.setPatientId(item.getPatientId());
|
|
|
|
|
+ resultVO.setPatientName(item.getPatientName());
|
|
|
|
|
+ resultVO.setPrescribeImgUrl(item.getPrescribeImgUrl());
|
|
|
|
|
+
|
|
|
|
|
+ // 获取该处方的药品列表并转换为VO
|
|
|
|
|
+ List<FsPrescribeDrug> drugList = prescribeDrugMap.getOrDefault(item.getPrescribeId(), new ArrayList<>());
|
|
|
|
|
+ List<CPWPrescribeDrugVO> drugVOList = convertToCPWPrescribeDrugVO(drugList);
|
|
|
|
|
+ resultVO.setDrugList(drugVOList);
|
|
|
|
|
+
|
|
|
|
|
+ resultList.add(resultVO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return resultList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 将FsPrescribeDrug转换为CPWPrescribeDrugVO
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<CPWPrescribeDrugVO> convertToCPWPrescribeDrugVO(List<FsPrescribeDrug> drugList) {
|
|
|
|
|
+ if (CollectionUtils.isEmpty(drugList)) {
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return drugList.stream().map(drug -> {
|
|
|
|
|
+ CPWPrescribeDrugVO vo = new CPWPrescribeDrugVO();
|
|
|
|
|
+ vo.setPrescribeId(drug.getPrescribeId());
|
|
|
|
|
+ vo.setDrugName(drug.getDrugName());
|
|
|
|
|
+ vo.setDrugSpec(drug.getDrugSpec());
|
|
|
|
|
+ vo.setUsageMethod(drug.getUsageMethod());
|
|
|
|
|
+ vo.setUsageFrequencyUnit(drug.getUsageFrequencyUnit());
|
|
|
|
|
+ vo.setUsagePerUseCount(drug.getUsagePerUseCount());
|
|
|
|
|
+ return vo;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|