Index: ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/importbasedata/action/ProcessSameOrgunitNameController.java =================================================================== diff -u -r16282 -r17562 --- ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/importbasedata/action/ProcessSameOrgunitNameController.java (.../ProcessSameOrgunitNameController.java) (revision 16282) +++ ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/importbasedata/action/ProcessSameOrgunitNameController.java (.../ProcessSameOrgunitNameController.java) (revision 17562) @@ -1,7 +1,5 @@ package com.forgon.disinfectsystem.maintain.importbasedata.action; -import java.io.InputStream; -import java.util.List; import java.util.Map; import java.util.Set; @@ -13,8 +11,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import com.forgon.attachfile.service.AttachFileManager; -import com.forgon.disinfectsystem.maintain.importbasedata.service.ImportBaseDataFromZipManager; import com.forgon.disinfectsystem.maintain.importbasedata.service.ImportBasedataManager; /** @@ -27,14 +23,8 @@ @Controller public class ProcessSameOrgunitNameController { - private AttachFileManager attachFileManager; - private ImportBasedataManager importBasedataManager; - public void setAttachFileManager(AttachFileManager attachFileManager) { - this.attachFileManager = attachFileManager; - } - public void setImportBasedataManager(ImportBasedataManager importBasedataManager) { this.importBasedataManager = importBasedataManager; } Index: ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/importbasedata/service/ImportBasedataManagerImpl.java =================================================================== diff -u -r17534 -r17562 --- ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/importbasedata/service/ImportBasedataManagerImpl.java (.../ImportBasedataManagerImpl.java) (revision 17534) +++ ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/importbasedata/service/ImportBasedataManagerImpl.java (.../ImportBasedataManagerImpl.java) (revision 17562) @@ -4067,9 +4067,10 @@ Map nameToIndexMap = ExcelUtils.autoDetectSheepAndCreateColumnNameToIndexMap(departSheet); int lastRowNum = departSheet.getLastRowNum(); log.debug("重名科室干预的行数="+lastRowNum); - int departNameIndex = ExcelUtils.getColumnIndex(nameToIndexMap, "科室名称"); + int departNameIndex = ExcelUtils.getColumnIndex(nameToIndexMap, "旧科室名称"); int oldDepartCodeIndex = ExcelUtils.getColumnIndex(nameToIndexMap, "旧科室编码"); int newDepartCodeIndex = ExcelUtils.getColumnIndex(nameToIndexMap, "新科室编码"); + int newDepartNameIndex = ExcelUtils.getColumnIndex(nameToIndexMap, "新科室名称"); int deleteOldDepartIndex = ExcelUtils.getColumnIndex(nameToIndexMap, "删除旧科室"); OrgUnit orgUnit = null; @@ -4084,9 +4085,11 @@ String name = ParerUtils.getCellFormatValue(row, departNameIndex); String oldOrgUnitCoding = ParerUtils.getCellFormatValue(row, oldDepartCodeIndex); String newOrgUnitCoding = ParerUtils.getCellFormatValue(row, newDepartCodeIndex); + String newName = ParerUtils.getCellFormatValue(row, newDepartNameIndex); //是否删除旧科室 String deleteOldDepart = ParerUtils.getCellFormatValue(row, deleteOldDepartIndex); + //校验1:旧科室名称不为空 if (StringUtils.isBlank(name)) { // 有空值,记录信息 appendFailureRowNumAndRecordFailureNum( @@ -4095,6 +4098,7 @@ continue; } + //校验2:旧科室编码不为空 if (StringUtils.isBlank(oldOrgUnitCoding)) { // 有空值,记录信息 appendFailureRowNumAndRecordFailureNum( @@ -4103,59 +4107,68 @@ continue; } - if (StringUtils.isBlank(newOrgUnitCoding)) { + //新科室编码及名称允许为空 + /*if (StringUtils.isBlank(newOrgUnitCoding)) { // 有空值,记录信息 appendFailureRowNumAndRecordFailureNum( failureCount, sb, currentRowNum,newDepartCodeIndex,1); failureCount++; continue; + }*/ + + //如果新科室编码或新科室名称都为空,删该科室的业务数据及组织机构都需要删除 + if(StringUtils.isBlank(newOrgUnitCoding) || StringUtils.isBlank(newName)){ + deleteOldDepart = Constants.STR_YES; } - List orgUnitList = objectDao.findBySql(OrgUnit.class.getSimpleName(), "where name='" + name + "'"); - if(CollectionUtils.isEmpty(orgUnitList)){ - // 有空值,记录信息 - appendFailureRowNumAndRecordFailureNum( - failureCount, sb, currentRowNum,departNameIndex,2); - failureCount++; - continue; + //校验3:如果存在新科室编码,那么该编码对应的组织机构不能为空 + if (StringUtils.isNotBlank(newOrgUnitCoding)) { + OrgUnit newOrgUnit = orgUnitManager.getByCode(newOrgUnitCoding); + if(newOrgUnit == null){ + // 有空值,记录信息 + appendFailureRowNumAndRecordFailureNum( + failureCount, sb, currentRowNum,newDepartCodeIndex,2); + failureCount++; + continue; + } } - OrgUnit oldOrgUnit = orgUnitManager.getByCode(oldOrgUnitCoding); + //校验4:如果存在新科室名称,那么该名称对应的组织机构不能为空 + if (StringUtils.isNotBlank(newName)) { + OrgUnit newOrgUnit = (OrgUnit)objectDao.getByProperty(OrgUnit.class.getSimpleName(), "name", newName); + if(newOrgUnit == null){ + // 有空值,记录信息 + appendFailureRowNumAndRecordFailureNum( + failureCount, sb, currentRowNum,newDepartNameIndex,7); + failureCount++; + continue; + } + } + + + /*OrgUnit oldOrgUnit = orgUnitManager.getByCode(oldOrgUnitCoding); if(oldOrgUnit == null){ // 有空值,记录信息 appendFailureRowNumAndRecordFailureNum( - failureCount, sb, currentRowNum,oldDepartCodeIndex,3); + failureCount, sb, currentRowNum,oldDepartCodeIndex,2); failureCount++; continue; } + //校验5:如果文档中的旧科室名字与实际按旧编码查出来的组织机构的名字不一致的 if(!name.equals(oldOrgUnit.getName())){ // 有空值,记录信息 appendFailureRowNumAndRecordFailureNum( - failureCount, sb, currentRowNum,oldDepartCodeIndex,4); + failureCount, sb, currentRowNum,oldDepartCodeIndex,7); failureCount++; continue; - } - OrgUnit newOrgUnit = orgUnitManager.getByCode(newOrgUnitCoding); - if(newOrgUnit == null){ - // 有空值,记录信息 - appendFailureRowNumAndRecordFailureNum( - failureCount, sb, currentRowNum,newDepartCodeIndex,3); - failureCount++; - continue; - } + }*/ - if(!name.equals(newOrgUnit.getName())){ - // 有空值,记录信息 - appendFailureRowNumAndRecordFailureNum( - failureCount, sb, currentRowNum,newDepartCodeIndex,4); - failureCount++; - continue; - } orgUnitChangeMap = new HashMap(); orgUnitChangeMap.put("name", name); orgUnitChangeMap.put("oldOrgUnitCoding", oldOrgUnitCoding); orgUnitChangeMap.put("newOrgUnitCoding", newOrgUnitCoding); + orgUnitChangeMap.put("newName", newName); orgUnitChangeMap.put("deleteOldDepart", deleteOldDepart); orgUnitChangeList.add(orgUnitChangeMap); successCount++; Index: forgon-core/src/main/java/com/forgon/directory/service/OrgUnitManagerImpl.java =================================================================== diff -u -r17512 -r17562 --- forgon-core/src/main/java/com/forgon/directory/service/OrgUnitManagerImpl.java (.../OrgUnitManagerImpl.java) (revision 17512) +++ forgon-core/src/main/java/com/forgon/directory/service/OrgUnitManagerImpl.java (.../OrgUnitManagerImpl.java) (revision 17562) @@ -492,7 +492,9 @@ String sql12 = "update SupplyRoomConfig set dptNameOfForeignTousse = '" + newOrgName + "' where dptCodeOfForeignTousse = '" + orgCoding + "'"; String sql13 = "update ReturnGoodsRecord set depart = '" + newOrgName + "' where departCoding = '" + orgCoding + "'"; String sql14 = "update RecallRecordItem set departName = '" + newOrgName + "' where departCode = '" + orgCoding + "'"; - String sql16 = "update MaterialErrorDamageDetail set depart = '" + newOrgName + "' where departCode = '" + orgCoding + "'"; + String sql15 = "update RecyclingError set depart = '" + newOrgName + "' where departCode = '" + orgCoding + "'"; + String sql16 = "update RecyclingDamageItem set depart = '" + newOrgName + "' where departCoding = '" + orgCoding + "'"; + String sql16_1 = "update MaterialErrorDamageDetail set depart = '" + newOrgName + "' where departCode = '" + orgCoding + "'"; String sql17 = "update QualityMonitoring set orgUnitName = '" + newOrgName + "' where orgUnitCoding = '" + orgCoding + "'"; objectDao.excuteSQL(sql1); @@ -509,7 +511,9 @@ objectDao.excuteSQL(sql12); objectDao.excuteSQL(sql13); objectDao.excuteSQL(sql14); + objectDao.excuteSQL(sql15); objectDao.excuteSQL(sql16); + objectDao.excuteSQL(sql16_1); objectDao.excuteSQL(sql17); //补充增加借物单的借出科室、借用科室、篮筐、供应室处理器械包配置的供应室、供应室服务临床配置的供应室名称及临床科室名称、科室库存、器械包材料库存、 @@ -1184,6 +1188,7 @@ String name = orgUnitChangeMap.get("name"); String oldOrgUnitCoding = orgUnitChangeMap.get("oldOrgUnitCoding"); String newOrgUnitCoding = orgUnitChangeMap.get("newOrgUnitCoding"); + String newName = orgUnitChangeMap.get("newName"); String deleteOldDepart = orgUnitChangeMap.get("deleteOldDepart"); String modifyOldDepartCoding = orgUnitChangeMap.get("modifyOldDepartCoding"); @@ -1195,61 +1200,102 @@ || StringUtils.equalsIgnoreCase("Y", modifyOldDepartCoding); sql = new StringBuffer(""); try{ - sql.append("update invoicePlan set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update invoicePlan set settleAccountsDepartCoding = '" + newOrgUnitCoding + "' where settleAccountsDepartCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update invoicePlan set handleDepartCoding = '" + newOrgUnitCoding + "' where handleDepartCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update RecyclingRecord set departCode = '" + newOrgUnitCoding + "' where departCode = '" + oldOrgUnitCoding + "';"); + //新科室编码不为空时,执行update更新 + if(StringUtils.isNotBlank(newOrgUnitCoding)){ + + //如果是sqlserver(2008版本不支持concat函数,2012版才支持)的话的处理方式 + if(DatabaseUtil.isSqlServer(dbConnection.getDatabase())){ + /*objectDao.excuteSQL("update DepartmentAppTemplate set orgUnitCode = SUBSTRING(replace(concat(',',orgUnitCode,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',orgUnitCode,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',orgUnitCode,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update departmentGroup set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departName = SUBSTRING(replace(concat(',',departName,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departName,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update MaterialDefinition set inventoryDepartCoding = SUBSTRING(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',inventoryDepartCoding,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';' , departNames , ';') , ';" + name + ";' , ';" + newName + ";') , 2 , len(replace(concat(';' , departNames , ';') , ';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where concat(';' , departCodes , ';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update FormDefinition set departCodes=SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';' , departNames , ';') , ';" + name + ";' , ';" + newName + ";') , 2 , len(replace(concat(';' , departNames , ';') , ';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where concat(';' , departCodes , ';') like '%;" + oldOrgUnitCoding + ";%';");*/ + + objectDao.excuteSQL("update DepartmentAppTemplate set orgUnitCode = SUBSTRING(replace((','+cast(orgUnitCode as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(orgUnitCode as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where (',' + cast(orgUnitCode as varchar) + ',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update departmentGroup set departCodes = SUBSTRING(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",') , 2 , len(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where (','+cast(departCodes as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",') , 2 , len(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where (','+cast(departCodes as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",') , 2 , len(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where (','+cast(departCodes as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departName = SUBSTRING(replace((','+cast(departName as varchar)+','),'," + name + ",','," + newName + ",') , 2 , len(replace((','+cast(departName as varchar)+','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where (','+cast(departCodes as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update MaterialDefinition set inventoryDepartCoding = SUBSTRING(replace((','+cast(inventoryDepartCoding as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(inventoryDepartCoding as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where (','+cast(inventoryDepartCoding as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace((','+cast(departCodes as varchar)+','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",') , 2 , len(replace((','+cast(departNames as varchar)+','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where (','+cast(departCodes as varchar)+',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace((';'+cast(departCodes as varchar)+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar)+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((';' + cast(departNames as varchar) + ';') , ';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';' + cast(departNames as varchar) + ';') , ';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where (';' + cast(departCodes as varchar) + ';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update FormDefinition set departCodes=SUBSTRING(replace((';'+cast(departCodes as varchar)+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace((';'+cast(departCodes as varchar)+';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace((';' + cast(departNames as varchar) + ';') , ';" + name + ";' , ';" + newName + ";') , 2 , len(replace((';' + cast(departNames as varchar) + ';') , ';" + name + ";' , ';" + newName + ";')) - 2)" : "") +" where (';' + cast(departCodes as varchar) + ';') like '%;" + oldOrgUnitCoding + ";%';"); + }else if(DatabaseUtil.isOracle(dbConnection.getDatabase())){ + objectDao.excuteSQL("update DepartmentAppTemplate set orgUnitCode = substr(replace(concat(',',concat(orgUnitCode,',')),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , length(replace(concat(',',concat(orgUnitCode,',')),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',orgUnitCode,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update departmentGroup set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departName,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departName,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update MaterialDefinition set inventoryDepartCoding = SUBSTRING(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',inventoryDepartCoding,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace(concat(';' , departCodes , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';' , departCodes , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';' , departNames , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';' , departNames , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";')) - 2)":"") +" where concat(';' , departCodes , ';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update FormDefinition set departCodes=SUBSTRING(replace(concat(';' , departCodes , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';' , departCodes , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(';' , departNames , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';' , departNames , ';') , ';" + oldOrgUnitCoding + ";' , ';" + newOrgUnitCoding + ";')) - 2)":"") +" where concat(';' , departCodes , ';') like '%;" + oldOrgUnitCoding + ";%';"); + } + + sql.append("update invoicePlan set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update invoicePlan set settleAccountsDepartCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",settleAccountsDepart = '" + newName + "'" : "") +" where settleAccountsDepartCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update invoicePlan set handleDepartCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",handleDepart = '" + newName + "'" : "") +" where handleDepartCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update RecyclingRecord set departCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCode = '" + oldOrgUnitCoding + "';"); sql.append("update RecyclingRecord set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update invoice set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update invoice set settleAccountsDepartCoding = '" + newOrgUnitCoding + "' where settleAccountsDepartCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update Invoice set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update useRecord set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update TousseDefinition set handlerDepartCode = '"+newOrgUnitCoding+"' where handlerDepartCode = '" + oldOrgUnitCoding + "';"); + sql.append("update invoice set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update invoice set settleAccountsDepartCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",settleAccountsDepart = '" + newName + "'" : "") +" where settleAccountsDepartCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update Invoice set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update useRecord set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update TousseDefinition set handlerDepartCode = '"+newOrgUnitCoding+"' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",handlerDepartName = '" + newName + "'" : "") +" where handlerDepartCode = '" + oldOrgUnitCoding + "';"); - sql.append("update TousseInstance set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update TousseInstance set location = '" + newOrgUnitCoding + "' where location = '" + oldOrgUnitCoding + "';"); - sql.append("update TousseInstance set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update SupplyRoomConfig set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update SupplyRoomConfig set dptCodeOfForeignTousse = '" + newOrgUnitCoding + "' where dptCodeOfForeignTousse = '" + oldOrgUnitCoding + "';"); - sql.append("update ReturnGoodsRecord set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update ReturnGoodsRecord set handleDepartCode = '" + newOrgUnitCoding + "' where handleDepartCode = '" + oldOrgUnitCoding + "';"); - sql.append("update RecallRecordItem set departCode = '" + newOrgUnitCoding + "' where departCode = '" + oldOrgUnitCoding + "';"); - sql.append("update QualityMonitoring set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update BorrowRecord set departCode = '" + newOrgUnitCoding + "' where departCode = '" + oldOrgUnitCoding + "';"); + sql.append("update TousseInstance set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update TousseInstance set location = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",locationForDisplay = '" + newName + "'" : "") +" where location = '" + oldOrgUnitCoding + "';"); + sql.append("update TousseInstance set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update TousseInstance set settleAccountsDepartCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",settleAccountsDepart = '" + newName + "'" : "") +" where settleAccountsDepartCode = '" + oldOrgUnitCoding + "';"); + sql.append("update SupplyRoomConfig set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update SupplyRoomConfig set dptCodeOfForeignTousse = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",dptNameOfForeignTousse = '" + newName + "'" : "") +" where dptCodeOfForeignTousse = '" + oldOrgUnitCoding + "';"); + sql.append("update ReturnGoodsRecord set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update ReturnGoodsRecord set handleDepartCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where handleDepartCode = '" + oldOrgUnitCoding + "';"); + sql.append("update RecallRecordItem set departCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departName = '" + newName + "'" : "") +" where departCode = '" + oldOrgUnitCoding + "';"); - sql.append("update BorrowRecord set rentalDepartCode = '" + newOrgUnitCoding + "' where rentalDepartCode = '" + oldOrgUnitCoding + "';"); - sql.append("update Container set departCode = '" + newOrgUnitCoding + "' where departCode = '" + oldOrgUnitCoding + "';"); - sql.append("update CssdHandleTousses set orgUnitCode = '" + newOrgUnitCoding + "' where orgUnitCode = '" + oldOrgUnitCoding + "';"); - sql.append("update CssdServiceDepts set cssdOrgUnitCode = '" + newOrgUnitCoding + "' where cssdOrgUnitCode = '" + oldOrgUnitCoding + "';"); - sql.append("update CssdServiceDepts set clinicOrgUnitCode = '" + newOrgUnitCoding + "' where clinicOrgUnitCode = '" + oldOrgUnitCoding + "';"); - sql.append("update DepartmentStock set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update GoodsStock set orgUnitCode = '"+newOrgUnitCoding+"' where orgUnitCode = '" + oldOrgUnitCoding + "';"); - sql.append("update MaterialInvoice set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update PackingTask set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update PackingRecord set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + //sql.append("update QualityMonitoring set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update FormDefinition set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnit = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update FormInstance set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnit = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update PackingRecord set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update ReceiveRecord set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update ReturnMaterialRecord set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update BorrowRecord set departCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departName = '" + newName + "'" : "") +" where departCode = '" + oldOrgUnitCoding + "';"); + sql.append("update BorrowRecord set rentalDepartCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",rentalDepartName = '" + newName + "'" : "") +" where rentalDepartCode = '" + oldOrgUnitCoding + "';"); + sql.append("update Container set departCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departName = '" + newName + "'" : "") +" where departCode = '" + oldOrgUnitCoding + "';"); + sql.append("update CssdHandleTousses set orgUnitCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("update CssdServiceDepts set cssdOrgUnitCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",cssdOrgUnitName = '" + newName + "'" : "") +" where cssdOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("update CssdServiceDepts set clinicOrgUnitCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",clinicOrgUnitName = '" + newName + "'" : "") +" where clinicOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("update DepartmentStock set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departName = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update GoodsStock set orgUnitCode = '"+newOrgUnitCoding+"' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("update MaterialInvoice set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update MaterialInvoice set settleAccountsDepart = '" + newName + "' where settleAccountsDepart = '" + name + "' and settleAccountsDepart <> '" + newName + "';"); + sql.append("update MaterialInvoice set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update PackingTask set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update PackingTask set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",department = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update PackingRecord set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update PackingRecord set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update ReceiveRecord set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update ReturnMaterialRecord set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); sql.append("update ReturnMaterialRecord set handleDepartCode = '" + newOrgUnitCoding + "' where handleDepartCode = '" + oldOrgUnitCoding + "';"); - sql.append("update Rinser set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update SatisfactionSurveyTable set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update TaskGroup set departCode = '" + newOrgUnitCoding + "' where departCode = '" + oldOrgUnitCoding + "';"); - sql.append("update WareHouse set orgUnitCode = '" + newOrgUnitCoding + "' where orgUnitCode = '" + oldOrgUnitCoding + "';"); - sql.append("update GodownEntry set orgUnitCode = '" + newOrgUnitCoding + "' where orgUnitCode = '" + oldOrgUnitCoding + "';"); - sql.append("update GodownEntry set targetOrgUnitCode = '" + newOrgUnitCoding + "' where targetOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("update Rinser set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",department = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update SatisfactionSurveyTable set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update TaskGroup set departCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departName = '" + newName + "'" : "") +" where departCode = '" + oldOrgUnitCoding + "';"); + sql.append("update WareHouse set orgUnitCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("update GodownEntry set orgUnitCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("update GodownEntry set targetOrgUnitCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",targetOrgUnitName = '" + newName + "'" : "") +" where targetOrgUnitCode = '" + oldOrgUnitCoding + "';"); - sql.append("update Sterilizer set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update Sterilizer set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",department = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); sql.append("update BeCleanItem set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); sql.append("update DeviceMaintenance set deviceDepartCoding = '" + newOrgUnitCoding + "' where deviceDepartCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update ExpensiveDisposablegoods set location = '" + newOrgUnitCoding + "' where location = '" + oldOrgUnitCoding + "';"); + sql.append("update ExpensiveDisposablegoods set location = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",locationForDisplay = '" + newName + "'" : "") +" where location = '" + oldOrgUnitCoding + "';"); sql.append("update IDCardInstance set codeOfLostDepart = '" + newOrgUnitCoding + "' where codeOfLostDepart = '" + oldOrgUnitCoding + "';"); - sql.append("update InventoryRecord set orgUnitCode = '" + newOrgUnitCoding + "' where orgUnitCode = '" + oldOrgUnitCoding + "';"); - sql.append("update IpAndOrgUnitMapping set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update InventoryRecord set orgUnitCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("update IpAndOrgUnitMapping set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); sql.append("update KnowledgeFile1 set readerOrgUnitCode = '" + newOrgUnitCoding + "' where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); sql.append("update KnowledgeFile2 set readerOrgUnitCode = '" + newOrgUnitCoding + "' where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); sql.append("update KnowledgeFile3 set readerOrgUnitCode = '" + newOrgUnitCoding + "' where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); - sql.append("update KnowledgeFile4 set readerOrgUnitCode = '" + newOrgUnitCoding + "' where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); sql.append("update KnowledgeFile5 set readerOrgUnitCode = '" + newOrgUnitCoding + "' where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); sql.append("update KnowledgeFolder1 set readerOrgUnitCode = '" + newOrgUnitCoding + "' where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); @@ -1258,19 +1304,22 @@ sql.append("update KnowledgeFolder4 set readerOrgUnitCode = '" + newOrgUnitCoding + "' where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); sql.append("update KnowledgeFolder5 set readerOrgUnitCode = '" + newOrgUnitCoding + "' where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); sql.append("update MaterialCheckRecord set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update OperationOrg set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update Problem set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update OperationOrg set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update Problem set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); sql.append("update PublicInformation set readerOrgUnitCode = '" + newOrgUnitCoding + "' where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); - sql.append("update RecallRecordItem set departCode = '" + newOrgUnitCoding + "' where departCode = '" + oldOrgUnitCoding + "';"); - sql.append("update ReceiveRecordWB set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update MaterialErrorDamageDetail set departCodeForId = '" + newOrgUnitCoding + "' where departCodeForId = '" + oldOrgUnitCoding + "';"); + sql.append("update ReceiveRecordWB set departCoding = '" + newOrgUnitCoding + "' where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update RecyclingError set departCodeForId = '" + newOrgUnitCoding + "' where departCodeForId = '" + oldOrgUnitCoding + "';"); + sql.append("update RecyclingError set departCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCode = '" + oldOrgUnitCoding + "';"); + sql.append("update RecyclingError set handleDepartCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",handleDepartName = '" + newName + "'" : "") +" where handleDepartCode = '" + oldOrgUnitCoding + "';"); sql.append("update MaterialErrorDamageDetail set departCode = '" + newOrgUnitCoding + "' where departCode = '" + oldOrgUnitCoding + "';"); sql.append("update MaterialErrorDamageDetail set handleDepartCode = '" + newOrgUnitCoding + "' where handleDepartCode = '" + oldOrgUnitCoding + "';"); + sql.append("update RecyclingDamageItem set departCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",depart = '" + newName + "'" : "") +" where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update RecyclingDamageItem set handleDepartCode = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",handleDepartName = '" + newName + "'" : "") +" where handleDepartCode = '" + oldOrgUnitCoding + "';"); sql.append("update SterilizationRecord set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update StockTakeRecord set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update StockTakeRecord set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); - sql.append("update TousseReturnDisinfectRecord set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("update TousseReturnDisinfectRecord set orgUnitCoding = '" + newOrgUnitCoding + "' "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",orgUnitName = '" + newName + "'" : "") +" where orgUnitCoding = '" + oldOrgUnitCoding + "';"); sql.append("update WashAndDisinfectRecord set orgUnitCoding = '" + newOrgUnitCoding + "' where orgUnitCoding = '" + oldOrgUnitCoding + "';"); sql.append("update OrgUserRelation set orgUnitId=(select id from OrgUnit where orgUnitCoding='" + newOrgUnitCoding + "') where orgUnitId=(select id from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "') and (select id from OrgUnit where orgUnitCoding='" + newOrgUnitCoding + "') is not null;"); sql.append("update GoodPurchaseItem set orgUnit_id = (select id from OrgUnit where orgUnitCoding='" + newOrgUnitCoding + "') where orgUnit_id=(select id from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "') and (select id from OrgUnit where orgUnitCoding='" + newOrgUnitCoding + "') is not null;"); @@ -1281,6 +1330,127 @@ sql.append("update St_tousse_detail set dept_id = (select id from OrgUnit where orgUnitCoding='" + newOrgUnitCoding + "') where dept_id = (select id from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "') and (select id from OrgUnit where orgUnitCoding='" + newOrgUnitCoding + "') is not null;"); sql.append("update SS_USERS set currentOrgUnitCode='" + newOrgUnitCoding + "' where currentOrgUnitCode='" + oldOrgUnitCoding + "';"); + }else{ + //如果是sqlserver的话的处理方式 + /*if(DatabaseUtil.isSqlServer(dbConnection.getDatabase())){ + objectDao.excuteSQL("update DepartmentAppTemplate set orgUnitCode = SUBSTRING(replace(concat(',',orgUnitCode,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',orgUnitCode,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',orgUnitCode,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update departmentGroup set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + //objectDao.excuteSQL("update QualityMonitoringConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departName = SUBSTRING(replace(concat(',',departName,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departName,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update MaterialDefinition set inventoryDepartCoding = SUBSTRING(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',inventoryDepartCoding,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(';',departCodes,';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update FormDefinition set departCodes=SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",') , 2 , len(replace(concat(',',departNames,','),'," + name + ",','," + newName + ",')) - 2)" : "") +" where concat(';',departCodes,';') like '%;" + oldOrgUnitCoding + ";%';"); + }else if(DatabaseUtil.isOracle(dbConnection.getDatabase())){ + objectDao.excuteSQL("update DepartmentAppTemplate set orgUnitCode = substr(replace(concat(',',concat(orgUnitCode,',')),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , length(replace(concat(',',concat(orgUnitCode,',')),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',orgUnitCode,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update departmentGroup set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + //objectDao.excuteSQL("update QualityMonitoringConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departName,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departName,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update MaterialDefinition set inventoryDepartCoding = SUBSTRING(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',inventoryDepartCoding,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); + objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(';',departCodes,';') like '%;" + oldOrgUnitCoding + ";%';"); + objectDao.excuteSQL("update FormDefinition set departCodes=SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) "+ (StringUtils.isNotBlank(newName) && !StringUtils.equals(newName, name) ? ",departNames = SUBSTRING(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departNames,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2)":"") +" where concat(';',departCodes,';') like '%;" + oldOrgUnitCoding + ";%';"); + }*/ + //否则新科室编码为空时,执行delete删除 + sql.append("delete from RecyclingError where departCodeForId = '" + oldOrgUnitCoding + "' or departCode = '" + oldOrgUnitCoding + "' or handleDepartCode = '" + oldOrgUnitCoding + "' or tousseItem_ID in (select id from TousseItem where recyclingApplication_ID in (select id from invoicePlan where departCoding = '" + oldOrgUnitCoding + "' or settleAccountsDepartCoding = '" + oldOrgUnitCoding + "' or handleDepartCoding = '" + oldOrgUnitCoding + "') or recyclingRecord_id in (select id from RecyclingRecord where departCode = '" + oldOrgUnitCoding + "' or orgUnitCoding = '" + oldOrgUnitCoding + "'));"); + sql.append("delete from RecyclingDamageItem where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from RecyclingDamageItem where handleDepartCode = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from TousseItem where recyclingApplication_ID in (select id from invoicePlan where departCoding = '" + oldOrgUnitCoding + "' or settleAccountsDepartCoding = '" + oldOrgUnitCoding + "' or handleDepartCoding = '" + oldOrgUnitCoding + "') or recyclingRecord_id in (select id from RecyclingRecord where departCode = '" + oldOrgUnitCoding + "' or orgUnitCoding = '" + oldOrgUnitCoding + "' or recyclingApplication_id in (select id from InvoicePlan where departCoding = '" + oldOrgUnitCoding + "' or settleAccountsDepartCoding = '" + oldOrgUnitCoding + "' or handleDepartCoding = '" + oldOrgUnitCoding + "'));"); + sql.append("delete from ClassifyBasket_RecyclingRecord where RecyclingRecord_ID in (select id from RecyclingRecord where departCode = '" + oldOrgUnitCoding + "' or orgUnitCoding = '" + oldOrgUnitCoding + "');"); + sql.append("delete from RecyclingRecord where departCode = '" + oldOrgUnitCoding + "' or orgUnitCoding = '" + oldOrgUnitCoding + "' or recyclingApplication_id in (select id from InvoicePlan where departCoding = '" + oldOrgUnitCoding + "' or settleAccountsDepartCoding = '" + oldOrgUnitCoding + "' or handleDepartCoding = '" + oldOrgUnitCoding + "');"); + sql.append("delete from RecyclingApplication where id in (select id from InvoicePlan where departCoding = '" + oldOrgUnitCoding + "' or settleAccountsDepartCoding = '" + oldOrgUnitCoding + "' or handleDepartCoding = '" + oldOrgUnitCoding + "');"); + sql.append("delete from InvoicePlan where departCoding = '" + oldOrgUnitCoding + "' or settleAccountsDepartCoding = '" + oldOrgUnitCoding + "' or handleDepartCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from InvoiceItem where invoice_id in ( select id from Invoice where orgUnitCoding = '" + oldOrgUnitCoding + "' or departCoding = '" + oldOrgUnitCoding + "' or settleAccountsDepartCoding = '" + oldOrgUnitCoding + "');"); + sql.append("delete from Invoice where orgUnitCoding = '" + oldOrgUnitCoding + "' or departCoding = '" + oldOrgUnitCoding + "' or settleAccountsDepartCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from useRecord where departCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from TousseInstance where orgUnitCoding = '" + oldOrgUnitCoding + "' or location = '" + oldOrgUnitCoding + "' or departCoding = '" + oldOrgUnitCoding + "' or settleAccountsDepartCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from TousseDefinition where handlerDepartCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from SupplyRoomConfig where orgUnitCoding = '" + oldOrgUnitCoding + "' or dptCodeOfForeignTousse = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from ReturnGoodsRecord where departCoding = '" + oldOrgUnitCoding + "' or handleDepartCode = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from RecallRecordItem where departCode = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from FormInstance where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from FormDefinition where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from BorrowRecord where departCode = '" + oldOrgUnitCoding + "' or rentalDepartCode = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from Container where departCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from CssdHandleTousses where orgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from CssdServiceDepts where cssdOrgUnitCode = '" + oldOrgUnitCoding + "' or clinicOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from DepartmentStock where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from GoodsStock where orgUnitCode = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from MaterialInvoice where departCoding = '" + oldOrgUnitCoding + "' or orgUnitCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from PackingTask where orgUnitCoding = '" + oldOrgUnitCoding + "' or departCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from PackingRecord where orgUnitCoding = '" + oldOrgUnitCoding + "' or departCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from ReceiveRecord where departCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from ReturnMaterialRecord where departCoding = '" + oldOrgUnitCoding + "' or handleDepartCode = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from Rinser where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from SatisfactionSurveyTable where departCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from TaskGroup where departCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from WareHouse where orgUnitCode = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from GodownEntry where orgUnitCode = '" + oldOrgUnitCoding + "' or targetOrgUnitCode = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from Sterilizer where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from BeCleanItem where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from DeviceMaintenance where deviceDepartCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from ExpensiveDisposablegoods where location = '" + oldOrgUnitCoding + "';"); + sql.append("delete from IDCardInstance where codeOfLostDepart = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from InventoryRecord where orgUnitCode = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from IpAndOrgUnitMapping where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from KnowledgeFile1 where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from KnowledgeFile2 where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from KnowledgeFile3 where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from KnowledgeFile4 where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from KnowledgeFile5 where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from KnowledgeFolder1 where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from KnowledgeFolder2 where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from KnowledgeFolder3 where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from KnowledgeFolder4 where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from KnowledgeFolder5 where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from MaterialCheckRecord where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from OperationOrg where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from Problem where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from PublicInformation where readerOrgUnitCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from RecallRecordItem where departCode = '" + oldOrgUnitCoding + "';"); + sql.append("delete from ReceiveRecordWB where departCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from SterilizationRecord where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from StockTakeRecord where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from TousseReturnDisinfectRecord where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + sql.append("delete from WashAndDisinfectRecord where orgUnitCoding = '" + oldOrgUnitCoding + "';"); + + sql.append("delete from OrgUserRelation where orgUnitId=(select id from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "');"); + sql.append("delete from GoodPurchaseItem where orgUnit_id=(select id from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "');"); + sql.append("delete from GoodPurchasePlan where orgUnit_id=(select id from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "');"); + sql.append("delete from SS_DirectManaged_OrgUnit where ORGUNIT_ID = (select id from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "');"); + sql.append("delete from SS_UnDirectManaged_OrgUnit where ORGUNIT_ID = (select id from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "');"); + sql.append("delete from St_material_detail where dept_id = (select id from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "');"); + sql.append("delete from St_tousse_detail where dept_id = (select id from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "');"); + sql.append("update SS_USERS set currentOrgUnitCode=null where currentOrgUnitCode='" + oldOrgUnitCoding + "';"); + + } String[] sqlArray = sql.toString().split(";"); if(sqlArray != null && sqlArray.length > 0){ for(String updateSql : sqlArray){ @@ -1291,30 +1461,15 @@ } } - //如果是sqlserver的话的处理方式 - if(DatabaseUtil.isSqlServer(dbConnection.getDatabase())){ - objectDao.excuteSQL("update DepartmentAppTemplate set orgUnitCode = SUBSTRING(replace(concat(',',orgUnitCode,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',orgUnitCode,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',orgUnitCode,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update departmentGroup set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update QualityMonitoringConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update MaterialDefinition set inventoryDepartCoding = SUBSTRING(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',inventoryDepartCoding,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) where concat(';',departCodes,';') like '%;" + oldOrgUnitCoding + ";%';"); - }else if(DatabaseUtil.isOracle(dbConnection.getDatabase())){ - objectDao.excuteSQL("update DepartmentAppTemplate set orgUnitCode = substr(replace(concat(',',concat(orgUnitCode,',')),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , length(replace(concat(',',concat(orgUnitCode,',')),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',orgUnitCode,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update departmentGroup set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update InvoiceDepartment set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update PrintInvoiceConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update QualityMonitoringConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update System_Message set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update MaterialDefinition set inventoryDepartCoding = SUBSTRING(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',inventoryDepartCoding,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',inventoryDepartCoding,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update GoodsDepartShareConfig set departCodes = SUBSTRING(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",') , 2 , len(replace(concat(',',departCodes,','),'," + oldOrgUnitCoding + ",','," + newOrgUnitCoding + ",')) - 2) where concat(',',departCodes,',') like '%," + oldOrgUnitCoding + ",%';"); - objectDao.excuteSQL("update PrintConfig set departCodes=SUBSTRING(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";') , 2 , len(replace(concat(';',departCodes,';'),';" + oldOrgUnitCoding + ";',';" + newOrgUnitCoding + ";')) - 2) where concat(';',departCodes,';') like '%;" + oldOrgUnitCoding + ";%';"); - } + //更改科室供应室、申请单及供应室服务临床科室配置表的拼音码与五笔码 + objectDao.excuteSQL("update SupplyRoomConfig set spelling=(select spelling from OrgUnit where orgUnitCoding=SupplyRoomConfig.orgUnitCoding) where spelling <> (select spelling from OrgUnit where orgUnitCoding=SupplyRoomConfig.orgUnitCoding)"); + objectDao.excuteSQL("update SupplyRoomConfig set wbCode=(select wbCode from OrgUnit where orgUnitCoding=SupplyRoomConfig.orgUnitCoding) where wbCode <> (select wbCode from OrgUnit where orgUnitCoding=SupplyRoomConfig.orgUnitCoding)"); + objectDao.excuteSQL("update Invoiceplan set spelling=(select spelling from OrgUnit where orgUnitCoding=Invoiceplan.departCoding) where spelling <> (select spelling from OrgUnit where orgUnitCoding=Invoiceplan.departCoding)"); + objectDao.excuteSQL("update Invoiceplan set wbCode=(select wbCode from OrgUnit where orgUnitCoding=Invoiceplan.departCoding) where wbCode <> (select wbCode from OrgUnit where orgUnitCoding=Invoiceplan.departCoding)"); + objectDao.excuteSQL("update CssdServiceDepts set spelling=(select spelling from OrgUnit where orgUnitCoding=CssdServiceDepts.cssdOrgUnitCode) where spelling is null or spelling <> (select spelling from OrgUnit where orgUnitCoding=CssdServiceDepts.cssdOrgUnitCode)"); + objectDao.excuteSQL("update CssdServiceDepts set wbCode=(select wbCode from OrgUnit where orgUnitCoding=CssdServiceDepts.cssdOrgUnitCode) where wbCode is null or wbCode <> (select wbCode from OrgUnit where orgUnitCoding=CssdServiceDepts.cssdOrgUnitCode)"); if(needDelete){ objectDao.excuteSQL("delete from OrgUnit where orgUnitCoding='" + oldOrgUnitCoding + "';"); }else{ @@ -1347,18 +1502,14 @@ log.debug("科室干预:name=" + name + ",oldOrgUnitCoding=" + oldOrgUnitCoding + ",newOrgUnitCoding=" + newOrgUnitCoding + ",needDeleteOldOrgUnit=" + needDelete); appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_INTERFERE, Log.TYPE_UPDATE, "科室干预:name=" + name + ",oldOrgUnitCoding=" + oldOrgUnitCoding + ",newOrgUnitCoding=" + newOrgUnitCoding + ",needDeleteOldOrgUnit=" + needDelete); - /*if(needDelete){ - //System.out.println("删除重名科室sql:delete from orgunit where orgUnitCoding='" + oldOrgUnitCoding + "'"); - //objectDao.delete(objectDao.getBySql(OrgUnit.class.getSimpleName(), "where orgUnitCoding='" + oldOrgUnitCoding + "'")); - objectDao.excuteSQL("delete from orgunit where orgUnitCoding='" + oldOrgUnitCoding + "'"); - }*/ if(i % 50 == 0){ objectDao.clearCache(); } }catch(Exception e){ log.error("errorSql=" + errorSql); e.printStackTrace(); result = false; + throw e; } } /*} catch (Exception e1) { Index: forgon-core/src/main/java/com/forgon/directory/service/OrgUnitManager.java =================================================================== diff -u -r16920 -r17562 --- forgon-core/src/main/java/com/forgon/directory/service/OrgUnitManager.java (.../OrgUnitManager.java) (revision 16920) +++ forgon-core/src/main/java/com/forgon/directory/service/OrgUnitManager.java (.../OrgUnitManager.java) (revision 17562) @@ -166,12 +166,19 @@ List findDeptNameByOrgUnitCodes(Collection codes); /** - * 更改各个表的科室编码,由旧科室编码更改为新的科室编码,并根据是否需要删除科室参数对旧的科室进行删除 + * 更改各个表的科室编码及名称,由旧科室编码更改为新的科室编码,由旧科室名称更改为新的科室名称,并根据是否需要删除科室参数对旧的科室进行删除 + * 如果新newOrgUnitcoding 新的科室编码和newName 新科室名称同时都为空时,则旧的业务数据记录及组织机构将删除 + * 目前有三处调用场景,分别如下(按业务执行的先后顺序处理): + * 1.科室干预:导入相关科室数据文件(将申请单相关的科室的数据转移给其它科室,旧科室可能已经对应不到组织机构表数据,如果新科室编码为空,原旧科室的业务将被删除) + * 2.科室干预:添加前缀功能(给组织机构表及对应的业务表(申请单)所有的科室编码加上统一前缀,只改科室编码,不涉及删除科室) + * 3.科室干预:导入相关科室数据文件(将组织机构表中相同的科室名称但科室编码又不同的数据进行合并,同时旧科室相应的业务表数据转移到新科室下面(可以通过语句排查出要处理的数据),旧科室根据情况文档的情况确定是否需要删除) * @param orgUnitChangeList map里面的key如下 - * name 科室名称 - * oldOrgUnitcoding 旧的科室编码 - * newOrgUnitcoding 新的科室编码 - * deleteOldDepart 是否需要删除旧的科室 + * @param name 旧科室名称 + * @param oldOrgUnitcoding 旧科室编码 + * @param newOrgUnitcoding 新科室编码 + * @param newName 新科室名称 + * @param deleteOldDepart 是否需要删除旧的科室 + * @param modifyOldDepartCoding 是否需要删除旧的科室 * @return */ public boolean changeOrgUnitCoding(List> orgUnitChangeList , StringBuffer sql);