|
@@ -1,11 +1,13 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
+import com.diagbot.client.AiptServiceClient;
|
|
|
import com.diagbot.dto.IndexConfigAndDataDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.vo.IndexDataFindVO;
|
|
|
import com.diagbot.vo.IndexDataSaveVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
|
|
/**
|
|
|
* @author wangfeng
|
|
@@ -16,7 +18,7 @@ import com.diagbot.vo.IndexDataSaveVO;
|
|
|
public class IndexDataFacade {
|
|
|
|
|
|
@Autowired
|
|
|
- private IndexConfigFacade indexConfigFacade;
|
|
|
+ AiptServiceClient aiptServiceClient;
|
|
|
|
|
|
/**
|
|
|
* 根据疾病id和用户id,开始时间和结束时间 查询用户指标数据
|
|
@@ -25,44 +27,9 @@ public class IndexDataFacade {
|
|
|
* @return
|
|
|
*/
|
|
|
public IndexConfigAndDataDTO getIndexDataAll(IndexDataFindVO indexDataFindVO) {
|
|
|
-
|
|
|
- /* Map<String, Object> indexDataMap = new HashMap<>();
|
|
|
- indexDataMap.put("diseaseId", indexDataFindVO.getDiseaseId());
|
|
|
- indexDataMap.put("patientId", indexDataFindVO.getPatientId());
|
|
|
- indexDataMap.put("startTime", indexDataFindVO.getStartTime());
|
|
|
- indexDataMap.put("endTime", indexDataFindVO.getEndTime());
|
|
|
- //获取慢病指标数据
|
|
|
- List<IndexDataDTO> data = this.getIndexDataAll(indexDataMap);
|
|
|
- List<ItemIndexDTO> list = new ArrayList<ItemIndexDTO>();
|
|
|
- // 根据公表名分组
|
|
|
- Map<String, List<IndexDataDTO>> dataMap = data.stream()
|
|
|
- .collect(Collectors.groupingBy(IndexDataDTO::getIndexUnique));
|
|
|
-
|
|
|
- for (String key : dataMap.keySet()) {
|
|
|
- ItemIndexDTO itemIndexDTO = new ItemIndexDTO();
|
|
|
- itemIndexDTO.setItemName(key);
|
|
|
- List<String> indexUnits = new ArrayList<String>();
|
|
|
- List<String> indexValues = new ArrayList<String>();
|
|
|
- List<Integer> isAbnormals = new ArrayList<Integer>();
|
|
|
- List<Date> creatTimes = new ArrayList<Date>();
|
|
|
- List<IndexDataDTO> indexDatas = dataMap.get(key);
|
|
|
- for (IndexDataDTO indexDataDTO : indexDatas) {
|
|
|
- indexUnits.add(indexDataDTO.getIndexUnit());
|
|
|
- indexValues.add(indexDataDTO.getIndexValue());
|
|
|
- isAbnormals.add(indexDataDTO.getIsAbnormal());
|
|
|
- creatTimes.add(indexDataDTO.getCreatTime());
|
|
|
- }
|
|
|
- itemIndexDTO.setIndexUnit(indexUnits);
|
|
|
- itemIndexDTO.setIndexValue(indexValues);
|
|
|
- itemIndexDTO.setIsAbnormal(isAbnormals);
|
|
|
- itemIndexDTO.setCreatTime(creatTimes);
|
|
|
- list.add(itemIndexDTO);
|
|
|
-
|
|
|
- }
|
|
|
- IndexConfigAndDataDTO indexsData = new IndexConfigAndDataDTO();
|
|
|
- indexsData.setIndexConfigData(indexConfigFacade.getindexConfig(indexDataFindVO.getDiseaseId()));
|
|
|
- indexsData.setItemIndexData(list);*/
|
|
|
- return null;
|
|
|
+ RespDTO<IndexConfigAndDataDTO> dataList = aiptServiceClient.getIndexDatas(indexDataFindVO);
|
|
|
+ RespDTOUtil.respNGDeal(dataList, dataList.msg);
|
|
|
+ return dataList.data;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -71,54 +38,9 @@ public class IndexDataFacade {
|
|
|
* @param indexDataSaveVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public boolean saveIndexDatas(IndexDataSaveVO indexDataSaveVO) {
|
|
|
- /* boolean res = false;
|
|
|
- if (null != indexDataSaveVO && ListUtil.isNotEmpty(indexDataSaveVO.getIndexData())) {
|
|
|
- IndexConfigdiseaseNameVO IndexConfigdiseaseNameVO = new IndexConfigdiseaseNameVO();
|
|
|
- //获取所有需要记录的指标项
|
|
|
- List<IndexConfigDTO> data = indexConfigFacade.getindexConfig(IndexConfigdiseaseNameVO);
|
|
|
- List<String> indexUniquelist
|
|
|
- = data.stream().map(i -> i.getIndexUnique()).collect(Collectors.toList());
|
|
|
-
|
|
|
- // 先查询该用户相同就诊号所保留的数据,将其删除
|
|
|
- UpdateWrapper<IndexData> IndexDataUpdate = new UpdateWrapper<>();
|
|
|
- Map<String, Object> mapAll = new HashMap<>();
|
|
|
- mapAll.put("inquiry_code", indexDataSaveVO.getInquiryCode());
|
|
|
- mapAll.put("patient_id", indexDataSaveVO.getPatientId());
|
|
|
- IndexDataUpdate.allEq(mapAll).eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
- // .set("modifier",UserUtils.getCurrentPrincipleID())
|
|
|
- .set("gmt_modified", DateUtil.now());
|
|
|
- res = update(new IndexData(), IndexDataUpdate);
|
|
|
-
|
|
|
- // 遍历数据进行保存
|
|
|
- List<IndexData> IndexDataList = new ArrayList<IndexData>();
|
|
|
- List<IndexDataVO> indexDatas = indexDataSaveVO.getIndexData();
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- for (IndexDataVO indexDataNew : indexDatas) {
|
|
|
- if (indexUniquelist.contains(indexDataNew.getIndexUnique())) {
|
|
|
- IndexData indexData = new IndexData();
|
|
|
- indexData.setCreator(indexDataSaveVO.getDoctorId().toString());
|
|
|
- indexData.setGmtCreate(DateUtil.now());
|
|
|
- indexData.setIndexUnique(indexDataNew.getIndexUnique());
|
|
|
- try {
|
|
|
- indexData.setCreatTime(sdf.parse(indexDataNew.getCreatTime()));
|
|
|
- } catch (ParseException e) {
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "时间格式有误");
|
|
|
- }
|
|
|
- indexData.setIndexUnit(indexDataNew.getIndexUnit());
|
|
|
- indexData.setIndexValue(indexDataNew.getIndexValue());
|
|
|
- indexData.setInquiryCode(indexDataSaveVO.getInquiryCode());
|
|
|
- indexData.setIsAbnormal(indexDataNew.getIsAbnormal());
|
|
|
- indexData.setPatientId(indexDataSaveVO.getPatientId());
|
|
|
- IndexDataList.add(indexData);
|
|
|
- }
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(IndexDataList)) {
|
|
|
- res = insertIndexDataList(IndexDataList);
|
|
|
- }
|
|
|
-
|
|
|
- }*/
|
|
|
- return false;
|
|
|
- }
|
|
|
+ public Boolean saveIndexDatas(IndexDataSaveVO indexDataSaveVO) {
|
|
|
+ RespDTO<Boolean> data = aiptServiceClient.saveIndexDatas(indexDataSaveVO);
|
|
|
+ RespDTOUtil.respNGDeal(data, data.msg);
|
|
|
+ return data.data;
|
|
|
}
|
|
|
+}
|