|
@@ -1,7 +1,35 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.diagbot.entity.AnesthesiaConfig;
|
|
|
+import com.diagbot.entity.DeptConfig;
|
|
|
+import com.diagbot.entity.DiseaseConfig;
|
|
|
+import com.diagbot.entity.DrugConfig;
|
|
|
+import com.diagbot.entity.LisConfig;
|
|
|
+import com.diagbot.entity.MappingConfig;
|
|
|
+import com.diagbot.entity.NurseConfig;
|
|
|
+import com.diagbot.entity.OperationConfig;
|
|
|
+import com.diagbot.entity.PacsConfig;
|
|
|
+import com.diagbot.entity.ScaleConfig;
|
|
|
+import com.diagbot.entity.TcmdiseaseConfig;
|
|
|
+import com.diagbot.entity.TcmsyndromeConfig;
|
|
|
+import com.diagbot.entity.TransfusionConfig;
|
|
|
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.MappingConfigServiceImpl;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.ExcelUtils;
|
|
|
+import com.diagbot.util.SysUserUtils;
|
|
|
+import com.diagbot.vo.MappingConfigPageVO;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @Description:
|
|
@@ -11,4 +39,198 @@ import org.springframework.stereotype.Component;
|
|
|
@Component
|
|
|
public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * 分页查询
|
|
|
+ *
|
|
|
+ * @param mappingConfigPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public IPage<MappingConfig> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO) {
|
|
|
+ if (mappingConfigPageVO.getHospitalId() == null) {
|
|
|
+ mappingConfigPageVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
|
|
|
+ }
|
|
|
+
|
|
|
+ //todo 标准词转conceptId
|
|
|
+
|
|
|
+ //todo 药品剂型转 conceptId
|
|
|
+
|
|
|
+ //todo 多条匹配
|
|
|
+ if (mappingConfigPageVO.getIsMatch() != null && mappingConfigPageVO.getIsMatch().equals(2)) {
|
|
|
+ mappingConfigPageVO.setIsMatch(null);
|
|
|
+ mappingConfigPageVO.setIsMultiple(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage<MappingConfig> page = super.getPage(mappingConfigPageVO);
|
|
|
+
|
|
|
+ //todo conceptId转标准词
|
|
|
+
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导入模板下载
|
|
|
+ *
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ public void exportExcelModule(HttpServletResponse response, Integer type) {
|
|
|
+ if (type == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "请输入数据类型:1-化验、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉");
|
|
|
+ }
|
|
|
+ exportExcel(response, new ArrayList<>(), type, "导入模板");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出文件
|
|
|
+ *
|
|
|
+ * @param response
|
|
|
+ * @param type
|
|
|
+ * @param extFileName
|
|
|
+ */
|
|
|
+ public void exportExcel(HttpServletResponse response, List<?> list, Integer type, String extFileName) {
|
|
|
+ String fileName = extFileName + ".xls";
|
|
|
+ switch (type) {
|
|
|
+ case 1:
|
|
|
+ fileName = "检验" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", LisConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ fileName = "检查" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ fileName = "诊断" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", DiseaseConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ fileName = "药品" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", DrugConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ fileName = "手术和操作" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", OperationConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ fileName = "科室" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ fileName = "输血" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 10:
|
|
|
+ fileName = "量表" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", ScaleConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 11:
|
|
|
+ fileName = "护理" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", NurseConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 12:
|
|
|
+ fileName = "中医疾病" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", TcmdiseaseConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 13:
|
|
|
+ fileName = "中医证候" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", TcmsyndromeConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ case 14:
|
|
|
+ fileName = "麻醉" + fileName;
|
|
|
+ ExcelUtils.exportExcel(list, null, "sheet1", AnesthesiaConfig.class, fileName, response, 12.8f);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导入数据预匹配
|
|
|
+ *
|
|
|
+ * @param file
|
|
|
+ * @param type
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ public void precDataMatch(MultipartFile file, Integer type, HttpServletResponse response) {
|
|
|
+ List<MappingConfigWrapper> originList = readImportData(file, type);
|
|
|
+ List<MappingConfigWrapper> retList = dataProcess(originList);
|
|
|
+ exportExcel(response, retList, type, "关联数据(预匹配)");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 读取导入数据
|
|
|
+ *
|
|
|
+ * @param file
|
|
|
+ * @param type
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<MappingConfigWrapper> readImportData(MultipartFile file, Integer type) {
|
|
|
+ List<MappingConfigWrapper> originList = Lists.newLinkedList();
|
|
|
+ switch (type) {
|
|
|
+ case 1:
|
|
|
+ List<LisConfig> lisConfigList = ExcelUtils.importExcel(file, 0, 1, LisConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(lisConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ List<PacsConfig> pacsConfigList = ExcelUtils.importExcel(file, 0, 1, PacsConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(pacsConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ List<DiseaseConfig> diseaseConfigList = ExcelUtils.importExcel(file, 0, 1, DiseaseConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(diseaseConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ List<DrugConfig> drugConfigList = ExcelUtils.importExcel(file, 0, 1, DrugConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(drugConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ List<OperationConfig> operationConfigList = ExcelUtils.importExcel(file, 0, 1, OperationConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(operationConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ List<DeptConfig> deptConfigList = ExcelUtils.importExcel(file, 0, 1, DeptConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(deptConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ List<TransfusionConfig> transfusionConfigList = ExcelUtils.importExcel(file, 0, 1, TransfusionConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(transfusionConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 10:
|
|
|
+ List<ScaleConfig> scaleConfigList = ExcelUtils.importExcel(file, 0, 1, ScaleConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(scaleConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 11:
|
|
|
+ List<NurseConfig> nurseConfigList = ExcelUtils.importExcel(file, 0, 1, NurseConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(nurseConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 12:
|
|
|
+ List<TcmdiseaseConfig> tcmdiseaseConfigList = ExcelUtils.importExcel(file, 0, 1, TcmdiseaseConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(tcmdiseaseConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 13:
|
|
|
+ List<TcmsyndromeConfig> tcmsyndromeConfigList = ExcelUtils.importExcel(file, 0, 1, TcmsyndromeConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(tcmsyndromeConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ case 14:
|
|
|
+ List<AnesthesiaConfig> anesthesiaConfigList = ExcelUtils.importExcel(file, 0, 1, AnesthesiaConfig.class);
|
|
|
+ originList = BeanUtil.listCopyTo(anesthesiaConfigList, MappingConfigWrapper.class);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return originList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 数据处理
|
|
|
+ *
|
|
|
+ * @param originList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<MappingConfigWrapper> dataProcess(List<MappingConfigWrapper> originList) {
|
|
|
+ List<MappingConfigWrapper> retList = Lists.newLinkedList();
|
|
|
+
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|