Index: ssts-web/src/main/webapp/disinfectsystem/config/xmsfybjy/interfaces/fieldsMappingTalbe.json =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/config/xmsfybjy/interfaces/fieldsMappingTalbe.json (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/config/xmsfybjy/interfaces/fieldsMappingTalbe.json (revision 31649) @@ -0,0 +1,5 @@ +{ + "fieldsMappingTalbe":[ + + ] +} \ No newline at end of file Index: ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImplV3.java =================================================================== diff -u -r31611 -r31649 --- ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImplV3.java (.../HIPMessageWebServiceImplV3.java) (revision 31611) +++ ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImplV3.java (.../HIPMessageWebServiceImplV3.java) (revision 31649) @@ -19,13 +19,15 @@ import org.dom4j.XPath; import org.springframework.beans.factory.annotation.Autowired; +import com.forgon.databaseadapter.service.DateQueryAdapter; import com.forgon.directory.model.BarcodeDevice; import com.forgon.directory.model.OrgUnit; import com.forgon.directory.model.OrgUserRelation; import com.forgon.directory.service.OrgUnitManager; import com.forgon.disinfectsystem.barcode.service.BarcodeManager; import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; import com.forgon.disinfectsystem.basedatamanager.warehouse.service.WareHouseManager; +import com.forgon.disinfectsystem.common.CssdUtils; import com.forgon.disinfectsystem.datasynchronization.dao.FindPatientInfoByHospitalNumDao; import com.forgon.disinfectsystem.datasynchronization.dao.FindPatientInfoByTreatmentNumDao; import com.forgon.disinfectsystem.datasynchronization.model.PatientInfoVO; @@ -93,6 +95,8 @@ private SupplyRoomConfigManager supplyRoomConfigManager; @Autowired private OrgUnitManager orgUnitManager; + @Autowired + private DateQueryAdapter dateQueryAdapter; /** * 同步配置(取自各项目的参数名称配置文件fieldsMappingTalbe.json) @@ -146,6 +150,8 @@ String operationXpath = "/REQUEST/MSG/SURGERY_NAME"; // 手术时间 String operationTimeXpath = "/REQUEST/MSG/SURGERY_DATETIME"; + // 手术状态 + String operationStatusXpath = "/REQUEST/MSG/OPERATION_STATUS"; // 医生姓名 String doctorNameXpath = "/REQUEST/MSG/SURGERY_DOCTOR_NAME"; // 洗手护士 @@ -188,6 +194,8 @@ String remark = processDataByXpath(document, null, remarkXpath); // 手术时间 String operationTimeStr = processDataByXpath(document, null, operationTimeXpath); + // 手术状态 + String operationStatus = processDataByXpath(document, null, operationStatusXpath); // 住院号和诊疗号不能都为空 if(StringUtils.isBlank(hospitalNumber) && StringUtils.isBlank(treatmentNum)){ @@ -389,95 +397,113 @@ // 2、创建使用记录 UseRecord newUseRecord = new UseRecord(); + String enableUseRecordFormExtensionFields = CssdUtils.getSystemSetConfigByName("enableUseRecordFormExtensionFields"); + if(StringUtils.isNotBlank(enableUseRecordFormExtensionFields)){ + enableUseRecordFormExtensionFields = enableUseRecordFormExtensionFields.substring(1, enableUseRecordFormExtensionFields.length() -1); + if(StringUtils.contains(enableUseRecordFormExtensionFields, "手术状态")){ + if(StringUtils.isBlank(operationStatus)){ + throw new RuntimeException("患者消毒物料使用登记失败 :手术状态operationStatus不能为空!" ); + } + // 查找同一场手术的未审核的使用记录 + newUseRecord = getUnReviewUseRecord(hospitalNumber, treatmentNum, operationTimeStr); + } + } - // 患者姓名 - String patientName = processDataByXpath(document, null, patientNameXpath); - if(StringUtils.isBlank(patientName)){ - // 不传患者姓名则根据住院号查询患者信息 - PatientInfoVO patient = null; - if(StringUtils.isNotBlank(hospitalNumber)){ - if(findPatientInfoByHospitalNumDao != null){ - PatientInfoVO[] patientInfoVOs = findPatientInfoByHospitalNumDao.findPatientInfoByHospitalNum(hospitalNumber); - if(patientInfoVOs != null && patientInfoVOs.length > 0){ - patient = patientInfoVOs[0]; + if(!DatabaseUtil.isPoIdValid(newUseRecord.getId())){ + // 患者姓名 + String patientName = processDataByXpath(document, null, patientNameXpath); + if(StringUtils.isBlank(patientName)){ + // 不传患者姓名则根据住院号查询患者信息 + PatientInfoVO patient = null; + if(StringUtils.isNotBlank(hospitalNumber)){ + if(findPatientInfoByHospitalNumDao != null){ + PatientInfoVO[] patientInfoVOs = findPatientInfoByHospitalNumDao.findPatientInfoByHospitalNum(hospitalNumber); + if(patientInfoVOs != null && patientInfoVOs.length > 0){ + patient = patientInfoVOs[0]; + } } + if (patient == null) { + throw new RuntimeException("患者消毒物料使用登记失败 :未找到住院号为" + hospitalNumber + "的患者信息"); + } + }else{ + if(findPatientInfoByTreatmentNumDao != null){ + PatientInfoVO[] patientInfoVOs = findPatientInfoByTreatmentNumDao.findPatientInfoByTreatmentNum(treatmentNum); + if(patientInfoVOs != null && patientInfoVOs.length > 0){ + patient = patientInfoVOs[0]; + } + } + if (patient == null) { + throw new RuntimeException("患者消毒物料使用登记失败 :未找到诊疗号为" + treatmentNum + "的患者信息"); + } } - if (patient == null) { - throw new RuntimeException("患者消毒物料使用登记失败 :未找到住院号为" + hospitalNumber + "的患者信息"); + + if(StringUtils.isNotBlank(patient.getHospitalNumber())){ + newUseRecord.setHospitalNum(patient.getHospitalNumber()); + }else{ + newUseRecord.setHospitalNum(patient.getPatientNumber()); } + newUseRecord.setTreatmentNum(patient.getClinicNumber()); + newUseRecord.setPatientName(patient.getPatientName()); + newUseRecord.setPatientAge(patient.getPatientAge()); + newUseRecord.setPatientSex(patient.getPatientSex()); + newUseRecord.setPatientIDCard(patient.getPatientIDCard()); + newUseRecord.setDoctorName(patient.getDoctorName()); + newUseRecord.setOperation(patient.getOperation()); + newUseRecord.setOperationRoom(patient.getOpRoomId()); + newUseRecord.setPatientArea(patient.getPatientArea()); + newUseRecord.setRoomNumber(patient.getRoomNumber()); + newUseRecord.setBedNumber(patient.getBedNumber()); + newUseRecord.setAscriptionDepartment(patient.getAscriptionDepartment()); + newUseRecord.setVisitId(patient.getVisitId()); + newUseRecord.setWashHandNurse(patient.getWashHandNurse()); + newUseRecord.setCircuitNurse(patient.getCircuitNurse()); + newUseRecord.setSpecialInfection(patient.getSpecialInfection()); + //newUseRecord.setOperationScheduleId(patient.getOperationScheduleId()); }else{ - if(findPatientInfoByTreatmentNumDao != null){ - PatientInfoVO[] patientInfoVOs = findPatientInfoByTreatmentNumDao.findPatientInfoByTreatmentNum(treatmentNum); - if(patientInfoVOs != null && patientInfoVOs.length > 0){ - patient = patientInfoVOs[0]; - } + newUseRecord.setHospitalNum(hospitalNumber); + newUseRecord.setTreatmentNum(treatmentNum); + newUseRecord.setPatientName(patientName); + newUseRecord.setPatientAge(processDataByXpath(document, null, patientAgeXpath)); + newUseRecord.setPatientSex(processDataByXpath(document, null, patientSexXpath)); + newUseRecord.setPatientIDCard(processDataByXpath(document, null, patientIDCardXpath)); + newUseRecord.setDoctorName(processDataByXpath(document, null, doctorNameXpath)); + newUseRecord.setOperation(processDataByXpath(document, null, operationXpath)); + newUseRecord.setOperationRoom(processDataByXpath(document, null, operationRoomXpath)); + newUseRecord.setPatientArea(processDataByXpath(document, null, patientAreaXpath)); + newUseRecord.setRoomNumber(processDataByXpath(document, null, roomNumberXpath)); + newUseRecord.setBedNumber(processDataByXpath(document, null, bedNumberXpath)); + newUseRecord.setAscriptionDepartment(processDataByXpath(document, null, ascriptionDepartmentXpath)); + String visitId = processDataByXpath(document, null, visitIdXpath); + if(!DatabaseUtil.isPoIdValid(visitId)){ + visitId = "0"; } - if (patient == null) { - throw new RuntimeException("患者消毒物料使用登记失败 :未找到诊疗号为" + treatmentNum + "的患者信息"); - } + newUseRecord.setVisitId(Long.parseLong(visitId)); + newUseRecord.setWashHandNurse(processDataByXpath(document, null, washHandNurseXpath)); + newUseRecord.setCircuitNurse(processDataByXpath(document, null, circuitNurseXpath)); + newUseRecord.setOperationScheduleId(processDataByXpath(document, null, operationScheduleIdXpath)); } - if(StringUtils.isNotBlank(patient.getHospitalNumber())){ - newUseRecord.setHospitalNum(patient.getHospitalNumber()); - }else{ - newUseRecord.setHospitalNum(patient.getPatientNumber()); + if(StringUtils.isNotBlank(operationTimeStr)){ + newUseRecord.setOperationTime(DateTools.coverStrToDate(operationTimeStr, "yyyyMMddHHmmss")); } - newUseRecord.setTreatmentNum(patient.getClinicNumber()); - newUseRecord.setPatientName(patient.getPatientName()); - newUseRecord.setPatientAge(patient.getPatientAge()); - newUseRecord.setPatientSex(patient.getPatientSex()); - newUseRecord.setPatientIDCard(patient.getPatientIDCard()); - newUseRecord.setDoctorName(patient.getDoctorName()); - newUseRecord.setOperation(patient.getOperation()); - newUseRecord.setOperationRoom(patient.getOpRoomId()); - newUseRecord.setPatientArea(patient.getPatientArea()); - newUseRecord.setRoomNumber(patient.getRoomNumber()); - newUseRecord.setBedNumber(patient.getBedNumber()); - newUseRecord.setAscriptionDepartment(patient.getAscriptionDepartment()); - newUseRecord.setVisitId(patient.getVisitId()); - newUseRecord.setWashHandNurse(patient.getWashHandNurse()); - newUseRecord.setCircuitNurse(patient.getCircuitNurse()); - newUseRecord.setSpecialInfection(patient.getSpecialInfection()); - //newUseRecord.setOperationScheduleId(patient.getOperationScheduleId()); + + newUseRecord.setDepart(depart); + newUseRecord.setDepartCoding(departCoding); + newUseRecord.setEnteringDate(operTime); + // 登记人 + newUseRecord.setOperator(operator); + // 录入时间 + newUseRecord.setEnteringDate(operTime); + // 特殊感染类型 + newUseRecord.setSpecialInfection(specialInfection); + newUseRecord.setRemark(remark); + newUseRecord.setOperationStatus(operationStatus); }else{ - newUseRecord.setHospitalNum(hospitalNumber); - newUseRecord.setTreatmentNum(treatmentNum); - newUseRecord.setPatientName(patientName); - newUseRecord.setPatientAge(processDataByXpath(document, null, patientAgeXpath)); - newUseRecord.setPatientSex(processDataByXpath(document, null, patientSexXpath)); - newUseRecord.setPatientIDCard(processDataByXpath(document, null, patientIDCardXpath)); - newUseRecord.setDoctorName(processDataByXpath(document, null, doctorNameXpath)); - newUseRecord.setOperation(processDataByXpath(document, null, operationXpath)); - newUseRecord.setOperationRoom(processDataByXpath(document, null, operationRoomXpath)); - newUseRecord.setPatientArea(processDataByXpath(document, null, patientAreaXpath)); - newUseRecord.setRoomNumber(processDataByXpath(document, null, roomNumberXpath)); - newUseRecord.setBedNumber(processDataByXpath(document, null, bedNumberXpath)); - newUseRecord.setAscriptionDepartment(processDataByXpath(document, null, ascriptionDepartmentXpath)); - String visitId = processDataByXpath(document, null, visitIdXpath); - if(!DatabaseUtil.isPoIdValid(visitId)){ - visitId = "0"; - } - newUseRecord.setVisitId(Long.parseLong(visitId)); - newUseRecord.setWashHandNurse(processDataByXpath(document, null, washHandNurseXpath)); - newUseRecord.setCircuitNurse(processDataByXpath(document, null, circuitNurseXpath)); - newUseRecord.setOperationScheduleId(processDataByXpath(document, null, operationScheduleIdXpath)); + // 修改记录录入时间 + newUseRecord.setEnteringDate(operTime); + newUseRecord.setOperationStatus(operationStatus); } - if(StringUtils.isNotBlank(operationTimeStr)){ - newUseRecord.setOperationTime(DateTools.coverStrToDate(operationTimeStr, "yyyyMMddHHmmss")); - } - - newUseRecord.setDepart(depart); - newUseRecord.setDepartCoding(departCoding); - newUseRecord.setEnteringDate(operTime); - // 登记人 - newUseRecord.setOperator(operator); - // 录入时间 - newUseRecord.setEnteringDate(operTime); - // 特殊感染类型 - newUseRecord.setSpecialInfection(specialInfection); - newUseRecord.setRemark(remark); - objectDao.saveOrUpdate(newUseRecord); if (CollectionUtils.isNotEmpty(tiList)) { @@ -506,7 +532,11 @@ } objectDao.batchSaveOrUpdate(tiList); String useRecordAuditMode = ConfigUtils.getSystemSetConfigByName("useRecordAuditMode", ""); - if(StringUtils.equals(useRecordAuditMode, "3")){ + if(StringUtils.equals(useRecordAuditMode, "3") + || StringUtils.equals(newUseRecord.getOperationStatus(), UseRecord.OPERATION_STATUS_END_OPERATION) + || StringUtils.equals(newUseRecord.getOperationStatus(), UseRecord.OPERATION_STATUS_OUT_OPERATIONROOM) + || StringUtils.equals(newUseRecord.getOperationStatus(), UseRecord.OPERATION_STATUS_END_ANESTHESIA)){ + // 手术状态为“手术结束”或者手术结束之后的状态的使用记录,也需要自动审核并生成申请单 String applicationFormType = ConfigUtils.getSystemSetConfigByName("applicationFormType", ""); String appType = InvoicePlan.TYPE_COMBO_FORM; if(StringUtils.equals(applicationFormType, "2")){ @@ -1458,4 +1488,43 @@ return null; } + /** + * 根据住院号、门诊号、手术时间查询使用记录(状态为“未审核”、手术状态不是“手术结束”的记录) + * @param hospitalNumber + * @param treatmentNum + * @param operationTimeStr + * @return + */ + private UseRecord getUnReviewUseRecord(String hospitalNumber, String treatmentNum, String operationTimeStr){ + if((StringUtils.isNotBlank(hospitalNumber) || StringUtils.isNotBlank(treatmentNum)) && StringUtils.isNotBlank(operationTimeStr)){ + String sql = String.format(" from %s po where (po.status = '%s' or po.status is null) " + + "and (po.operationStatus <> '%s')", + UseRecord.class.getSimpleName(), UseRecord.STATUS_UNAUDITED, UseRecord.OPERATION_STATUS_END_OPERATION); + if(StringUtils.isNotBlank(hospitalNumber)){ + sql += " and po.hospitalNum = '" + hospitalNumber + "' "; + } + if(StringUtils.isNotBlank(treatmentNum)){ + sql += " and po.treatmentNum = '" + treatmentNum + "' "; + } + if(StringUtils.isNotBlank(operationTimeStr)){ + Date operationTime = DateTools.coverStrToDate(operationTimeStr, "yyyyMMddHHmmss"); + sql += " and po.operationTime = " + dateQueryAdapter.stringToDate(operationTime); + } + + String hql = "select po " + sql + " order by po.id desc "; + + String countSql = "select count(*) " + sql; + + if(objectDao.countBySql(countSql) > 0){ + @SuppressWarnings("unchecked") + List useRecordList = objectDao.findByHql(hql); + if(CollectionUtils.isNotEmpty(useRecordList)){ + return useRecordList.get(0); + } + } + + } + return null; + } + } Index: ssts-web/src/main/webapp/disinfectsystem/config/xmsfybjy/spring/webservice-cxf.xml =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/config/xmsfybjy/spring/webservice-cxf.xml (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/config/xmsfybjy/spring/webservice-cxf.xml (revision 31649) @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file