diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SieveController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SieveController.java index b851160..654cd6a 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SieveController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SieveController.java @@ -25,6 +25,7 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -368,4 +369,21 @@ public class SieveController extends BaseController { LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); sieveFacade.exportSerologySieve(cqSieveQueryRequest, loginState.getId(), response); } + + /** + * 产筛导入3.0版 血清学筛查 + * sieveType=1 + * @param request + * @param response + */ + @RequestMapping(value = "/importSerologySieve") + @ResponseBody + @TokenRequired + public void importSerologySieve(@RequestParam MultipartFile file, HttpServletRequest request, HttpServletResponse response) { + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); + sieveFacade.importSerologySieve(file, loginState.getId(), response); + } + + + } \ No newline at end of file diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveFacade.java index 779f2f3..efd46ad 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveFacade.java @@ -28,8 +28,13 @@ import com.lyms.platform.permission.service.OrganizationService; import com.lyms.platform.permission.service.UsersService; import com.lyms.platform.pojo.*; import com.lyms.platform.query.*; +import jxl.Cell; +import jxl.Sheet; +import jxl.Workbook; +import jxl.read.biff.BiffException; import net.sf.json.JSONObject; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.fileupload.disk.DiskFileItem; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -37,8 +42,12 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; import java.io.OutputStream; import java.util.*; import java.util.concurrent.Callable; @@ -2529,23 +2538,12 @@ public class SieveFacade { if (CollectionUtils.isNotEmpty(list)) { for (SieveListResult2 sive : list) { Map data = new HashMap<>(); - /* data.put("versionNo", sive.getNumber()); - data.put("exportTime", sive.getExportTime()); - data.put("highRisk", sive.getZtfxText()); - data.put("age", sive.getAge()); - data.put("collectBloodWeek", sive.getCollectionWeek()); - data.put("placeDomicile", sive.getPlaceDomicile());//com.lyms.platform.common.utils.StringUtils.encryPhone(sive.getRealPhone()) - data.put("residence", sive.getResidence()); - data.put("dueDate", sive.getDueDate()); - data.put("bScanInfo", sive.getbScanInfo()); - data.put("foundHospital", sive.getFoundHospital());*/ data.put("SampleID", sive.getNumber());//样本号(标本号) data.put("PatientID", sive.getPatientID());//孕妇编号 data.put("LastName", sive.getName());//姓名 - data.put("ApplicationNo", sive.getPatientID());//申请单号 + data.put("FirstName", "");//姓名2 +// data.put("ApplicationNo", sive.getPatientID());//申请单号 data.put("BirthDate", sive.getBirthday());//生日 - data.put("Ethnicity", sive.getEthnicity());//种族(名族) - data.put("IdCard", sive.getCardNo());//身份证号 data.put("Address", sive.getPlaceDomicile());//地址 data.put("Phone", sive.getPhone());//电话 data.put("NoOfFetuses", sive.getNoOfFetuses());//胎儿数(胎数) @@ -2570,8 +2568,10 @@ public class SieveFacade { data.put("TransferDate", sive.getTransferDate());//辅助生殖之移植日期 data.put("DonorBirthDate", sive.getDonorBirthDate());//辅助生殖之捐赠者生日 data.put("NasalBone", sive.getNasalBone());//鼻骨 - data.put("Monozygous", sive.getMonozygous());//单卵 data.put("PatientType", sive.getPatientType());//孕妇筛查类型PatientType + /* data.put("Ethnicity", sive.getEthnicity());//种族(名族) + data.put("IdCard", sive.getCardNo());//身份证号 + data.put("Monozygous", sive.getMonozygous());//单卵*/ datas.add(data); } } @@ -2591,10 +2591,9 @@ public class SieveFacade { cnames.put("SampleID", "SampleID");//样本号 cnames.put("PatientID", "PatientID");//孕妇编号 cnames.put("LastName", "LastName");//姓名 - cnames.put("ApplicationNo", "ApplicationNo");//申请单号 + cnames.put("FirstName", "");//姓名2 +// cnames.put("ApplicationNo", "ApplicationNo");//申请单号 cnames.put("BirthDate", "BirthDate");//生日 - cnames.put("Ethnicity", "Ethnicity");//种族 - cnames.put("IdCard", "IdCard");//身份证号 cnames.put("Address", "Address");//地址 cnames.put("Phone", "Phone");//电话 cnames.put("NoOfFetuses", "NoOfFetuses");//胎儿数 @@ -2619,8 +2618,112 @@ public class SieveFacade { cnames.put("TransferDate", "TransferDate");//辅助生殖之移植日期 cnames.put("DonorBirthDate", "DonorBirthDate");//辅助生殖之捐赠者生日 cnames.put("NasalBone", "NasalBone");//鼻骨 - cnames.put("Monozygous", "Monozygous");//单卵 cnames.put("PatientType", "PatientType");//孕妇筛查类型 + /* cnames.put("Ethnicity", "Ethnicity");//种族 + cnames.put("IdCard", "IdCard");//身份证号 + cnames.put("Monozygous", "Monozygous");//单卵*/ + } + + /* public static void main(String[] args) { + SieveFacade sieveFacade = new SieveFacade(); + sieveFacade.importSerologySieve("C:\\Users\\Administrator\\Desktop\\Example.xls"); + }*/ + public void importSerologySieve(MultipartFile file, Integer id, HttpServletResponse response) { + //把MultipartFile转化为File 第一种 + CommonsMultipartFile cmf= (CommonsMultipartFile)file; + DiskFileItem dfi=(DiskFileItem) cmf.getFileItem(); + File fo=dfi.getStoreLocation(); +// File file = new File(fileName); + Workbook wb = null; + try { + wb = Workbook.getWorkbook(fo); + Sheet s = wb.getSheet(0); + System.out.println(s.getName() + " : "); + int rows = s.getRows(); + if (rows > 0) { + List list = new ArrayList<>(); + //遍历每行 + for (int i = 1; i < rows; i++) { + ImportResult importResult = new ImportResult(); + Cell[] cells = s.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + if(StringUtils.isEmpty(str)){ + continue; + } + switch (j) { + case 0: + importResult.set样本编号(str); + continue; + case 1: + importResult.set姓名(str); + continue; + case 2: + importResult.set姓名2(str); + continue; + case 3: + importResult.set孕妇编号(str); + continue; + case 4: + importResult.set生日(str); + continue; + case 5: + importResult.set种族(str); + continue; + case 6: + + importResult.set地址(str); + continue; + case 7: + importResult.set电话(str); + continue; + case 8: + importResult.set申请单号(str); + continue; + case 9: + importResult.set采样日期(str); + continue; + case 10: + importResult.set送检日期(str); + continue; + case 11: + importResult.set风险计算时间(str); + continue; + case 12: + importResult.set风险评估时间(str); + continue; + case 13: + importResult.set风险计算基于项(str); + continue; + case 14: + importResult.set孕天(str); + continue; + //孕天 B超日期 CRL BPD HC CRL2 BPD2 HC2 B超孕天 体重 胎儿数 I型糖尿病 末次月经 预产年龄 吸烟 辅助生殖方法 提取日期 移植日期 捐赠者生日 既往T21 既往T18 既往NTD 送检单位 送检医生 报告状态 发布状态 发布时间 发布次数 PlGF浓度 DVPI浓度 NT值 NT2值 NB值 NB2值 NT校正MOM值 NT2校正MOM值 PAPP-A浓度 hCGb浓度 PA_DBS浓度 FB_DBS浓度 AFP浓度 AFP_DBS浓度 hCGb_DBS浓度 uE3UPDCN浓度 INHIB-A浓度 INHIBIN浓度 PlGF校正MOM值 DVPI校正MOM值 PAPP-A校正MOM值 hCGb校正MOM值 PA_DBS校正MOM值 FB_DBS校正MOM值 AFP校正MOM值 AFP_DBS校正MOM值 hCGb_DBS校正MOM值 uE3UPDCN校正MOM值 INHIB-A校正MOM值 INHIBIN校正MOM值 T21年龄风险 T21风险值 T21风险结果 T21双胞胎风险值 T21双胞胎风险结果 T18年龄风险 T18风险值 T18风险结果 T18双胞胎风险值 T18双胞胎风险结果 NTD风险值 NTD风险结果 联合筛查 DbPatientId DbCaseId DbSpecimenId + + } + } + + } + //1 根据标本号更新数据 + list.add(importResult); + + } + + System.out.println(list); + for (int i = 0; i