gaodm il y a 6 ans
Parent
commit
31cc1d839a

+ 14 - 0
common/src/main/java/com/diagbot/util/ListUtil.java

@@ -1,6 +1,7 @@
 package com.diagbot.util;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -71,4 +72,17 @@ public class ListUtil {
         }
         return list.get(FIRST);
     }
+
+    public static <E> ArrayList<E> arrayToList(E[] strArray) {
+        ArrayList<E> arrayList = new ArrayList<>(strArray.length);
+        Collections.addAll(arrayList, strArray);
+        return arrayList;
+    }
+
+    public static void main(String[] args) throws Exception {
+        String[] i ={"A","B"};
+        List<String> o = arrayToList(i);
+        System.out.println("输入参数:"+ i);
+        System.out.println("输出参数:"+ o);
+    }
 }

+ 17 - 17
icss-service/src/main/java/com/diagbot/facade/HospitalDeptFacade.java

@@ -1,16 +1,15 @@
 package com.diagbot.facade;
 
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
 import com.diagbot.client.TranServiceClient;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.HospitalDept;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author rgb
@@ -19,23 +18,24 @@ import com.diagbot.exception.CommonException;
  */
 @Component
 public class HospitalDeptFacade {
-	
-	@Autowired
+
+    @Autowired
     private TranServiceClient tranServiceClient;
-	
-	/**
+
+    /**
      * 根据ids获取科室信息map
+     *
      * @param ids 科室ids
      * @return 科室信息
      */
     public Map<Long, HospitalDept> hospitalDeptInfoMapByIds(List<Long> ids) {
-    	 RespDTO<Map<Long, HospitalDept>> retData = tranServiceClient.hospitalDeptInfoMapByIds(ids);
-         if (retData == null
-                 || !CommonErrorCode.OK.getCode().equals(retData.code)) {
-             throw new CommonException(CommonErrorCode.RPC_ERROR,
-                     "获取科室信息失败");
-         }
-         return retData.data;
+        RespDTO<Map<Long, HospitalDept>> retData = tranServiceClient.hospitalDeptInfoMapByIds(ids);
+        if (retData == null
+                || !CommonErrorCode.OK.getCode().equals(retData.code)) {
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    "获取科室信息失败");
+        }
+        return retData.data;
     }
 
 }

+ 8 - 9
icss-service/src/main/java/com/diagbot/facade/HospitalInfoFacade.java

