Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/service/DataSynchronizationManagerImpl.java =================================================================== diff -u -r16433 -r18187 --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/service/DataSynchronizationManagerImpl.java (.../DataSynchronizationManagerImpl.java) (revision 16433) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/service/DataSynchronizationManagerImpl.java (.../DataSynchronizationManagerImpl.java) (revision 18187) @@ -12,16 +12,17 @@ import java.util.Set; import net.sf.json.JSONArray; +import net.sf.json.JSONObject; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.hibernate.Query; import org.springframework.beans.factory.annotation.Autowired; - import org.apache.log4j.Logger; +import com.forgon.directory.acegi.tools.AcegiHelper; import com.forgon.directory.model.BarcodeDevice; import com.forgon.directory.model.OrgUnit; import com.forgon.directory.model.OrgUserRelation; @@ -37,6 +38,8 @@ import com.forgon.disinfectsystem.datasynchronization.model.PatientInfoVO; import com.forgon.disinfectsystem.datasynchronization.model.UserVo; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier; +import com.forgon.log.model.Log; +import com.forgon.log.service.LogManager; import com.forgon.security.model.User; import com.forgon.security.service.UserManager; import com.forgon.serialnumber.model.SerialNum; @@ -63,6 +66,8 @@ @Autowired private SupplierManager supplierManager; @Autowired + private LogManager appLogManager; + @Autowired private ObjectDao objectDao; private SyncSupplierDao syncSupplierDao; @@ -124,7 +129,10 @@ && !(hospitalNum.startsWith(hospitalNumberPrefix))){ hospitalNum = hospitalNumberPrefix + hospitalNum; } - return findPatientInfoByHospitalNumDao.findPatientInfoByHospitalNum(hospitalNum); + PatientInfoVO[] patientInfoArray = findPatientInfoByHospitalNumDao.findPatientInfoByHospitalNum(hospitalNum); + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_SYNC, Log.TYPE_QUERY, + "根据住院号"+ hospitalNum +"同步到的结果为:" + JSONArray.fromObject(patientInfoArray)); + return patientInfoArray; } @Override @@ -137,7 +145,10 @@ if(StringUtils.isNotBlank(treatmentNum) && StringUtils.isNotBlank(clinicNumberPrefix) && treatmentNum.startsWith(clinicNumberPrefix)){ treatmentNum = treatmentNum.replaceFirst(clinicNumberPrefix, ""); } - return findPatientInfoByTreatmentNumDao.findPatientInfoByTreatmentNum(treatmentNum); + PatientInfoVO[] patientInfoArray = findPatientInfoByTreatmentNumDao.findPatientInfoByTreatmentNum(treatmentNum); + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_SYNC, Log.TYPE_QUERY, + "根据疹疗号"+ treatmentNum +"同步到的结果为:" + JSONArray.fromObject(patientInfoArray)); + return patientInfoArray; } @Override @@ -252,6 +263,9 @@ deleteExcludeOrgUnits(allVos); } + if(allVos == null || allVos.length == 0){ + return; + } long count = 0; //循环his接口的科室数据集 for(OrgUnitVo vo : allVos){ @@ -414,33 +428,40 @@ Map map = new HashMap(); for(UserVo vo : allVos){ // 检查用户是否存在 -// ResultSet rs = objectDao.executeSql( -// "select count(*) from SS_USERS u,OrgUserRelation r,OrgUnit o " -// + "where u.id = r.userId and o.id = r.orgUnitId and o.orgUnitCoding " -// + "= '"+ vo.orgUnitCoding+"' and u.name = '"+vo.coding+"'"); -// boolean userExist = false; -// try { -// while(rs.next()){ -// if(rs.getInt(1) > 0){ -// userExist = true; -// } -// } -// } catch (SQLException e) { -// e.printStackTrace(); -// }finally { -// DatabaseUtil.closeResultSetAndStatement(rs); -// } - ResultSet rs = objectDao.executeSql("select u.lockStatus from SS_USERS u,OrgUserRelation r,OrgUnit o " + ResultSet rs = objectDao.executeSql( + "select count(*) from SS_USERS u " + + "where u.name = '"+vo.coding+"'"); + boolean userExist = false; + try { + while(rs.next()){ + if(rs.getInt(1) > 0){ + userExist = true; + } + } + } catch (SQLException e) { + e.printStackTrace(); + }finally { + DatabaseUtil.closeResultSetAndStatement(rs); + } + + //同步用户当设置更新交集为false时是否不更改系统中的用户与部门的对应关系,true表示不更改,false表示会更新,默认为false + boolean syncUserWhenUpdateIntersectionDataIsFalseNotChangeOrgUserRelation = + CssdUtils.getSystemSetConfigByNameBool("syncUserWhenUpdateIntersectionDataIsFalseNotChangeOrgUserRelation"); + if(userExist && !更新交集数据 && syncUserWhenUpdateIntersectionDataIsFalseNotChangeOrgUserRelation){ + continue; + } + + // 检查用户与该科室的关系是否存在 + rs = objectDao.executeSql("select u.lockStatus from SS_USERS u,OrgUserRelation r,OrgUnit o " + "where u.id = r.userId and o.id = r.orgUnitId and o.orgUnitCoding " + "= '"+ (vo.orgUnitCoding == null ? '0' : vo.orgUnitCoding) +"' and u.name = '"+vo.coding+"'"); //这个用户存在的话,就找出与科室的关系(根据his那边的关系)这里有且只会查到一条 - - boolean userExist = false; //此用户是否存在 + boolean userOrgRelationExist = false; boolean isLockStatus = false; //此用户是否被锁定 try { while(rs.next()){ String lockStatus = rs.getString(1); //这里取出来的可能为null,因为旧数据表没有这个字段,不过也他修改无所谓,(这里对被锁定的用户不会被影响的) if(lockStatus != null){ - userExist = true; + userOrgRelationExist = true; if ("是".equals(lockStatus)) { isLockStatus = true; } @@ -452,13 +473,9 @@ DatabaseUtil.closeResultSetAndStatement(rs); } -// if(userExist && !更新交集数据){ -// continue; -// } - if (userExist) { - if (!更新交集数据 || isLockStatus) { //如果用户被锁定了, 则不允许修改 - continue; - } + //如果用户被锁定了, 则不允许修改 + if (userOrgRelationExist || isLockStatus) { + continue; } Index: forgon-core/src/main/java/com/forgon/log/model/Log.java =================================================================== diff -u -r17641 -r18187 --- forgon-core/src/main/java/com/forgon/log/model/Log.java (.../Log.java) (revision 17641) +++ forgon-core/src/main/java/com/forgon/log/model/Log.java (.../Log.java) (revision 18187) @@ -49,10 +49,12 @@ public static final String MODEL_SIGN = "签收模块"; public static final String MODEL_DEVICE_INTERFACE = "设备接口模块"; public static final String MODEL_OPERATION_RESERVATION = "手术预约"; + public static final String MODEL_SYNC = "接口同步"; public static final String TYPE_ADD = "A";//添加 public static final String TYPE_UPDATE = "U";//修改 public static final String TYPE_DELETE = "D";//删除 + public static final String TYPE_QUERY = "Q";//查询 public static final String CLIENT_TYPE_WIN_MOBILE = "clientForWindowsMobile"; Index: ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseInfoForm.js =================================================================== diff -u -r17833 -r18187 --- ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseInfoForm.js (.../foreignTousseInfoForm.js) (revision 17833) +++ ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseInfoForm.js (.../foreignTousseInfoForm.js) (revision 18187) @@ -1273,7 +1273,7 @@ } } }, - flex : (sstsConfig.hidePatientArea ? 0.5 : 1) + flex : 1 },{ xtype : 'textfield', fieldLabel : '诊疗号', @@ -1292,31 +1292,38 @@ } }, flex : 1 - },{ + }, { xtype : 'textfield', - fieldLabel : '病区', + fieldLabel : '病人姓名', maxLength : '50', - id : 'patientArea', - name : 'patientArea', + id : 'patient', + name : 'patient', allowBlank : true, - hidden : sstsConfig.hidePatientArea, flex : 1 } ] },{ xtype : 'container', width : 730, layout : 'hbox', - hidden : sstsConfig.hideRoomNumber, + hidden : sstsConfig.hidePatientArea, flex : 1, - items : [ - { + items : [{ xtype : 'textfield', + fieldLabel : '病区', + maxLength : '50', + id : 'patientArea', + name : 'patientArea', + allowBlank : true, + flex : 1 + },{ + xtype : 'textfield', fieldLabel : '病室', maxLength : '50', id : 'roomNumber', name : 'roomNumber', allowBlank : true, + hidden : sstsConfig.hideRoomNumber, flex : 1 }, { xtype : 'textfield', @@ -1325,15 +1332,8 @@ id : 'bedNumber', name : 'bedNumber', allowBlank : true, + hidden : sstsConfig.hideRoomNumber, flex : 1 - }, { - xtype : 'textfield', - fieldLabel : '病人姓名', - maxLength : '50', - id : 'patient', - name : 'patient', - allowBlank : true, - flex : 1 } ] },{