|
@@ -1,5 +1,17 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.diagbot.dto.IndexDataDTO;
|
|
|
import com.diagbot.dto.ItemIndexDTO;
|
|
@@ -9,20 +21,10 @@ import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.IndexDataServiceImpl;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.vo.IndexDataFindVO;
|
|
|
import com.diagbot.vo.IndexDataSaveVO;
|
|
|
import com.diagbot.vo.IndexDataVO;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import java.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author wangfeng
|
|
@@ -85,43 +87,46 @@ public class IndexDataFacade extends IndexDataServiceImpl {
|
|
|
* @param indexDataSaveVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public boolean saveIndexDatas(IndexDataSaveVO indexDataSaveVO) {
|
|
|
- // 先查询该用户相同就诊号所保留的数据,将其删除
|
|
|
- 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());
|
|
|
- boolean res = update(new IndexData(), IndexDataUpdate);
|
|
|
+ public boolean saveIndexDatas(IndexDataSaveVO indexDataSaveVO) {
|
|
|
+ boolean res = false;
|
|
|
+ if (null != indexDataSaveVO && ListUtil.isNotEmpty(indexDataSaveVO.getIndexData())) {
|
|
|
+ // 先查询该用户相同就诊号所保留的数据,将其删除
|
|
|
+ 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) {
|
|
|
- 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);
|
|
|
- }
|
|
|
+ // 遍历数据进行保存
|
|
|
+ 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) {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
|
|
|
- res = insertIndexDataList(IndexDataList);
|
|
|
+ res = insertIndexDataList(IndexDataList);
|
|
|
+ }
|
|
|
|
|
|
- return res;
|
|
|
- }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
}
|