@@ -1,16 +1,15 @@
 package com.diagbot.facade;
 
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
 import com.diagbot.client.TranServiceClient;
 import com.diagbot.dto.HospitalInfoDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.vo.HospitalInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
 
 /**
  * @Description:
@@ -46,12 +45,12 @@ public class HospitalInfoFacade {
      * @return
      */
     public HospitalInfoDTO getHospitalByCode(String code) {
-    	HospitalInfoVO hospitalInfoVO = new HospitalInfoVO();
-    	hospitalInfoVO.setCode(code);
-    	RespDTO<List<HospitalInfoDTO>> hospitalInfoDTOList = tranServiceClient.getHospitalInfo(hospitalInfoVO);
+        HospitalInfoVO hospitalInfoVO = new HospitalInfoVO();
+        hospitalInfoVO.setCode(code);
+        RespDTO<List<HospitalInfoDTO>> hospitalInfoDTOList = tranServiceClient.getHospitalInfo(hospitalInfoVO);
         if (hospitalInfoDTOList == null
                 || !CommonErrorCode.OK.getCode().equals(hospitalInfoDTOList.code)
-                ||hospitalInfoDTOList.data.size()!=1) {
+                || hospitalInfoDTOList.data.size() != 1) {
             throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取医院信息失败");
         }

+ 58 - 59
icss-service/src/main/java/com/diagbot/facade/IndexDataFacade.java

@@ -1,17 +1,5 @@
 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.IndexConfigAndDataDTO;
 import com.diagbot.dto.IndexConfigDTO;
@@ -27,6 +15,17 @@ 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
@@ -92,54 +91,54 @@ public class IndexDataFacade extends IndexDataServiceImpl {
      * @param indexDataSaveVO
      * @return
      */
-	public boolean saveIndexDatas(IndexDataSaveVO indexDataSaveVO) {
-		boolean res = false;
-		if (null != indexDataSaveVO && ListUtil.isNotEmpty(indexDataSaveVO.getIndexData())) {
-			//获取所有需要记录的指标项
-			List<IndexConfigDTO> data = indexConfigFacade.getindexConfig(null);
-			List<String> indexUniquelist
-					= data.stream().map(i->i.getIndexUnique()).collect(Collectors.toList());
+    public boolean saveIndexDatas(IndexDataSaveVO indexDataSaveVO) {
+        boolean res = false;
+        if (null != indexDataSaveVO && ListUtil.isNotEmpty(indexDataSaveVO.getIndexData())) {
+            //获取所有需要记录的指标项
+            List<IndexConfigDTO> data = indexConfigFacade.getindexConfig(null);
+            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);
+            // 先查询该用户相同就诊号所保留的数据,将其删除
+            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 res;
-	}
+            // 遍历数据进行保存
+            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 res;
+    }
 
 }

+ 8 - 11
icss-service/src/main/java/com/diagbot/facade/InquiryDrugFacade.java

@@ -1,13 +1,12 @@
 package com.diagbot.facade;
 
-import java.util.List;
-
-import org.springframework.stereotype.Component;
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.entity.InquiryDrug;
 import com.diagbot.service.impl.InquiryDrugServiceImpl;
 import com.diagbot.util.ListUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
 
 /**
  * @author rengb
@@ -16,7 +15,7 @@ import com.diagbot.util.ListUtil;
  */
 @Component
 public class InquiryDrugFacade extends InquiryDrugServiceImpl {
-	
+
     /**
      * 根据问诊记录id删除问诊记录处方用药明细
      *
@@ -27,7 +26,7 @@ public class InquiryDrugFacade extends InquiryDrugServiceImpl {
         queryWrapper.eq("inquiry_id", inquiryId);
         this.remove(queryWrapper);
     }
-    
+
     /**
      * 批量保存问诊记录处方用药明细
      *
@@ -35,10 +34,10 @@ public class InquiryDrugFacade extends InquiryDrugServiceImpl {
      */
     public void saveInquiryDrugs(List<InquiryDrug> inquiryDrugList) {
         if (ListUtil.isNotEmpty(inquiryDrugList)) {
-           super.saveBatch(inquiryDrugList);
+            super.saveBatch(inquiryDrugList);
         }
     }
-    
+
     /**
      * 根据问诊记录id获取问诊记录处方用药明细
      *
@@ -49,8 +48,6 @@ public class InquiryDrugFacade extends InquiryDrugServiceImpl {
         queryWrapper.eq("inquiry_id", inquiryId);
         return this.list(queryWrapper);
     }
-    
-    
-    
+
 
 }

+ 6 - 7
icss-service/src/main/java/com/diagbot/facade/InquiryEvaluationFacade.java

@@ -1,12 +1,11 @@
 package com.diagbot.facade;
 
-import java.util.List;
-
-import org.springframework.stereotype.Component;
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.entity.InquiryEvaluation;
 import com.diagbot.service.impl.InquiryEvaluationServiceImpl;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
 
 /**
  * @author rengb
@@ -15,8 +14,8 @@ import com.diagbot.service.impl.InquiryEvaluationServiceImpl;
  */
 @Component
 public class InquiryEvaluationFacade extends InquiryEvaluationServiceImpl {
-	
-	/**
+
+    /**
      * 根据问诊记录id删除问诊记录评估结果
      *
      * @param inquiryId
@@ -26,7 +25,7 @@ public class InquiryEvaluationFacade extends InquiryEvaluationServiceImpl {
         queryWrapper.eq("inquiry_id", inquiryId);
         this.remove(queryWrapper);
     }
-    
+
     /**
      * 根据问诊记录id获取评估结果
      *

+ 80 - 81
icss-service/src/main/java/com/diagbot/facade/InquiryInfoFacade.java

@@ -1,18 +1,5 @@
 package com.diagbot.facade;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.TranServiceClient;
 import com.diagbot.dto.GetEvaluationScalesDTO;
@@ -55,6 +42,18 @@ import com.diagbot.vo.ReadInquiryVO;
 import com.diagbot.vo.SaveInquiryDetailVO;
 import com.diagbot.vo.SaveInquiryToHisVO;
 import com.diagbot.vo.SaveInquiryVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * @author rengb
@@ -141,10 +140,10 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
         }
 
 
-        Long inquiryId_=inquiryId;
+        Long inquiryId_ = inquiryId;
 
         List<String> contentList = new ArrayList<>();
-        if(ListUtil.isNotEmpty(saveInquiryVO.getDetailList())){
+        if (ListUtil.isNotEmpty(saveInquiryVO.getDetailList())) {
             List<InquiryDetail> inquiryDetailList = new ArrayList<>();
             for (SaveInquiryDetailVO i : saveInquiryVO.getDetailList()) {
                 InquiryDetail inquiryDetail = new InquiryDetail();
@@ -158,34 +157,34 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
             inquiryDetailFacade.saveInquiryDetails(inquiryDetailList);
         }
 
-        if(ListUtil.isNotEmpty(saveInquiryVO.getDrugList())){
-        	List<InquiryDrug> inquiryDrugList = BeanUtil.listCopyTo(saveInquiryVO.getDrugList(),InquiryDrug.class);
-            inquiryDrugList.stream().forEach(i->{
-            	i.setInquiryId(inquiryId_);
-            	i.setGmtCreate(now);
+        if (ListUtil.isNotEmpty(saveInquiryVO.getDrugList())) {
+            List<InquiryDrug> inquiryDrugList = BeanUtil.listCopyTo(saveInquiryVO.getDrugList(), InquiryDrug.class);
+            inquiryDrugList.stream().forEach(i -> {
+                i.setInquiryId(inquiryId_);
+                i.setGmtCreate(now);
             });
             inquiryDrugService.saveBatch(inquiryDrugList);
         }
 
-        if(saveInquiryVO.getInquiryEvaluation()!=null){
-        	InquiryEvaluation inquiryEvaluation = new InquiryEvaluation();
-        	inquiryEvaluation.setInquiryId(inquiryId_);
-        	inquiryEvaluation.setGmtCreate(now);
-        	inquiryEvaluation.setHtmlContent(saveInquiryVO.getInquiryEvaluation().getHtmlContent());
-        	inquiryEvaluationFacade.save(inquiryEvaluation);
-
-        	if(ListUtil.isNotEmpty(saveInquiryVO.getInquiryEvaluation().getScaleList())){
-        		List<InquiryScale> inquiryScaleList = BeanUtil.listCopyTo(saveInquiryVO.getInquiryEvaluation().getScaleList(),InquiryScale.class);
-        		inquiryScaleList.forEach(i->{
-        			i.setInquiryId(inquiryId_);
-        			i.setInquiryEvaluationId(inquiryEvaluation.getId());
-        			i.setGmtCreate(now);
-        		});
-        		inquiryScaleService.saveBatch(inquiryScaleList);
-        	}
+        if (saveInquiryVO.getInquiryEvaluation() != null) {
+            InquiryEvaluation inquiryEvaluation = new InquiryEvaluation();
+            inquiryEvaluation.setInquiryId(inquiryId_);
+            inquiryEvaluation.setGmtCreate(now);
+            inquiryEvaluation.setHtmlContent(saveInquiryVO.getInquiryEvaluation().getHtmlContent());
+            inquiryEvaluationFacade.save(inquiryEvaluation);
+
+            if (ListUtil.isNotEmpty(saveInquiryVO.getInquiryEvaluation().getScaleList())) {
+                List<InquiryScale> inquiryScaleList = BeanUtil.listCopyTo(saveInquiryVO.getInquiryEvaluation().getScaleList(), InquiryScale.class);
+                inquiryScaleList.forEach(i -> {
+                    i.setInquiryId(inquiryId_);
+                    i.setInquiryEvaluationId(inquiryEvaluation.getId());
+                    i.setGmtCreate(now);
+                });
+                inquiryScaleService.saveBatch(inquiryScaleList);
+            }
         }
         //指标信息保存
-        if(ListUtil.isNotEmpty(saveInquiryVO.getIndexData())){
+        if (ListUtil.isNotEmpty(saveInquiryVO.getIndexData())) {
             IndexDataSaveVO indexDataSaveVO = new IndexDataSaveVO();
             BeanUtil.copyProperties(saveInquiryVO, indexDataSaveVO);
             indexDataFacade.saveIndexDatas(indexDataSaveVO);
@@ -220,14 +219,14 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
         if (inquiryInfo != null) {
             readInquiryDTO.setDataJson(inquiryInfo.getDataJson());
             BeanUtil.copyProperties(inquiryInfo, readInquiryDTO);
-            
+
             QueryWrapper<InquiryDetail> inquiryDetailQe = new QueryWrapper<>();
             inquiryDetailQe.eq("inquiry_id", inquiryInfo.getId());
-            readInquiryDTO.setDetailList(inquiryDetailFacade.list(inquiryDetailQe).stream().sorted((a,b)->a.getType()-b.getType()).collect(Collectors.toList()));
+            readInquiryDTO.setDetailList(inquiryDetailFacade.list(inquiryDetailQe).stream().sorted((a, b) -> a.getType() - b.getType()).collect(Collectors.toList()));
 
             List<InquiryDrug> inquiryDrugList = inquiryDrugFacade.getInquiryDrugs(inquiryInfo.getId());
 
-            List<ReadInquiryDrugDTO> drugList = BeanUtil.listCopyTo(inquiryDrugList,ReadInquiryDrugDTO.class);
+            List<ReadInquiryDrugDTO> drugList = BeanUtil.listCopyTo(inquiryDrugList, ReadInquiryDrugDTO.class);
             readInquiryDTO.setDrugList(drugList);
         }
 
@@ -241,14 +240,14 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
      * @return
      */
     public GetLastOtherDTO getLastOther(GetLastOtherVO getLastOtherVO) {
-    	GetLastOtherDTO getLastOtherDTO = new GetLastOtherDTO();
-    	
-    	HospitalInfoDTO hospitalInfoDTO = hospitalInfoFacade.getHospitalByCode(getLastOtherVO.getHospitalCode());
-    	
-    	PatientInfoVO patientInfoVO = new PatientInfoVO();
-    	patientInfoVO.setHospitalCode(getLastOtherVO.getHospitalCode());
-    	patientInfoVO.setPatientCode(getLastOtherVO.getPatientCode());
-    	PatientInfoDTO patientInfoDTO = patientInfoFacade.getPatientInfo(patientInfoVO);
+        GetLastOtherDTO getLastOtherDTO = new GetLastOtherDTO();
+
+        HospitalInfoDTO hospitalInfoDTO = hospitalInfoFacade.getHospitalByCode(getLastOtherVO.getHospitalCode());
+
+        PatientInfoVO patientInfoVO = new PatientInfoVO();
+        patientInfoVO.setHospitalCode(getLastOtherVO.getHospitalCode());
+        patientInfoVO.setPatientCode(getLastOtherVO.getPatientCode());
+        PatientInfoDTO patientInfoDTO = patientInfoFacade.getPatientInfo(patientInfoVO);
 
         Map<String, Object> map = new HashMap<>();
         map.put("hospitalId", hospitalInfoDTO.getId());
@@ -257,14 +256,14 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
         InquiryInfo inquiryInfo = baseMapper.getPatientLast(map);
 
         if (inquiryInfo != null) {
-        	getLastOtherDTO.setDataJson(inquiryInfo.getDataJson());
-        	
-        	QueryWrapper<InquiryDetail> inquiryDetailQe = new QueryWrapper<>();
+            getLastOtherDTO.setDataJson(inquiryInfo.getDataJson());
+
+            QueryWrapper<InquiryDetail> inquiryDetailQe = new QueryWrapper<>();
             inquiryDetailQe.eq("inquiry_id", inquiryInfo.getId());
             inquiryDetailQe.eq("type", 3);
             InquiryDetail inquiryDetail = inquiryDetailFacade.getOne(inquiryDetailQe);
-            if(inquiryDetail!=null){
-            	getLastOtherDTO.setOtherStr(inquiryDetail.getContent());
+            if (inquiryDetail != null) {
+                getLastOtherDTO.setOtherStr(inquiryDetail.getContent());
             }
         }
         return getLastOtherDTO;
@@ -280,11 +279,11 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
         QueryWrapper<InquiryInfo> queryWrapper = new QueryWrapper<InquiryInfo>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
         queryWrapper.eq("hospital_id", hisInquirysVO.getHospitalId());
-        if(hisInquirysVO.getHospitalDeptId()!=null){
-        	queryWrapper.eq("hospital_dept_id", hisInquirysVO.getHospitalDeptId());
+        if (hisInquirysVO.getHospitalDeptId() != null) {
+            queryWrapper.eq("hospital_dept_id", hisInquirysVO.getHospitalDeptId());
         }
-        if(hisInquirysVO.getDoctorId()!=null){
-        	queryWrapper.eq("doctor_id", hisInquirysVO.getDoctorId());
+        if (hisInquirysVO.getDoctorId() != null) {
+            queryWrapper.eq("doctor_id", hisInquirysVO.getDoctorId());
         }
         if (hisInquirysVO.getPatientId() != null) {
             queryWrapper.eq("patient_id", hisInquirysVO.getPatientId());
@@ -306,16 +305,16 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
         } else if (hisInquirysVO.getOrderType() == 2) {
             queryWrapper.orderByAsc("gmt_modified");
         }
-        
-        if(hisInquirysVO.getDisType()==1){
-        	Date nowDate = DateUtil.now();
-        	Date lastDate = DateUtil.addMonth(nowDate,-6);
-        	queryWrapper.ge("gmt_create", lastDate);
-        	queryWrapper.le("gmt_create", nowDate);
-        	queryWrapper.likeRight("diagnose", hisInquirysVO.getDisName());
+
+        if (hisInquirysVO.getDisType() == 1) {
+            Date nowDate = DateUtil.now();
+            Date lastDate = DateUtil.addMonth(nowDate, -6);
+            queryWrapper.ge("gmt_create", lastDate);
+            queryWrapper.le("gmt_create", nowDate);
+            queryWrapper.likeRight("diagnose", hisInquirysVO.getDisName());
         }
-        
-        
+
+
         List<InquiryInfo> inquiryInfoList = this.list(queryWrapper);
         if (inquiryInfoList.size() == 0) {
             return null;
@@ -354,7 +353,7 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
 
         return hisInquiryDTOList;
     }
-    
+
     /**
      * 对接-历史病历列表
      *
@@ -362,20 +361,20 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
      * @return
      */
     public List<HisInquirysForDjDTO> hisInquirysForDj(HisInquirysForDjVO hisInquirysForDjVO) {
-    	QueryWrapper<InquiryInfo> queryWrapper = new QueryWrapper<InquiryInfo>();
+        QueryWrapper<InquiryInfo> queryWrapper = new QueryWrapper<InquiryInfo>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
         queryWrapper.eq("hospital_id", hisInquirysForDjVO.getHospitalId());
-        if(hisInquirysForDjVO.getHospitalDeptId()!=null){
-        	queryWrapper.eq("hospital_dept_id", hisInquirysForDjVO.getHospitalDeptId());
+        if (hisInquirysForDjVO.getHospitalDeptId() != null) {
+            queryWrapper.eq("hospital_dept_id", hisInquirysForDjVO.getHospitalDeptId());
         }
-        if(hisInquirysForDjVO.getDoctorId()!=null){
-        	queryWrapper.eq("doctor_id", hisInquirysForDjVO.getDoctorId());
+        if (hisInquirysForDjVO.getDoctorId() != null) {
+            queryWrapper.eq("doctor_id", hisInquirysForDjVO.getDoctorId());
         }
         if (hisInquirysForDjVO.getPatientId() != null) {
             queryWrapper.eq("patient_id", hisInquirysForDjVO.getPatientId());
         }
-        if(StringUtil.isNotBlank(hisInquirysForDjVO.getInquiryCode())){
-        	queryWrapper.eq("inquiry_code", hisInquirysForDjVO.getInquiryCode());
+        if (StringUtil.isNotBlank(hisInquirysForDjVO.getInquiryCode())) {
+            queryWrapper.eq("inquiry_code", hisInquirysForDjVO.getInquiryCode());
         }
         if (hisInquirysForDjVO.getType() != null) {
             queryWrapper.eq("type", hisInquirysForDjVO.getType());
@@ -402,8 +401,8 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
         Map<Long, List<InquiryDetail>> inquiryDetailMap = inquiryDetailFacade.getDetailsByInquryIds(inquiryInfoList.stream().map(i -> i.getId()).collect(Collectors.toList()));
         List<HisInquirysForDjDTO> hisInquirysForDjDTOList = BeanUtil.listCopyTo(inquiryInfoList, HisInquirysForDjDTO.class);
 
-        hisInquirysForDjDTOList.forEach(i->{
-        	i.setContentList(inquiryDetailMap.get(i.getId()).stream().map(k->k.getContentValue()).collect(Collectors.toList()));
+        hisInquirysForDjDTOList.forEach(i -> {
+            i.setContentList(inquiryDetailMap.get(i.getId()).stream().map(k -> k.getContentValue()).collect(Collectors.toList()));
         });
 
         return hisInquirysForDjDTOList;
@@ -433,7 +432,7 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
      * @return
      */
     public List<GetEvaluationsDTO> getEvaluations(GetEvaluationsVO getEvaluationsVO) {
-    	List<InquiryEvaluation> inquiryEvaluationList = inquiryEvaluationFacade.getEvaluationsByInquiryId(getEvaluationsVO.getInquiryId());
+        List<InquiryEvaluation> inquiryEvaluationList = inquiryEvaluationFacade.getEvaluationsByInquiryId(getEvaluationsVO.getInquiryId());
         return BeanUtil.listCopyTo(inquiryEvaluationList, GetEvaluationsDTO.class);
     }
 
@@ -444,10 +443,10 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
      * @return
      */
     public List<GetEvaluationScalesDTO> getEvaluationScales(GetEvaluationScalesVO getEvaluationScalesVO) {
-    	QueryWrapper<InquiryScale> queryWrapper = new QueryWrapper<InquiryScale>();
-    	queryWrapper.eq("inquiry_id", getEvaluationScalesVO.getInquiryId());
-    	queryWrapper.eq("inquiry_evaluation_id", getEvaluationScalesVO.getInquiryEvaluationId());
-    	List<InquiryScale> inquiryScaleList =inquiryScaleFacade.list(queryWrapper);
+        QueryWrapper<InquiryScale> queryWrapper = new QueryWrapper<InquiryScale>();
+        queryWrapper.eq("inquiry_id", getEvaluationScalesVO.getInquiryId());
+        queryWrapper.eq("inquiry_evaluation_id", getEvaluationScalesVO.getInquiryEvaluationId());
+        List<InquiryScale> inquiryScaleList = inquiryScaleFacade.list(queryWrapper);
         return BeanUtil.listCopyTo(inquiryScaleList, GetEvaluationScalesDTO.class);
     }
 

+ 7 - 8
icss-service/src/main/java/com/diagbot/facade/InquiryScaleFacade.java

@@ -1,13 +1,12 @@
 package com.diagbot.facade;
 
-import java.util.List;
-
-import org.springframework.stereotype.Component;
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.entity.InquiryScale;
 import com.diagbot.service.impl.InquiryScaleServiceImpl;
 import com.diagbot.util.ListUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
 
 /**
  * @author rengb
@@ -16,8 +15,8 @@ import com.diagbot.util.ListUtil;
  */
 @Component
 public class InquiryScaleFacade extends InquiryScaleServiceImpl {
-	
-	/**
+
+    /**
      * 根据问诊记录id删除问诊记录评估结果量表明细
      *
      * @param inquiryId
@@ -27,7 +26,7 @@ public class InquiryScaleFacade extends InquiryScaleServiceImpl {
         queryWrapper.eq("inquiry_id", inquiryId);
         this.remove(queryWrapper);
     }
-    
+
     /**
      * 批量保存问诊记录评估结果量表明细
      *
@@ -35,7 +34,7 @@ public class InquiryScaleFacade extends InquiryScaleServiceImpl {
      */
     public void saveInquiryScales(List<InquiryScale> inquiryScaleList) {
         if (ListUtil.isNotEmpty(inquiryScaleList)) {
-           super.saveBatch(inquiryScaleList);
+            super.saveBatch(inquiryScaleList);
         }
     }
 

+ 215 - 217
icss-service/src/main/java/com/diagbot/facade/LisExcelResFacade.java

@@ -1,15 +1,15 @@
 package com.diagbot.facade;
 
-import java.io.InputStream;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletRequest;
-
+import com.diagbot.client.TranServiceClient;
+import com.diagbot.dto.LisConfigDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.LisExcelResVO;
+import com.diagbot.vo.LisExcelWrapperVO;
+import com.diagbot.vo.LisHospitalCodeVO;
+import com.diagbot.vo.LitAssayVO;
 import org.apache.commons.lang.time.DateFormatUtils;
 import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -22,16 +22,14 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.web.multipart.MultipartFile;
 
-import com.diagbot.client.TranServiceClient;
-import com.diagbot.dto.LisConfigDTO;
-import com.diagbot.dto.RespDTO;
-import com.diagbot.exception.CommonErrorCode;
-import com.diagbot.exception.CommonException;
-import com.diagbot.util.StringUtil;
-import com.diagbot.vo.LisExcelResVO;
-import com.diagbot.vo.LisExcelWrapperVO;
-import com.diagbot.vo.LisHospitalCodeVO;
-import com.diagbot.vo.LitAssayVO;
+import javax.servlet.http.HttpServletRequest;
+import java.io.InputStream;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author wangfeng
@@ -41,202 +39,202 @@ import com.diagbot.vo.LitAssayVO;
 @Component
 public class LisExcelResFacade {
 
-	/*@Autowired
-	LisConfigFacade lisConfigFacade;*/
-	@Autowired
-	TranServiceClient tranServiceClient;
-
-	public RespDTO<LitAssayVO> lisExcelAnalysis(MultipartFile file, LisHospitalCodeVO lisHospitalCodeVO, HttpServletRequest request) {
-
-		List<String> messages = new ArrayList<>();
-		List<LisExcelWrapperVO> lisExcelWrapperList = new ArrayList<>();
-		InputStream inputStream = null;
-		Workbook wb = null;
-		try {
-			if (!file.isEmpty()) {
-				inputStream = file.getInputStream();
-				if (inputStream.available() > 512000) {
-					messages.add("化验文件最大支持500KB!");
-				} else {
-					String fileName = file.getOriginalFilename();
-					if (fileName.lastIndexOf(".") != -1) {
-						String type = fileName.substring(fileName.lastIndexOf("."));
-						if (type.equals(".xls")) {
-							wb = new HSSFWorkbook(inputStream);
-						} else if (type.equals(".xlsx")) {
-							wb = new XSSFWorkbook(inputStream);
-						}
-						if (wb != null) {
-							Sheet sheet = wb.getSheetAt(0);
-							int count = 0;
-							String mealName, itemName, unit, value, max, min, time;
-							for (Row row : sheet) {
-								count++;
-								try {
-									if (row != null) {
-										mealName = getValue(row.getCell(0)).trim().replace(" ", "");
-										itemName = getValue(row.getCell(1)).trim().replace(" ", "");
-										unit = getValue(row.getCell(2)).trim();
-										value = getValue(row.getCell(3)).trim();
-										min = getValue(row.getCell(4)).trim();
-										max = getValue(row.getCell(5)).trim();
-										time = getValue(row.getCell(6)).trim();
-										type = getValue(row.getCell(7)).trim();
-									} else {
-										mealName = null;
-										itemName = null;
-										unit = null;
-										value = null;
-										min = null;
-										max = null;
-										time = null;
-										type = null;
-									}
-
-									if (StringUtil.isEmpty(mealName) && StringUtil.isEmpty(itemName)
-											&& StringUtil.isEmpty(value) && StringUtil.isEmpty(type)) {
-										continue;
-									}
-
-									if (count == 1 && mealName.equals("套餐名")) {
-										continue;
-									}
-
-									if (StringUtil.isEmpty(mealName) || StringUtil.isEmpty(itemName)
-											|| StringUtil.isEmpty(value) || StringUtil.isEmpty(type)) {
-										messages.add("第" + count + "行数据不规范,套餐名、项目名、结果、是否异常四项必填;");
-										continue;
-									}
-									LisExcelWrapperVO lisExcelWrapper = new LisExcelWrapperVO();
-
-									lisExcelWrapper.setMealName(mealName);
-									lisExcelWrapper.setItemName(itemName);
-									//  lisExcelWrapper.setUniqueName(uniqueName);
-									lisExcelWrapper.setUnit(unit);
-									lisExcelWrapper.setValue(value);
-									lisExcelWrapper.setMax(max);
-									lisExcelWrapper.setMin(min);
-									lisExcelWrapper.setTime(time);
-									lisExcelWrapper.setType(type);
-									lisExcelWrapperList.add(lisExcelWrapper);
-								} catch (Exception e) {
-									e.printStackTrace();
-									throw new CommonException(CommonErrorCode.NOT_EXISTS, e.toString());
-									// logger.error("",e);
-								}
-							}
-						} else {
-							// throw new
-							// CommonException(CommonErrorCode.NOT_EXISTS,
-							// "非excel文件无法解析!");
-							messages.add("非excel文件无法解析!");
-						}
-					} else {
-						// throw new CommonException(CommonErrorCode.NOT_EXISTS,
-						// "未知文件无法解析!");
-						messages.add("未知文件无法解析!");
-					}
-				}
-			} else {
-				// throw new CommonException(CommonErrorCode.NOT_EXISTS,
-				// "无文件上传!");
-				messages.add("无文件上传!");
-			}
-			//匹配公表名
-			RespDTO<List<LisConfigDTO>> litDatas = tranServiceClient.getLisConfigByhospitalId(lisHospitalCodeVO);
-			 if (litDatas == null || !"0".equals(litDatas.code)) {
-	                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
-	                        "获取匹配公表名信息失败");
-	            }
-	        List<LisConfigDTO> litData = litDatas.data;
-	        //导入的数据跟公表数据进行配对
-			if(litData.size()>0){
-				List<LisExcelWrapperVO> lisExcelWrapperListNew = new ArrayList<>();
-				for (LisExcelWrapperVO lisExcelWrapperNew : lisExcelWrapperList) {
-					
-					for (LisConfigDTO LisNew : litData) {
-						if (LisNew.getItemName() != null) {
-							if (LisNew.getMealName().equals(lisExcelWrapperNew.getMealName())
-									&& LisNew.getItemName().equals(lisExcelWrapperNew.getItemName())) {
-								lisExcelWrapperNew.setUniqueName(LisNew.getUniqueName());
-							}
-						} else {
-							if (LisNew.getMealName().equals(lisExcelWrapperNew.getMealName())) {
-								lisExcelWrapperNew.setUniquemealName(LisNew.getUniqueName());
-							}
-						}
-
-					}
-					lisExcelWrapperListNew.add(lisExcelWrapperNew);
-				}
-				lisExcelWrapperList = lisExcelWrapperListNew;
-			}
-			
-			
-			Map<String, List<LisExcelWrapperVO>> lixExMap = lisExcelWrapperList.stream()
-					.collect(Collectors.groupingBy(LisExcelWrapperVO::getMealName));
-			List<LisExcelResVO> LisExcelReslist = new ArrayList<LisExcelResVO>();
-			for (String str : lixExMap.keySet()) {
-				LisExcelResVO lisExcelResVO = new LisExcelResVO();
-				lisExcelResVO.setMenus(str);
-				lisExcelResVO.setLisExcelItem(lixExMap.get(str));
-				
-				LisExcelReslist.add(lisExcelResVO);
-			}
-
-			LitAssayVO litAssay = new LitAssayVO();
-			litAssay.setMessages(messages);
-			litAssay.setLisExcelRes(LisExcelReslist);
-			return RespDTO.onSuc(litAssay);
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw new CommonException(CommonErrorCode.NOT_EXISTS, "化验excel文件解析出错!");
-			// return response.failure("化验excel文件解析出错!");
-		} finally {
-			try {
-				if (inputStream != null) {
-					inputStream.close();
-				}
-				if (wb != null) {
-					wb.close();
-				}
-			} catch (Exception e) {
-			}
-		}
-	}
-
-	private String getValue(Cell cell) {
-		try {
-			Object obj = null;
-			switch (cell.getCellTypeEnum()) {
-			case BOOLEAN:
-				obj = cell.getBooleanCellValue();
-				break;
-			case ERROR:
-				obj = cell.getErrorCellValue();
-				break;
-			case NUMERIC:
-				if (HSSFDateUtil.isCellDateFormatted(cell)) {
-					Date date = cell.getDateCellValue();
-					obj = DateFormatUtils.format(date, "yyyy-MM-dd");
-				} else {
-					obj = cell.getNumericCellValue();
-					DecimalFormat df = new DecimalFormat();
-					obj = df.format(obj);
-				}
-
-				// obj = cell.getNumericCellValue();
-				break;
-			case STRING:
-				obj = cell.getStringCellValue();
-				break;
-			default:
-				break;
-			}
-			return obj.toString();
-		} catch (Exception e) {
-			return "";
-		}
-	}
+    /*@Autowired
+    LisConfigFacade lisConfigFacade;*/
+    @Autowired
+    TranServiceClient tranServiceClient;
+
+    public RespDTO<LitAssayVO> lisExcelAnalysis(MultipartFile file, LisHospitalCodeVO lisHospitalCodeVO, HttpServletRequest request) {
+
+        List<String> messages = new ArrayList<>();
+        List<LisExcelWrapperVO> lisExcelWrapperList = new ArrayList<>();
+        InputStream inputStream = null;
+        Workbook wb = null;
+        try {
+            if (!file.isEmpty()) {
+                inputStream = file.getInputStream();
+                if (inputStream.available() > 512000) {
+                    messages.add("化验文件最大支持500KB!");
+                } else {
+                    String fileName = file.getOriginalFilename();
+                    if (fileName.lastIndexOf(".") != -1) {
+                        String type = fileName.substring(fileName.lastIndexOf("."));
+                        if (type.equals(".xls")) {
+                            wb = new HSSFWorkbook(inputStream);
+                        } else if (type.equals(".xlsx")) {
+                            wb = new XSSFWorkbook(inputStream);
+                        }
+                        if (wb != null) {
+                            Sheet sheet = wb.getSheetAt(0);
+                            int count = 0;
+                            String mealName, itemName, unit, value, max, min, time;
+                            for (Row row : sheet) {
+                                count++;
+                                try {
+                                    if (row != null) {
+                                        mealName = getValue(row.getCell(0)).trim().replace(" ", "");
+                                        itemName = getValue(row.getCell(1)).trim().replace(" ", "");
+                                        unit = getValue(row.getCell(2)).trim();
+                                        value = getValue(row.getCell(3)).trim();
+                                        min = getValue(row.getCell(4)).trim();
+                                        max = getValue(row.getCell(5)).trim();
+                                        time = getValue(row.getCell(6)).trim();
+                                        type = getValue(row.getCell(7)).trim();
+                                    } else {
+                                        mealName = null;
+                                        itemName = null;
+                                        unit = null;
+                                        value = null;
+                                        min = null;
+                                        max = null;
+                                        time = null;
+                                        type = null;
+                                    }
+
+                                    if (StringUtil.isEmpty(mealName) && StringUtil.isEmpty(itemName)
+                                            && StringUtil.isEmpty(value) && StringUtil.isEmpty(type)) {
+                                        continue;
+                                    }
+
+                                    if (count == 1 && mealName.equals("套餐名")) {
+                                        continue;
+                                    }
+
+                                    if (StringUtil.isEmpty(mealName) || StringUtil.isEmpty(itemName)
+                                            || StringUtil.isEmpty(value) || StringUtil.isEmpty(type)) {
+                                        messages.add("第" + count + "行数据不规范,套餐名、项目名、结果、是否异常四项必填;");
+                                        continue;
+                                    }
+                                    LisExcelWrapperVO lisExcelWrapper = new LisExcelWrapperVO();
+
+                                    lisExcelWrapper.setMealName(mealName);
+                                    lisExcelWrapper.setItemName(itemName);
+                                    //  lisExcelWrapper.setUniqueName(uniqueName);
+                                    lisExcelWrapper.setUnit(unit);
+                                    lisExcelWrapper.setValue(value);
+                                    lisExcelWrapper.setMax(max);
+                                    lisExcelWrapper.setMin(min);
+                                    lisExcelWrapper.setTime(time);
+                                    lisExcelWrapper.setType(type);
+                                    lisExcelWrapperList.add(lisExcelWrapper);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                    throw new CommonException(CommonErrorCode.NOT_EXISTS, e.toString());
+                                    // logger.error("",e);
+                                }
+                            }
+                        } else {
+                            // throw new
+                            // CommonException(CommonErrorCode.NOT_EXISTS,
+                            // "非excel文件无法解析!");
+                            messages.add("非excel文件无法解析!");
+                        }
+                    } else {
+                        // throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                        // "未知文件无法解析!");
+                        messages.add("未知文件无法解析!");
+                    }
+                }
+            } else {
+                // throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                // "无文件上传!");
+                messages.add("无文件上传!");
+            }
+            //匹配公表名
+            RespDTO<List<LisConfigDTO>> litDatas = tranServiceClient.getLisConfigByhospitalId(lisHospitalCodeVO);
+            if (litDatas == null || !"0".equals(litDatas.code)) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        "获取匹配公表名信息失败");
+            }
+            List<LisConfigDTO> litData = litDatas.data;
+            //导入的数据跟公表数据进行配对
+            if (litData.size() > 0) {
+                List<LisExcelWrapperVO> lisExcelWrapperListNew = new ArrayList<>();
+                for (LisExcelWrapperVO lisExcelWrapperNew : lisExcelWrapperList) {
+
+                    for (LisConfigDTO LisNew : litData) {
+                        if (LisNew.getItemName() != null) {
+                            if (LisNew.getMealName().equals(lisExcelWrapperNew.getMealName())
+                                    && LisNew.getItemName().equals(lisExcelWrapperNew.getItemName())) {
+                                lisExcelWrapperNew.setUniqueName(LisNew.getUniqueName());
+                            }
+                        } else {
+                            if (LisNew.getMealName().equals(lisExcelWrapperNew.getMealName())) {
+                                lisExcelWrapperNew.setUniquemealName(LisNew.getUniqueName());
+                            }
+                        }
+
+                    }
+                    lisExcelWrapperListNew.add(lisExcelWrapperNew);
+                }
+                lisExcelWrapperList = lisExcelWrapperListNew;
+            }
+
+
+            Map<String, List<LisExcelWrapperVO>> lixExMap = lisExcelWrapperList.stream()
+                    .collect(Collectors.groupingBy(LisExcelWrapperVO::getMealName));
+            List<LisExcelResVO> LisExcelReslist = new ArrayList<LisExcelResVO>();
+            for (String str : lixExMap.keySet()) {
+                LisExcelResVO lisExcelResVO = new LisExcelResVO();
+                lisExcelResVO.setMenus(str);
+                lisExcelResVO.setLisExcelItem(lixExMap.get(str));
+
+                LisExcelReslist.add(lisExcelResVO);
+            }
+
+            LitAssayVO litAssay = new LitAssayVO();
+            litAssay.setMessages(messages);
+            litAssay.setLisExcelRes(LisExcelReslist);
+            return RespDTO.onSuc(litAssay);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "化验excel文件解析出错!");
+            // return response.failure("化验excel文件解析出错!");
+        } finally {
+            try {
+                if (inputStream != null) {
+                    inputStream.close();
+                }
+                if (wb != null) {
+                    wb.close();
+                }
+            } catch (Exception e) {
+            }
+        }
+    }
+
+    private String getValue(Cell cell) {
+        try {
+            Object obj = null;
+            switch (cell.getCellTypeEnum()) {
+                case BOOLEAN:
+                    obj = cell.getBooleanCellValue();
+                    break;
+                case ERROR:
+                    obj = cell.getErrorCellValue();
+                    break;
+                case NUMERIC:
+                    if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                        Date date = cell.getDateCellValue();
+                        obj = DateFormatUtils.format(date, "yyyy-MM-dd");
+                    } else {
+                        obj = cell.getNumericCellValue();
+                        DecimalFormat df = new DecimalFormat();
+                        obj = df.format(obj);
+                    }
+
+                    // obj = cell.getNumericCellValue();
+                    break;
+                case STRING:
+                    obj = cell.getStringCellValue();
+                    break;
+                default:
+                    break;
+            }
+            return obj.toString();
+        } catch (Exception e) {
+            return "";
+        }
+    }
 
 }

+ 17 - 17
icss-service/src/main/java/com/diagbot/facade/LisMappingFacade.java

@@ -29,7 +29,7 @@ public class LisMappingFacade extends LisMappingServiceImpl {
     public Map<String, Map<String, String>> getLisMapping_NotEmptyItemName() {
         Map<String, Map<String, String>> retMap = new LinkedHashMap<>();
         QueryWrapper<LisMapping> lisMappingQueryWrapper = new QueryWrapper<>();
-        lisMappingQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).isNotNull("item_name").ne("item_name","");
+        lisMappingQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).isNotNull("item_name").ne("item_name", "");
         List<LisMapping> lisMappingList = this.list(lisMappingQueryWrapper);
         Map<String, List<LisMapping>> lisMappingMap = EntityUtil.makeEntityListMap(lisMappingList, "mealName");
         for (Map.Entry<String, List<LisMapping>> entry : lisMappingMap.entrySet()) {
@@ -58,9 +58,10 @@ public class LisMappingFacade extends LisMappingServiceImpl {
 
     /**
      * 获取化验公表映射关系 Map<mealName,uniqueName> itemName 为空
+     *
      * @return
      */
-    public Map<String,String> getLisMappingWithoutItemName() {
+    public Map<String, String> getLisMappingWithoutItemName() {
         QueryWrapper<LisMapping> lisMappingQueryWrapper = new QueryWrapper<>();
         lisMappingQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).isNull("item_name").or(i -> i.eq("item_name", ""));
         List<LisMapping> lisMappingList = this.list(lisMappingQueryWrapper);
@@ -87,33 +88,32 @@ public class LisMappingFacade extends LisMappingServiceImpl {
 
 
     /**
-     *
      * @param project 化验大项
      * @param details 化验小项
      * @return
      */
-    public Map<String,Map<String,String>> getLisMappingByQuestion(String project,List<String> details){
-        Map<String,Map<String,String>> lisWithItemNamMap=getLisMapping_NotEmptyItemName();
-        Map<String,String> lisWithoutItemNameMap=getLisMappingWithoutItemName();
+    public Map<String, Map<String, String>> getLisMappingByQuestion(String project, List<String> details) {
+        Map<String, Map<String, String>> lisWithItemNamMap = getLisMapping_NotEmptyItemName();
+        Map<String, String> lisWithoutItemNameMap = getLisMappingWithoutItemName();
 
-        if(StringUtil.isBlank(project)){
+        if (StringUtil.isBlank(project)) {
             return null;
         }
 
-        Map<String,Map<String,String>> retMap=new LinkedHashMap<>();
-        Map<String,String> projectMap=new LinkedHashMap<>();
-        projectMap.put(project,lisWithoutItemNameMap.get(project));
-        retMap.put("project",projectMap);
+        Map<String, Map<String, String>> retMap = new LinkedHashMap<>();
+        Map<String, String> projectMap = new LinkedHashMap<>();
+        projectMap.put(project, lisWithoutItemNameMap.get(project));
+        retMap.put("project", projectMap);
 
-        if(ListUtil.isEmpty(details)){
-            return  retMap;
+        if (ListUtil.isEmpty(details)) {
+            return retMap;
         }
 
-        Map<String,String> detailMap=new LinkedHashMap<>();
-        for(String detail:details){
-            detailMap.put(detail,lisWithItemNamMap.get(project).get(detail));
+        Map<String, String> detailMap = new LinkedHashMap<>();
+        for (String detail : details) {
+            detailMap.put(detail, lisWithItemNamMap.get(project).get(detail));
         }
-        retMap.put("details",detailMap);
+        retMap.put("details", detailMap);
         return retMap;
     }
 }

+ 15 - 15
icss-service/src/main/java/com/diagbot/facade/ModuleFacade.java

@@ -47,41 +47,41 @@ public class ModuleFacade extends ModuleInfoServiceImpl {
         List<ModuleInfo> list = new ArrayList<>();
         List<Long> ids = new ArrayList<>();
         Boolean isDefault = false;
-        if(moduleVO.getMouduleType().intValue() == 1){
+        if (moduleVO.getMouduleType().intValue() == 1) {
             //根据科室筛选如果没有,返回通用模板
-            list = getModuleInfoByDisType(moduleVO.getMouduleType(),moduleVO.getRelationId());
-            if(ListUtil.isNotEmpty(list)){
+            list = getModuleInfoByDisType(moduleVO.getMouduleType(), moduleVO.getRelationId());
+            if (ListUtil.isNotEmpty(list)) {
                 ids = list.stream()
                         .map(moduleInfo -> moduleInfo.getId())
                         .collect(Collectors.toList());
-            }else {
+            } else {
                 isDefault = true;
             }
-        }else if(moduleVO.getMouduleType().intValue() == 2){
+        } else if (moduleVO.getMouduleType().intValue() == 2) {
             //根据慢病筛选如果没有返回通用模板
-            list = getModuleInfoByDisType(moduleVO.getMouduleType(),moduleVO.getRelationId());
-            if(ListUtil.isNotEmpty(list)){
+            list = getModuleInfoByDisType(moduleVO.getMouduleType(), moduleVO.getRelationId());
+            if (ListUtil.isNotEmpty(list)) {
                 ids = list.stream()
                         .map(moduleDeptMapping -> moduleDeptMapping.getId())
                         .collect(Collectors.toList());
-            }else {
+            } else {
                 isDefault = true;
             }
-        }else {
+        } else {
             isDefault = true;
         }
 
         //科室和慢病没有内容,或者默认情况下,需要推测出默认模板
-        if (isDefault){
+        if (isDefault) {
             //默认
-            list = getModuleInfoByDisType(0,0L);
+            list = getModuleInfoByDisType(0, 0L);
             ids = list.stream()
                     .map(moduleInfo -> moduleInfo.getId())
                     .collect(Collectors.toList());
         }
         data = BeanUtil.listCopyTo(list, ModuleInfoDTO.class);
-        Map<Long,ModuleInfo> moduleInfoMap
-                = list.stream().collect(Collectors.toMap(ModuleInfo::getId,moduleInfo -> moduleInfo));
+        Map<Long, ModuleInfo> moduleInfoMap
+                = list.stream().collect(Collectors.toMap(ModuleInfo::getId, moduleInfo -> moduleInfo));
         Map<Long, List<ModuleDetail>> moduleDetailMap = new LinkedHashMap<>();
         //取到所有模板明细
         if (ListUtil.isNotEmpty(ids)) {
@@ -108,7 +108,7 @@ public class ModuleFacade extends ModuleInfoServiceImpl {
                         QuestionDTO questionDTO = questionFacade.getById(questionVO);
                         BeanUtil.copyProperties(questionDTO, detailDTO);
                     }
-                    if(null != detailDTO.getRelationModule()){
+                    if (null != detailDTO.getRelationModule()) {
                         detailDTO.setRelationModuleName(moduleInfoMap.get(detailDTO.getRelationModule()).getName());
                     }
                 }
@@ -124,7 +124,7 @@ public class ModuleFacade extends ModuleInfoServiceImpl {
      * @param moduleType
      * @return
      */
-    public List<ModuleInfo> getModuleInfoByDisType(Integer moduleType,Long relationId){
+    public List<ModuleInfo> getModuleInfoByDisType(Integer moduleType, Long relationId) {
         QueryWrapper<ModuleInfo> queryWrapper = new QueryWrapper();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("module_type", moduleType)

+ 15 - 15
icss-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -1,12 +1,5 @@
 package com.diagbot.facade;
 
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.RequestBody;
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.TranServiceClient;
 import com.diagbot.dto.GetTopPatientInfoDTO;
@@ -20,6 +13,12 @@ import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import com.diagbot.vo.PatientInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 患者业务逻辑
@@ -86,20 +85,21 @@ public class PatientInfoFacade {
         }
         return getTopPatientInfoDTO;
     }
-    
+
     /**
      * 根据ids获取病人信息
+     *
      * @param ids 病人ids
      * @return 病人信息
      */
     public Map<Long, PatientInfo> patientInfoMapByIds(List<Long> ids) {
-    	 RespDTO<Map<Long, PatientInfo>> retData = tranServiceClient.patientInfoMapByIds(ids);
-         if (retData == null
-                 || !CommonErrorCode.OK.getCode().equals(retData.code)) {
-             throw new CommonException(CommonErrorCode.RPC_ERROR,
-                     "获取患者信息失败");
-         }
-         return retData.data;
+        RespDTO<Map<Long, PatientInfo>> retData = tranServiceClient.patientInfoMapByIds(ids);
+        if (retData == null
+                || !CommonErrorCode.OK.getCode().equals(retData.code)) {
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    "获取患者信息失败");
+        }
+        return retData.data;
     }
 
 }

+ 4 - 1
icss-service/src/main/java/com/diagbot/facade/TemplateInfoFacade.java

@@ -8,9 +8,11 @@ import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.TemplateInfoServiceImpl;
+import com.diagbot.util.ArrayUtil;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.GsonUtil;
+import com.diagbot.util.ListUtil;
 import com.diagbot.vo.TemplateInfoRevampVO;
 import com.diagbot.vo.TemplateInfoVO;
 import com.diagbot.vo.TemplateInfosIdVO;
@@ -21,6 +23,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author wangfeng
@@ -157,7 +160,7 @@ public class TemplateInfoFacade extends TemplateInfoServiceImpl {
         String[] splitIds = substring.split(",");
         //把分割的id数据传入对象中,在表中批量删除
         UpdateWrapper<TemplateInfo> templateInfoNew = new UpdateWrapper<>();
-        templateInfoNew.in("id", splitIds)
+        templateInfoNew.in("id", ListUtil.arrayToList(splitIds))
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .set("is_deleted", IsDeleteEnum.Y.getKey())
                 //.set("modifier",UserUtils.getCurrentPrincipleID())