Index: ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/importbasedata/service/ExportBasedataManagerImpl.java =================================================================== diff -u -r21821 -r22750 --- ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/importbasedata/service/ExportBasedataManagerImpl.java (.../ExportBasedataManagerImpl.java) (revision 21821) +++ ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/importbasedata/service/ExportBasedataManagerImpl.java (.../ExportBasedataManagerImpl.java) (revision 22750) @@ -42,7 +42,10 @@ import com.forgon.tools.excel.ExcelCellStyle; import com.forgon.tools.excel.ExcelHelper; import com.forgon.tools.hibernate.ObjectDao; +import com.forgon.tools.util.SqlUtils; +import edu.emory.mathcs.backport.java.util.Arrays; + /** * 基础数据导出到excel * @@ -386,21 +389,38 @@ } } - // 器械包导出 不包含外来器械包 + // 器械包导出 只包含toussetype为器械包、敷料包、消毒物品、外部代理灭菌的器械包 @SuppressWarnings("unchecked") private void tousseDefinitionExport(HSSFWorkbook wb) { HSSFSheet sheet = wb.getSheet("器械包管理"); - if (sheet != null) { + HSSFSheet sheetDisable = wb.getSheet("停用器械包导出"); + if (sheet != null && sheetDisable != null) { + //需要导出的器械包类型 + String[] tousseTypes = {TousseDefinition.PACKAGE_TYPE_INSIDE, //器械包 + TousseDefinition.PACKAGE_TYPE_DRESSING, //敷料包 + TousseDefinition.PACKAGE_TYPE_DISINFECTION, //消毒物品 + TousseDefinition.PACKAGE_TYPE_FOREIGNPROXY //外部代理灭菌 + }; + String sql = String.format("where po.forDisplay = true and %s ", + SqlUtils.getStringFieldInCollectionsPredicate("po.tousseType", Arrays.asList(tousseTypes))); List tousseDefinitions = objectDao - .findBySql(TousseDefinition.class.getSimpleName(),"where po.forDisplay = true and po.tousseType != '外来器械包'"); - int firstRow = 1; + .findBySql(TousseDefinition.class.getSimpleName(),sql); + int ableTousseDefinitionRowNum = 1; + int disableTousseDefinitionRowNum = 1; if (tousseDefinitions != null && tousseDefinitions.size() > 0) { int len = 32; HSSFCellStyle[] contentCellStyleArray = getContentCellStyle(len); HSSFRow row = null; for (TousseDefinition tousseDefinition : tousseDefinitions) { int cellNumer = 0; - row = createRowIfEmpty(sheet, firstRow++); + //获取当前器械包定义是否停用 + boolean isDisable = TousseDefinition.STR_YES.equals(tousseDefinition.getIsDisable()); + //停用的器械包 + if(isDisable){ + row = createRowIfEmpty(sheetDisable, disableTousseDefinitionRowNum++); + }else{ + row = createRowIfEmpty(sheet, ableTousseDefinitionRowNum++); + } // 器械包名称 inertStringValueToCell(row, cellNumer, contentCellStyleArray[cellNumer++], @@ -536,7 +556,11 @@ materialInstances.get(0)); isInsertMaterial = true; for (int i = 1, k = materialInstances.size(); i < k; i++) { - row = createRowIfEmpty(sheet, firstRow++); + if(isDisable){ + row = createRowIfEmpty(sheetDisable, disableTousseDefinitionRowNum++); + }else{ + row = createRowIfEmpty(sheet, ableTousseDefinitionRowNum++); + } setBlankCellStyle(row, contentCellStyleArray, contentCellStyleArray.length); insertMaterialValueToCell(contentCellStyleArray, @@ -550,14 +574,22 @@ if (diposableGoodsInstances != null && diposableGoodsInstances.size() > 0) { if (isInsertMaterial) {// 则创建新的row - row = createRowIfEmpty(sheet, firstRow++); + if(isDisable){ + row = createRowIfEmpty(sheetDisable, disableTousseDefinitionRowNum++); + }else{ + row = createRowIfEmpty(sheet, ableTousseDefinitionRowNum++); + } setBlankCellStyle(row, contentCellStyleArray, contentCellStyleArray.length); }// 否则,不创建row insertDiposableValueToCell(contentCellStyleArray, row, diposableGoodsInstances.get(0)); for (int i = 1, k = diposableGoodsInstances.size(); i < k; i++) { - row = createRowIfEmpty(sheet, firstRow++); + if(isDisable){ + row = createRowIfEmpty(sheetDisable, disableTousseDefinitionRowNum++); + }else{ + row = createRowIfEmpty(sheet, ableTousseDefinitionRowNum++); + } setBlankCellStyle(row, contentCellStyleArray, contentCellStyleArray.length); insertDiposableValueToCell(contentCellStyleArray, @@ -573,17 +605,27 @@ @SuppressWarnings("unchecked") private void foreignTousseDefinitionExport(HSSFWorkbook wb) { HSSFSheet sheet = wb.getSheet("外来器械包管理"); - if (sheet != null) { + HSSFSheet sheetDisable = wb.getSheet("停用外来器械包导出"); + if (sheet != null && sheetDisable != null) { List tousseDefinitions = objectDao .findBySql(TousseDefinition.class.getSimpleName(),"where po.forDisplay = true and po.tousseType = '外来器械包'"); - int firstRow = 1; + int disableTousseDefinitionRowNum = 1; + int ableTousseDefinitionRowNum = 1; if (tousseDefinitions != null && tousseDefinitions.size() > 0) { int len = 30; HSSFCellStyle[] contentCellStyleArray = getContentCellStyle(len); HSSFRow row = null; for (TousseDefinition tousseDefinition : tousseDefinitions) { int cellNumer = 0; - row = createRowIfEmpty(sheet, firstRow++); + + //获取当前器械包定义是否停用 + boolean isDisable = TousseDefinition.STR_YES.equals(tousseDefinition.getIsDisable()); + //停用的器械包 + if(isDisable){ + row = createRowIfEmpty(sheetDisable, disableTousseDefinitionRowNum++); + }else{ + row = createRowIfEmpty(sheet, ableTousseDefinitionRowNum++); + } // 供应商名称 inertStringValueToCell(row, cellNumer, contentCellStyleArray[cellNumer++], @@ -607,7 +649,11 @@ materialInstances.get(0)); isInsertMaterial = true; for (int i = 1, k = materialInstances.size(); i < k; i++) { - row = createRowIfEmpty(sheet, firstRow++); + if(isDisable){ + row = createRowIfEmpty(sheetDisable, disableTousseDefinitionRowNum++); + }else{ + row = createRowIfEmpty(sheet, ableTousseDefinitionRowNum++); + } setBlankCellStyle(row, contentCellStyleArray, contentCellStyleArray.length); insertForeignTousseMaterialValueToCell(contentCellStyleArray, @@ -778,8 +824,8 @@ commonExportManager.printContentWithParams(wb.getSheet("材料管理"), MaterialDefinition.class, "where 1=1 order by po.name", null); - commonExportManager.printContentWithParams(wb.getSheet("容器管理"), - Container.class, "where 1=1", null); +// commonExportManager.printContentWithParams(wb.getSheet("容器管理"), +// Container.class, "where 1=1", null); commonExportManager.printContentWithParams(wb.getSheet("供应商管理"), Supplier.class, "where 1=1", null); Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/importbasedata/basedataDemo.xls =================================================================== diff -u -r20722 -r22750 Binary files differ