Index: ssts-web/src/main/webapp/disinfectsystem/config/fsfy/spring/webservice-cxf.xml
===================================================================
diff -u
--- ssts-web/src/main/webapp/disinfectsystem/config/fsfy/spring/webservice-cxf.xml (revision 0)
+++ ssts-web/src/main/webapp/disinfectsystem/config/fsfy/spring/webservice-cxf.xml (revision 32757)
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/CssdUseRecordServiceV4.java
===================================================================
diff -u
--- ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/CssdUseRecordServiceV4.java (revision 0)
+++ ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/CssdUseRecordServiceV4.java (revision 32757)
@@ -0,0 +1,18 @@
+package com.forgon.disinfectsystem.webservice.datasync.common;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+/**
+ * 消毒供应系统消毒包字典及使用记录接口,简化入参;增加器械包定义查询服务接口
+ * @author zhoupeimian
+ * @since 2021-11-23
+ */
+@WebService(serviceName="/CssdUseRecordServiceV4")
+public interface CssdUseRecordServiceV4 {
+
+ @WebMethod(action = "CssdUseRecordServiceV4", operationName="CssdUseRecordServiceV4")
+ public String CssdUseRecordService(@WebParam(name="message") String message);
+
+}
Index: ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImplV2.java
===================================================================
diff -u -r31689 -r32757
--- ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImplV2.java (.../HIPMessageWebServiceImplV2.java) (revision 31689)
+++ ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImplV2.java (.../HIPMessageWebServiceImplV2.java) (revision 32757)
@@ -26,7 +26,6 @@
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;
@@ -498,7 +497,6 @@
tousseInstance.setDamageRemark(damageRemarkMap.get(tousseInstance.getBarcode()));
}
}
- objectDao.batchSaveOrUpdate(tiList);
String useRecordAuditMode = ConfigUtils.getSystemSetConfigByName("useRecordAuditMode", "");
// useRecordAuditMode = 3, 或者,手术状态”这个字段的值为“手术结束”时把单据改成已申请的状态,并且自动生成一张通用申请单
if(StringUtils.equals(useRecordAuditMode, "3")
Index: ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/CssdUseRecordServiceV4Impl.java
===================================================================
diff -u
--- ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/CssdUseRecordServiceV4Impl.java (revision 0)
+++ ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/CssdUseRecordServiceV4Impl.java (revision 32757)
@@ -0,0 +1,941 @@
+package com.forgon.disinfectsystem.webservice.datasync.common;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Node;
+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.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.datasynchronization.dao.FindPatientInfoByHospitalNumDao;
+import com.forgon.disinfectsystem.datasynchronization.dao.FindPatientInfoByTreatmentNumDao;
+import com.forgon.disinfectsystem.datasynchronization.model.PatientInfoVO;
+import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoods;
+import com.forgon.disinfectsystem.entity.basedatamanager.materialdefinition.MaterialDefinition;
+import com.forgon.disinfectsystem.entity.basedatamanager.materialinstance.MaterialInstance;
+import com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig;
+import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseDefinition;
+import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseInstance;
+import com.forgon.disinfectsystem.entity.basedatamanager.warehouse.WareHouse;
+import com.forgon.disinfectsystem.entity.invoicemanager.InvoicePlan;
+import com.forgon.disinfectsystem.entity.materialerrordamage.MaterialErrorDamageDetail;
+import com.forgon.disinfectsystem.entity.recyclingrecord.RecyclingItem;
+import com.forgon.disinfectsystem.entity.recyclingrecord.RecyclingRecord;
+import com.forgon.disinfectsystem.entity.urgent.UrgentLevel;
+import com.forgon.disinfectsystem.entity.useRecord.UseRecord;
+import com.forgon.disinfectsystem.tousse.toussedefinition.service.TousseDefinitionManager;
+import com.forgon.disinfectsystem.tousse.toussedefinition.service.TousseInstanceManager;
+import com.forgon.disinfectsystem.useRecord.service.UseRecordManager;
+import com.forgon.tools.date.DateTools;
+import com.forgon.tools.db.DatabaseUtil;
+import com.forgon.tools.hibernate.ObjectDao;
+import com.forgon.tools.util.ConfigUtils;
+import com.forgon.tools.util.SqlUtils;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+public class CssdUseRecordServiceV4Impl implements CssdUseRecordServiceV4 {
+
+ private static Logger logger = Logger.getLogger(CssdUseRecordServiceV4Impl.class);
+
+ @Autowired
+ private TousseInstanceManager tousseInstanceManager;
+ @Autowired
+ private BarcodeManager barcodeManager;
+ @Autowired
+ private ObjectDao objectDao;
+ @Autowired
+ private UseRecordManager useRecordManager;
+ @Autowired
+ private WareHouseManager wareHouseManager;
+ @Autowired(required=false)
+ private FindPatientInfoByHospitalNumDao findPatientInfoByHospitalNumDao;
+ @Autowired(required=false)
+ private FindPatientInfoByTreatmentNumDao findPatientInfoByTreatmentNumDao;
+ @Autowired
+ private SupplyRoomConfigManager supplyRoomConfigManager;
+ @Autowired
+ private OrgUnitManager orgUnitManager;
+ @Autowired
+ private DateQueryAdapter dateQueryAdapter;
+ @Autowired
+ private TousseDefinitionManager tousseDefinitionManager;
+
+ /**
+ * 同步配置(取自各项目的参数名称配置文件fieldsMappingTalbe.json)
+ */
+ private JsonObject config;
+
+ public JsonObject getConfig() {
+ return config;
+ }
+
+ public void setConfig(JsonObject config) {
+ this.config = config;
+ }
+
+ @Override
+ public String CssdUseRecordService(String message) {
+ String result = "";
+ String action;
+ try {
+ action = getActionValue(message);
+ if ("INSTRUMENT_SET_USERECORD_REGISTRATION".equals(action)) {
+ result = this.useRecordRegister(action, message);
+ }else{
+ logger.info("action : " + action + "; message : " + message);
+ // retCode 为处理结果, 0 表示成功 1 表示失败
+ StringBuilder returnMsgSB = new StringBuilder();
+ returnMsgSB.append("");
+ returnMsgSB.append("");
+ returnMsgSB.append("1");
+ returnMsgSB.append("错误的action值:" + action + "");
+ returnMsgSB.append("");
+ returnMsgSB.append("");
+
+ String returnMsg = returnMsgSB.toString();
+ logger.info("returnMsg : " + returnMsg);
+ return returnMsg;
+ }
+
+ // 根据配置文件fieldsMappingTalbe.json设置参数名称
+ if(config != null){
+ Map fieldsMap = new HashMap();
+ fieldsMap = getFieldsMap(config);
+ result = setFieldNameByConfigMap(result, fieldsMap);
+ }
+ } catch (Exception e) {
+ result = buildReturnResult("1", "查询失败:" + e.getMessage(), "");
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ /**
+ * 3.4 病人手术所使用的器械包信息登记服务接口
+ * @param action
+ * @param message
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public String useRecordRegister(String action, String message) {
+ logger.info("TOUSSE_USERECORD_REGISTRATION ---> action : " + action + "; message : " + message);
+ // typeCode 为处理结果, 0 表示成功 1 表示失败
+ String typeCode = "1";
+ // 处理结果说明
+ String returnStr = "患者消毒物料使用登记失败";
+ try {
+ // 登记人姓名
+ String excutorXpath = "/REQUEST/MSG/REG_OPERATOR_NAME";
+ // 录入日期
+ String excutimeXpath = "/REQUEST/MSG/REG_DATETIME";
+ // 登记科室编码
+ String excutdeptnoXpath = "/REQUEST/MSG/REG_DEPT_CODE";
+ // 住院号
+ String inpatientnoXpath = "/REQUEST/MSG/INHOSP_INDEX_NO";
+ // 诊疗号
+ String treatmentNumXpath = "/REQUEST/MSG/OUTHOSP_INDEX_NO";
+ // 病人名称
+ String patientNameXpath = "/REQUEST/MSG/PATIENT_NAME";
+ // 病人年龄
+ String patientAgeXpath = "/REQUEST/MSG/PATIENT_AGE";
+ // 性别
+ String patientSexXpath = "/REQUEST/MSG/PATIENT_SEX";
+ // 身份证
+ String patientIDCardXpath = "/REQUEST/MSG/PATIENT_IDCARD";
+ // 手术单号
+ String operationScheduleIdXpath = "/REQUEST/MSG/SURGERY_APPLI_FORM_NO";
+ // 手术名称
+ 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";
+ // 洗手护士
+ String washHandNurseXpath = "/REQUEST/MSG/WASH_HAND_NURSE_NAME";
+ // 巡回护士
+ String circuitNurseXpath = "/REQUEST/MSG/CIRCUIT_NURSE_NAME";
+ // 手术间
+ String operationRoomXpath = "/REQUEST/MSG/OPERATION_ROOM";
+ // 病区
+ String patientAreaXpath = "/REQUEST/MSG/PATIENT_AREA";
+ // 病人所属科室名称
+ String ascriptionDepartmentXpath = "/REQUEST/MSG/ASCRIPTION_DEPART_NAME";
+ // 病房
+ String roomNumberXpath = "/REQUEST/MSG/ROOM_NUM";
+ // 床位
+ String bedNumberXpath = "/REQUEST/MSG/BED_NUM";
+ // 住院次数
+ String visitIdXpath = "/REQUEST/MSG/VISIT_NUM";
+ // 特殊感染类型
+ String specialInfectionXpath = "/REQUEST/MSG/SPECIAL_INFECTION";
+ // 备注
+ String remarkXpath = "/REQUEST/MSG/REMARK";
+
+ // 录入器械包条码集合,多个条码用;分割
+ String codeXpath = "/REQUEST/MSG/INSTRUMENT_SET_BARCODE";
+ // 录入器械包条码及加急等级、丢失报损情况节点路径
+ String goodsItemsXpath = "/REQUEST/MSG/GOODS_ITEMS/ITEM";
+
+ Document document = DocumentHelper.parseText(message);
+ // 器械包条码
+ String barcode = processDataByXpath(document, null, codeXpath);
+ // 患者住院号
+ String hospitalNumber = processDataByXpath(document, null, inpatientnoXpath);
+ String treatmentNum = processDataByXpath(document, null, treatmentNumXpath);
+ String operator = processDataByXpath(document, null, excutorXpath);
+ String operationTime = processDataByXpath(document, null, excutimeXpath);
+ Date operTime = DateTools.coverStrToDate(operationTime, "yyyyMMddHHmmss");
+ String departCoding = processDataByXpath(document, null, excutdeptnoXpath);
+ String specialInfection = processDataByXpath(document, null, specialInfectionXpath);
+ 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)){
+ throw new RuntimeException("住院号和诊疗号不能都为空!");
+ }
+ // 录入使用记录的科室编码不能都为空
+ if (StringUtils.isBlank(departCoding)) {
+ throw new RuntimeException("录入使用记录的科室编码不能为空!");
+ }
+ // 执行科室(登记使用记录的科室)
+ List orgUnitList = objectDao.findByProperty(OrgUnit.class.getSimpleName(), "orgUnitCoding", departCoding);
+ if(orgUnitList == null || CollectionUtils.isEmpty(orgUnitList)){
+ throw new RuntimeException("不存在科室编码REG_DEPT_CODE为:【" + departCoding + "】的科室!");
+ }
+ String depart = orgUnitList.get(0).getName();
+ OrgUnit operateDepart = orgUnitList.get(0);
+ // 结算科室
+ SupplyRoomConfig settleSupplyRoomConfig = supplyRoomConfigManager.getApplyDepartDefaultSettleDepart(operateDepart.getOrgUnitCoding());
+ if(settleSupplyRoomConfig == null){
+ settleSupplyRoomConfig = supplyRoomConfigManager.getSupplyRoomConfigByOrgUnitCodingAndType(operateDepart.getOrgUnitCoding(), SupplyRoomConfig.SUPPLYROOM_TYPE_SETTLEACCOUNT);
+ }
+ if(settleSupplyRoomConfig == null){
+ settleSupplyRoomConfig = supplyRoomConfigManager.getSupplyRoomConfigByOrgUnitCodingAndType(operateDepart.getOrgUnitCoding(), SupplyRoomConfig.SUPPLYROOM_TYPE_APPLY);
+ }
+
+
+ // 器械包条码集合
+ List tousseInsBarcodes = new ArrayList();
+
+ // 加急等级集合
+ Map tiBarcodeToUrgentLevelMap = new HashMap();
+ Map tiBarcodeToUrgentLevelIdMap = new HashMap();
+
+ // 丢失报损集合
+ Map> tiBarcodeToErrorDamageMap = new HashMap>();
+ // 丢失备注Map
+ Map errorRemarkMap = new HashMap();
+ // 报损备注Map
+ Map damageRemarkMap = new HashMap();
+
+
+ XPath xpath = document.createXPath(goodsItemsXpath);
+ List nodeList = xpath.selectNodes(document, xpath);
+
+ // 录入的器械包不能为空
+ if(StringUtils.isBlank(barcode) && CollectionUtils.isEmpty(nodeList)){
+ throw new RuntimeException("录入的器械包不能为空!");
+ }
+
+ if(CollectionUtils.isNotEmpty(nodeList)){
+ // 器械包需要加急或者丢失报损情况
+ for(int i=1;i<=nodeList.size();i++){
+ String itemsXpath = "/REQUEST/MSG/GOODS_ITEMS/ITEM[" + i + "]";
+ String barcodeXpath = itemsXpath + "/INSTRUMENT_SET_BARCODE";
+ String urgentLevelIdXpath = itemsXpath + "/URGENT_LEVEL_ID";
+ String errorRemarkXpath = itemsXpath + "/ERROR_DAMAGE_LIST/ERROR_DAMAGE/ERROR_REMARK";
+ String damageRemarkXpath = itemsXpath + "/ERROR_DAMAGE_LIST/ERROR_DAMAGE/DAMAGE_REMARK";
+ //String urgentLevelNameXpath = itemsXpath + "/urgentLevelName";
+ String tiBarcode = processDataByXpath(document, null, barcodeXpath);
+ tousseInsBarcodes.add(tiBarcode);
+ // 加急的
+ String urgentLevelId = processDataByXpath(document, null, urgentLevelIdXpath);
+ if(DatabaseUtil.isPoIdValid(urgentLevelId)){
+ //String urgentLevelName = processDataByXpath(document, null, urgentLevelNameXpath);
+ tiBarcodeToUrgentLevelIdMap.put(tiBarcode, Long.parseLong(urgentLevelId));
+ }
+ // 丢失报损的
+ String errorDamageXpath = itemsXpath + "/ERROR_DAMAGE_LIST/ERROR_DAMAGE";
+ XPath xpath1 = document.createXPath(errorDamageXpath);
+ List nodeList1 = xpath1.selectNodes(document, xpath1);
+ if(CollectionUtils.isNotEmpty(nodeList1)){
+ String errorRemark = processDataByXpath(document, null, errorRemarkXpath);
+ String damageRemark = processDataByXpath(document, null, damageRemarkXpath);
+ // 器械包实例记丢失备注和报损备注
+ errorRemarkMap.put(tiBarcode, errorRemark);
+ damageRemarkMap.put(tiBarcode, damageRemark);
+ List materialErrorDamageList = new ArrayList();
+ for(int j=1;j<=nodeList1.size();j++){
+ String errorDamageItemXpath = itemsXpath + "/ERROR_DAMAGE_LIST/ERROR_DAMAGE[" + j + "]";
+ String errorDamageTypeXpath = errorDamageItemXpath + "/ERROR_DAMAGE_TYPE";
+ String materialDefinitionIdXpath = errorDamageItemXpath + "/MATERIAL_DEFINITION_ID";
+ String materialDefinitionNameXpath = errorDamageItemXpath + "/MATERIAL_DEFINITION_NAME";
+ String materialDefinitionSpecificationXpath = errorDamageItemXpath + "/MATERIAL_DEFINITION_SPEC";
+ String amountXpath = errorDamageItemXpath + "/AMOUNT";
+
+ String type = processDataByXpath(document, null, errorDamageTypeXpath);
+ String errorAmountStr = processDataByXpath(document, null, amountXpath);
+ if(!DatabaseUtil.isPoIdValid(errorAmountStr)){
+ throw new RuntimeException("丢失报损数量无效!" + errorAmountStr);
+ }
+ Integer errorAmount = Integer.parseInt(errorAmountStr);
+ if(errorAmount.intValue() <= 0){
+ throw new RuntimeException("丢失报损数量无效!" + errorAmountStr);
+ }
+ Long materialDefinitionId = null;
+ String materialDefinitionIdStr = processDataByXpath(document, null, materialDefinitionIdXpath);
+ String materialDefinitionName = processDataByXpath(document, null, materialDefinitionNameXpath);
+ String materialDefinitionSpecification = processDataByXpath(document, null, materialDefinitionSpecificationXpath);
+ MaterialDefinition materialDefinition = null;
+ if(DatabaseUtil.isPoIdValid(materialDefinitionIdStr.trim())){
+ materialDefinitionId = Long.parseLong(materialDefinitionIdStr);
+ materialDefinition = (MaterialDefinition) objectDao.getById(MaterialDefinition.class.getSimpleName(), materialDefinitionId);
+ }
+ // 根据id查找不到材料定义
+ if(materialDefinition == null){
+ String mdHql = String.format("select po from %s po where po.name = '%s' and po.specification = '%s'",
+ MaterialDefinition.class.getSimpleName(), materialDefinitionName, materialDefinitionSpecification);
+ if(StringUtils.isBlank(materialDefinitionSpecification)){
+ // 材料规格可能为null或者空字符串
+ mdHql = String.format("select po from %s po where po.name = '%s' and (po.specification = '' or po.specification is null)",
+ MaterialDefinition.class.getSimpleName(), materialDefinitionName);
+ }
+ List mdList = objectDao.findByHql(mdHql);
+ if(CollectionUtils.isEmpty(mdList)){
+ throw new RuntimeException("找不到" + materialDefinitionName + "[" + materialDefinitionSpecification + "]的材料!");
+ }else{
+ materialDefinition = mdList.get(0);
+ }
+ }
+
+ MaterialErrorDamageDetail detail = new MaterialErrorDamageDetail();
+ detail.setMaterialDefinitionId(materialDefinition.getId());
+ if(StringUtils.equals(type, "丢失")){
+ detail.setType(MaterialErrorDamageDetail.TYPE_ERROR);
+ }else if(StringUtils.equals(type, "报损")){
+ detail.setType(MaterialErrorDamageDetail.TYPE_DAMAGE);
+ }else{
+ throw new RuntimeException("丢失报损类型,可选值为丢失或报损!");
+ }
+ detail.setIsUnionToussInstance(true);
+ detail.setLinkType(MaterialErrorDamageDetail.LINKTYPE_USERECORD);
+ if(MaterialErrorDamageDetail.TYPE_ERROR.equals(detail.getType())){
+ detail.setErrorType(MaterialErrorDamageDetail.ERRORTYPE_REDUCE);
+ }
+ detail.setMaterialName(materialDefinition.getName());
+ detail.setIsUnionToussInstance(true);
+ detail.setDepart(operateDepart.getName());
+ detail.setDepartCode(operateDepart.getOrgUnitCoding());
+ detail.setSettleAccountsDepart(settleSupplyRoomConfig.getOrgUnitName());
+ detail.setSettleAccountsDepartCoding(settleSupplyRoomConfig.getOrgUnitCoding());
+ detail.setDepartCodeForId(operateDepart.getOrgUnitCoding());
+ detail.setOperationTime(operTime);
+ detail.setOperator(operator);
+
+ detail.setAmount(errorAmount);
+ materialErrorDamageList.add(detail);
+
+ }
+ tiBarcodeToErrorDamageMap.put(tiBarcode, materialErrorDamageList);
+ }
+
+ }
+ if(MapUtils.isNotEmpty(tiBarcodeToUrgentLevelIdMap)){
+ String hql = String.format("select po from %s po where %s ", UrgentLevel.class.getSimpleName(), SqlUtils.getNonStringFieldInLargeCollectionsPredicate("po.id", tiBarcodeToUrgentLevelIdMap.values()));
+ List urgentLevelList = objectDao.findByHql(hql);
+ if(CollectionUtils.isNotEmpty(urgentLevelList)){
+ Map idToUrgentLevelMap = new HashMap();
+ for (UrgentLevel urgentLevel : urgentLevelList) {
+ idToUrgentLevelMap.put(urgentLevel.getId(), urgentLevel);
+ }
+ for (String tiBarcode : tiBarcodeToUrgentLevelIdMap.keySet()) {
+ Long urgentLevelId = tiBarcodeToUrgentLevelIdMap.get(tiBarcode);
+ tiBarcodeToUrgentLevelMap.put(tiBarcode, idToUrgentLevelMap.get(urgentLevelId));
+ }
+ }
+ }
+ }else{
+ // 器械包不需要加急或者丢失报损情况
+ String[] barcodes = barcode.split(";");
+ tousseInsBarcodes = Arrays.asList(barcodes);
+ }
+
+ List tiList = new ArrayList();
+ // 1、查询器械包实例
+ if(CollectionUtils.isNotEmpty(tousseInsBarcodes)){
+ for (String code : tousseInsBarcodes) {
+ BarcodeDevice bd = barcodeManager.getBarcodeByBarcode(code);
+ if (bd instanceof TousseInstance) {
+ // 1、查询器械包实例
+ TousseInstance tousseInstance = (TousseInstance) bd;
+ if(!StringUtils.equals(TousseInstance.STATUS_SHIPPED, tousseInstance.getStatus())
+ && !StringUtils.equals(TousseInstance.STATUS_SIGNED, tousseInstance.getStatus())){
+ throw new RuntimeException("使用记录登记失败 :器械包条码为" + bd.getBarcode() + "的器械包为“" + tousseInstance.getStatus() + "”状态,请录入“已发货”或“已签收”的器械包");
+ }
+ if(StringUtils.isNotBlank(tousseInstance.getLocation2()) && !StringUtils.equals(tousseInstance.getLocation2(), departCoding)){
+ throw new RuntimeException("使用记录登记失败 :器械包条码为" + bd.getBarcode() + "的器械包所在科室为" + tousseInstance.getLocationForDisplay2());
+ }else if(!StringUtils.equals(tousseInstance.getLocation(), departCoding)){
+ throw new RuntimeException("使用记录登记失败 :器械包条码为" + bd.getBarcode() + "的器械包所在科室为" + tousseInstance.getLocationForDisplay());
+ }
+ tiList.add(tousseInstance);
+ } else {
+ throw new RuntimeException(code + "不是器械包条码");
+ }
+ }
+ }
+
+ // 检查器械包是否包含丢失报损的材料
+ tousseIncludeMaterial(tiList, tiBarcodeToErrorDamageMap);
+
+ // 查找同一场手术的未审核的使用记录
+ UseRecord newUseRecord = getUnReviewUseRecord(hospitalNumber, treatmentNum, operationTimeStr);
+
+ if(newUseRecord == null){
+ // 2、创建使用记录
+ newUseRecord = new UseRecord();
+ // 患者姓名
+ 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(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{
+ 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));
+ }
+
+ 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);
+ newUseRecord.setOperationStatus(operationStatus);
+ }else{
+ // 修改记录录入时间
+ newUseRecord.setEnteringDate(operTime);
+ newUseRecord.setOperationStatus(operationStatus);
+ }
+ objectDao.saveOrUpdate(newUseRecord);
+
+ if (CollectionUtils.isNotEmpty(tiList)) {
+ //科室的默认仓库
+ WareHouse warehouse = wareHouseManager.getDefaultWareHouseByUnitCode(departCoding);
+ for (TousseInstance tousseInstance : tiList) {
+ tousseInstance.setUseRecord_id(newUseRecord.getId());
+ //录入使用记录后,更新位置(此方法一定要放在tousseInstance.setUseRecord_id方法后面调用)
+ tousseInstance.resetLocationInfoAndWarehouseForUseRecord(newUseRecord,null,warehouse);
+ tousseInstance.setStatus(TousseInstance.STATUS_USED);
+ tousseInstance.setPatientName(newUseRecord.getPatientName());
+ tousseInstance.setDoctorName(newUseRecord.getDoctorName());
+ tousseInstance.setUseTime(operTime);
+ if(MapUtils.isNotEmpty(tiBarcodeToUrgentLevelMap)){
+ // 加急级别
+ tousseInstance.setUrgentLevelForUseRecord(tiBarcodeToUrgentLevelMap.get(tousseInstance.getBarcode()));
+ }
+ if(MapUtils.isNotEmpty(errorRemarkMap)){
+ // 丢失备注
+ tousseInstance.setErrorRemark(errorRemarkMap.get(tousseInstance.getBarcode()));
+ }
+ if(MapUtils.isNotEmpty(damageRemarkMap)){
+ // 报损备注
+ tousseInstance.setDamageRemark(damageRemarkMap.get(tousseInstance.getBarcode()));
+ }
+ }
+ // 手术状态为“手术结束”或者手术结束之后的状态的使用记录,也需要自动审核并生成申请单
+ boolean isOperationEndStatus = (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));
+ if(isOperationEndStatus){
+ String applicationFormType = ConfigUtils.getSystemSetConfigByName("applicationFormType", "");
+ String appType = InvoicePlan.TYPE_COMBO_FORM;
+ if(StringUtils.equals(applicationFormType, "2")){
+ appType = InvoicePlan.TYPE_TOUSSE_APPLICATION_FORM;
+ }
+ // 审核人
+ newUseRecord.setReviewer(operator);
+ // 审核时间
+ newUseRecord.setReviewTime(operTime);
+ newUseRecord.setApplicationTime(operTime);
+ // 使用记录转申请单
+ useRecordManager.saveAndReviewAndConvertUseRecordForm_TRANS_REQUIRED(
+ newUseRecord, operator, depart, departCoding,
+ operTime, appType,
+ operator, operator);
+ }else{
+ useRecordManager.saveUseRecord_TRANS_REQUIRED(newUseRecord);
+ }
+
+ // 设置丢失报损
+ for (TousseInstance tousseInstance : tiList) {
+ TousseDefinition tousseDefinition = tousseInstance.getTousseDefinition();
+ if(MapUtils.isNotEmpty(tiBarcodeToErrorDamageMap)){
+ if(!(StringUtils.equals(tousseDefinition.getTousseType(), TousseDefinition.PACKAGE_TYPE_CUSTOM)
+ || StringUtils.equals(tousseDefinition.getTousseType(), TousseDefinition.PACKAGE_TYPE_INSIDE))){
+ throw new RuntimeException(tousseDefinition.getTousseType() + "不需要丢失报损!");
+ }
+ // 丢失报损,自定义器械包和普通器械包科室登记丢失报损
+ List materialErrorDamageList = tiBarcodeToErrorDamageMap.get(tousseInstance.getBarcode());
+ if(CollectionUtils.isNotEmpty(materialErrorDamageList)){
+ setErrorDamageInfo(tousseInstance, tousseDefinition, materialErrorDamageList, newUseRecord);
+ }
+ }
+ }
+ if(newUseRecord != null && DatabaseUtil.isPoIdValid(newUseRecord.getId())){
+ typeCode = "0";
+ returnStr = "使用记录登记成功";
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ returnStr = e.getMessage();
+ }
+ StringBuilder returnMsg = new StringBuilder();
+ returnMsg.append("");
+ returnMsg.append("");
+ returnMsg.append("" + typeCode + "");
+ returnMsg.append("" + returnStr + "");
+ returnMsg.append("");
+ returnMsg.append("");
+ logger.info("TOUSSE_USERECORD_REGISTRATION ---> " + returnMsg.toString());
+
+ return returnMsg.toString();
+ }
+
+ /**
+ *
+
+ 0/1
+ 成功/失败
+
+
+ * @param retCode
+ * @param retDescription
+ * @param result
+ * @return
+ */
+ private String buildReturnResult(String retCode, String retDescription, String result){
+ StringBuffer returnMsgSB = new StringBuffer();
+ returnMsgSB.append("");
+ returnMsgSB.append("");
+ returnMsgSB.append("" + retCode + "");
+ returnMsgSB.append("" + retDescription + "");
+ returnMsgSB.append("");
+ if(StringUtils.isNotBlank(result)){
+ returnMsgSB.append(result);
+ }
+ returnMsgSB.append("");
+ logger.info("buildReturnMsg: " + returnMsgSB.toString());
+ return returnMsgSB.toString();
+ }
+
+ /**
+ * 检查器械包是否包含材料
+ * @param tiList
+ * @param tiBarcodeToErrorDamageMap
+ */
+ private void tousseIncludeMaterial(List tiList, Map> tiBarcodeToErrorDamageMap) {
+ if(MapUtils.isEmpty(tiBarcodeToErrorDamageMap) || CollectionUtils.isEmpty(tiList)){
+ return;
+ }
+ if(CollectionUtils.isNotEmpty(tiList)){
+ for (TousseInstance ti : tiList) {
+ List mdIdList = new ArrayList();
+ // 包定义材料id和数量的map
+ Map materialAmountMap = new HashMap();
+ String hql = String.format("select po from %s po where po.tousse.id = %s", MaterialInstance.class.getSimpleName(), ti.getTousseDefinition().getId());
+ @SuppressWarnings("unchecked")
+ List materialInstanceList = objectDao.findByHql(hql);
+ if(CollectionUtils.isNotEmpty(materialInstanceList)){
+ for (MaterialInstance materialInstance : materialInstanceList) {
+ mdIdList.add(materialInstance.getMaterialDefinitionId());
+ materialAmountMap.put(materialInstance.getMaterialDefinitionId(), materialInstance.getCount());
+ }
+ }
+ List list = tiBarcodeToErrorDamageMap.get(ti.getBarcode());
+ // 材料定义id和丢失报损数量的map
+ Map materialErrorDamageAmountMap = new HashMap();
+ Map materialNameMap = new HashMap();
+ for (MaterialErrorDamageDetail materialErrorDamageDetail : list) {
+ if(CollectionUtils.isEmpty(mdIdList) || !mdIdList.contains(materialErrorDamageDetail.getMaterialDefinitionId())){
+ throw new RuntimeException("条码为:" + ti.getBarcode() + "的器械包不包含材料:【" + materialErrorDamageDetail.getMaterialName() + "】");
+ }
+ Long materialDefinitionId = materialErrorDamageDetail.getMaterialDefinitionId();
+ Integer errorDamageAmount = materialErrorDamageAmountMap.get(materialDefinitionId);
+ if(errorDamageAmount == null){
+ errorDamageAmount = 0;
+ }
+ errorDamageAmount += materialErrorDamageDetail.getAmount();
+ materialErrorDamageAmountMap.put(materialDefinitionId, errorDamageAmount);
+ materialNameMap.put(materialDefinitionId, materialErrorDamageDetail.getMaterialName());
+ }
+
+ for (Long materialId : materialErrorDamageAmountMap.keySet()) {
+ Integer errorDamageAmount = materialErrorDamageAmountMap.get(materialId);
+ Integer materialAmount = materialAmountMap.get(materialId);
+ if(errorDamageAmount != null && materialAmount != null && errorDamageAmount.intValue() > materialAmount.intValue()){
+ throw new RuntimeException(materialNameMap.get(materialId) + "的丢失报损数量不能大于材料数量!材料数量为:" + materialAmount);
+ }
+ }
+
+ }
+ }
+ }
+
+ /**
+ * 设置丢失报损信息
+ * @param tousseInstance
+ * @param materialErrorDamageList
+ * @param newUseRecord
+ * @param errorRemark 丢失备注
+ * @param damageRemark 报损备注
+ */
+ private void setErrorDamageInfo(TousseInstance tousseInstance, TousseDefinition tousseDefinition,
+ List materialErrorDamageList, UseRecord newUseRecord) {
+ if(CollectionUtils.isEmpty(materialErrorDamageList) || tousseInstance == null){
+ return;
+ }
+ for (MaterialErrorDamageDetail materialErrorDamageDetail : materialErrorDamageList) {
+ String draftSql = String.format("where po.tousseInstanceId=%s and po.materialDefinitionId=%s and po.type='%s' and po.linkType='%s' and po.status=%s",
+ tousseInstance.getId(), materialErrorDamageDetail.getMaterialDefinitionId(),
+ materialErrorDamageDetail.getType(), MaterialErrorDamageDetail.LINKTYPE_USERECORD,
+ MaterialErrorDamageDetail.STATUS_TWO);
+ MaterialErrorDamageDetail detail = (MaterialErrorDamageDetail)objectDao.getBySql(MaterialErrorDamageDetail.class.getSimpleName(), draftSql);
+ RecyclingItem recyclingItem = null;
+ if(DatabaseUtil.isPoIdValid(tousseInstance.getRecyclingRecordId())){
+ RecyclingRecord recyclingRecord = (RecyclingRecord)objectDao.getById(RecyclingRecord.class.getSimpleName(), tousseInstance.getRecyclingRecordId());
+ String sql = String.format("select po from %s po where po.recyclingRecord.id=%s and po.tousseDefinitionId=%s ",
+ RecyclingItem.class.getSimpleName(),
+ recyclingRecord.getId(),
+ tousseInstance.getTousseDefinition().getId()
+ );
+ @SuppressWarnings("unchecked")
+ List list = objectDao.findByHql(sql);
+ if(CollectionUtils.isNotEmpty(list)){
+ recyclingItem = list.get(0);
+ }
+ }
+ if(detail == null){
+ detail = materialErrorDamageDetail;
+ }else{
+ detail.setAmount(materialErrorDamageDetail.getAmount());
+ }
+ if(recyclingItem != null){
+ String orgUnitCoding = recyclingItem.getRecyclingRecord().getOrgUnitCoding();
+ OrgUnit ou = (OrgUnit) orgUnitManager.getByCode(orgUnitCoding);
+ if(ou != null){
+ detail.setHandleDepartName(ou.getName());
+ }
+ detail.setHandleDepartCode(orgUnitCoding);
+ }
+ if(UseRecord.STATUS_UNAUDITED.equals(newUseRecord.getStatus())){
+ detail.setStatus(MaterialErrorDamageDetail.STATUS_TWO);
+ }
+ detail.setTousseBarcode(tousseInstance.getBarcode());
+ detail.setTousseDefinitionId(tousseInstance.getTousseDefinition().getId());
+ detail.setTousseInstanceId(tousseInstance.getId());
+ detail.setErrorRemark(tousseInstance.getErrorRemark());
+ detail.setDamageRemark(tousseInstance.getDamageRemark());
+ detail.setTousseName(tousseInstance.getTousseDefinitionName());
+ Integer additionalAmount = detail.getAdditionalAmount();
+ Integer errorAmount = detail.getAmount();
+ if(additionalAmount == null || errorAmount - additionalAmount > 0){
+ tousseInstance.setHaveUnSupplementMaterials(true);
+ }
+
+ Long currerntDetailId = detail.getId();
+ objectDao.saveOrUpdate(detail);
+ if(recyclingItem != null){
+ boolean isExist = CollectionUtils.exists(recyclingItem.getErrorDamageDetails(), new Predicate() {
+ @Override
+ public boolean evaluate(MaterialErrorDamageDetail mdetail) {
+ if (StringUtils.equals("" + mdetail.getId(), "" + currerntDetailId)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ });
+ if(!isExist){
+ recyclingItem.getErrorDamageDetails().add(detail);
+ }
+ }
+ }
+ }
+
+ /**
+ * 解析ACTION
+ * @param message
+ * @return
+ * @throws DocumentException
+ */
+ private String getActionValue(String message) throws Exception {
+ if (StringUtils.isBlank(message)) {
+ return "";
+ }
+ String action = "";
+ String barcodeXpath = "/REQUEST/ACTION";
+ Document document;
+ document = DocumentHelper.parseText(message);
+ action = processDataByXpath(document, null, barcodeXpath);
+ return action;
+ }
+
+ /**
+ * 构建材料定义的返回信息
+ * ...
+ * @param materialDefinitions
+ * @param disposableGoods
+ * @return
+ */
+ public String buildMaterialDefinitionXml(List materialDefinitions, List disposableGoods) {
+ if(CollectionUtils.isEmpty(materialDefinitions) && CollectionUtils.isEmpty(disposableGoods)){
+ StringBuffer result = new StringBuffer();
+ result.append("");
+ result.append("");
+ result.append("1");
+ result.append("失败,未找到对应信息");
+ result.append("");
+ result.append("");
+ return result.toString();
+ }
+ StringBuffer result = new StringBuffer();
+ result.append("");
+ result.append("");
+ result.append("0");
+ result.append("成功");
+ result.append("");
+ result.append("");
+ result.append("");
+ result.append("");
+ if(CollectionUtils.isNotEmpty(materialDefinitions)){
+ for (MaterialDefinition materialDefinition : materialDefinitions) {
+ result.append("");
+ result.append("" + materialDefinition.getId() + "");
+ result.append("" + StringUtils.defaultString(materialDefinition.getName()) + "");
+ result.append("" + StringUtils.defaultString(materialDefinition.getSpecification()) + "");
+ result.append("器械材料");
+ result.append("");
+ }
+ }
+ if(CollectionUtils.isNotEmpty(disposableGoods)){
+ for (DisposableGoods disposableGood : disposableGoods) {
+ result.append("");
+ result.append("" + disposableGood.getId() + "");
+ result.append("" + StringUtils.defaultString(disposableGood.getName()) + "");
+ result.append("" + StringUtils.defaultString(disposableGood.getSpecification()) + "");
+ result.append("一次性物品");
+ result.append("");
+ }
+ }
+ result.append("");
+ result.append("");
+ result.append("");
+ result.append("");
+ return result.toString();
+ }
+
+ /**
+ * 根据配置文件修改返回信息的字段名称
+ * @param result
+ * @param fieldsMap
+ * @return
+ */
+ private String setFieldNameByConfigMap(String result, Map fieldsMap) {
+ if(MapUtils.isNotEmpty(fieldsMap)){
+ for (String key : fieldsMap.keySet()) {
+ String value = fieldsMap.get(key);
+ if(StringUtils.isNotBlank(value)){
+ String xmlOrigLTField = "<" + key + ">";
+ String xmlOrigGTField = "" + key + ">";
+ String xmlNewLTField = "<" + value + ">";
+ String xmlNewGTField = "" + value + ">";
+ result = result.replaceAll(xmlOrigLTField, xmlNewLTField);
+ result = result.replaceAll(xmlOrigGTField, xmlNewGTField);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 获取参数名称映射关系
+ * @param configObject
+ * @return
+ */
+ private Map getFieldsMap(JsonObject configObject) {
+ Map fieldsMap = new HashMap();
+ JsonArray JsonArray = configObject.getAsJsonArray("fieldsMappingTalbe");
+ if(JsonArray != null){
+ for (JsonElement jsonElement : JsonArray) {
+ JsonObject jsonObj = (JsonObject) jsonElement;
+ String sstsFieldName = jsonObj.get("standardFieldName").getAsString();
+ String trdPartyFieldName = jsonObj.get("3rdPartyFieldName").getAsString();
+ fieldsMap.put(sstsFieldName, trdPartyFieldName);
+ }
+ }
+ return fieldsMap;
+ }
+
+ /**
+ * 根据document和Xpath表达式解析数据
+ * @param document
+ * @param nameSpaceURIMap
+ * @param xpathExp
+ * @return
+ */
+ private String processDataByXpath(Document document, Map nameSpaceURIMap, String xpathExp) {
+ if ((StringUtils.isNotBlank(xpathExp)) && (document != null)) {
+ XPath xpath = document.createXPath(xpathExp);
+ if (nameSpaceURIMap != null) {
+ xpath.setNamespaceURIs(nameSpaceURIMap);
+ }
+ Node node = xpath.selectSingleNode(document);
+ if (node != null) {
+ //return node.getStringValue();
+ String value = node.getStringValue();
+ if(value != null){
+ value = value.trim();
+ }
+ return value;
+ }
+ }
+ 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) ",
+ UseRecord.class.getSimpleName(), UseRecord.STATUS_UNAUDITED);
+ 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/fsfy/interfaces/fieldsMappingTalbe.json
===================================================================
diff -u
--- ssts-web/src/main/webapp/disinfectsystem/config/fsfy/interfaces/fieldsMappingTalbe.json (revision 0)
+++ ssts-web/src/main/webapp/disinfectsystem/config/fsfy/interfaces/fieldsMappingTalbe.json (revision 32757)
@@ -0,0 +1,3 @@
+{
+ "fieldsMappingTalbe":[]
+}
\ No newline at end of file
Index: ssts-web/src/main/webapp/disinfectsystem/config/szslgqdermyy/interfaces/fieldsMappingTalbe.json
===================================================================
diff -u
--- ssts-web/src/main/webapp/disinfectsystem/config/szslgqdermyy/interfaces/fieldsMappingTalbe.json (revision 0)
+++ ssts-web/src/main/webapp/disinfectsystem/config/szslgqdermyy/interfaces/fieldsMappingTalbe.json (revision 32757)
@@ -0,0 +1,3 @@
+{
+ "fieldsMappingTalbe":[]
+}
\ No newline at end of file
Index: ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/CssdMessageWebServiceV4Impl.java
===================================================================
diff -u -r32573 -r32757
--- ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/CssdMessageWebServiceV4Impl.java (.../CssdMessageWebServiceV4Impl.java) (revision 32573)
+++ ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/CssdMessageWebServiceV4Impl.java (.../CssdMessageWebServiceV4Impl.java) (revision 32757)
@@ -32,7 +32,6 @@
import com.forgon.disinfectsystem.datasynchronization.dao.FindPatientInfoByHospitalNumDao;
import com.forgon.disinfectsystem.datasynchronization.dao.FindPatientInfoByTreatmentNumDao;
import com.forgon.disinfectsystem.datasynchronization.model.PatientInfoVO;
-import com.forgon.disinfectsystem.datasynchronization.service.DataSynchronizationManager;
import com.forgon.disinfectsystem.entity.assestmanagement.DiposableGoodsInstance;
import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoods;
import com.forgon.disinfectsystem.entity.basedatamanager.materialdefinition.MaterialDefinition;
@@ -56,7 +55,6 @@
import com.forgon.disinfectsystem.entity.urgent.UrgentLevel;
import com.forgon.disinfectsystem.entity.useRecord.UseRecord;
import com.forgon.disinfectsystem.entity.washanddisinfectmanager.washanddisinfectrecord.WashAndDisinfectRecord;
-import com.forgon.disinfectsystem.operationreservation.service.OperationReservationManager;
import com.forgon.disinfectsystem.tousse.toussedefinition.service.TousseDefinitionManager;
import com.forgon.disinfectsystem.tousse.toussedefinition.service.TousseInstanceManager;
import com.forgon.disinfectsystem.useRecord.service.UseRecordManager;
@@ -76,10 +74,6 @@
private static Logger logger = Logger.getLogger(CssdMessageWebServiceV4Impl.class);
@Autowired
- private DataSynchronizationManager dataSynchronizationManager;
- @Autowired
- private OperationReservationManager operationReservationManager;
- @Autowired
private TousseInstanceManager tousseInstanceManager;
@Autowired
private BarcodeManager barcodeManager;
@@ -163,7 +157,7 @@
}
/**
- * 3.1 消毒包基础字典信息查询服务接口
+ * 3.1 器械包基础字典信息查询服务接口
* @param action
* @param message
* @return
@@ -194,14 +188,15 @@
TousseDefinition tousseDefinition = tousseInstance.getTousseDefinition();
if (tousseDefinition != null) {
retCode = "0";
- retDescription = "消毒物料明细查询成功";
+ retDescription = "成功";
String materialStr = buildMaterialXml(tousseDefinition);
StringBuilder returnStrSB = new StringBuilder();
returnStrSB.append("");
returnStrSB.append("");
returnStrSB.append("" + tousseInstance.getBarcode() + "");
returnStrSB.append("" + tousseDefinition.getId() + "");
returnStrSB.append("" + tousseInstance.getTousseName() + "");
+ returnStrSB.append("" + StringUtils.defaultString(tousseInstance.getStatus()) + "");
returnStrSB.append("" + (tousseInstance.getPrice() == null ? "" : tousseInstance.getPrice()) + "");
returnStrSB.append("" + StringUtils.defaultString(tousseInstance.getSterileEndTime()) + "");
returnStrSB.append("" + StringUtils.defaultString(tousseInstance.getValidUntilStr()) + "");
@@ -306,7 +301,7 @@
}
/**
- * 3.4 病人手术所使用的消毒包信息登记服务接口
+ * 3.4 病人手术所使用的器械包信息登记服务接口
* @param action
* @param message
* @return
@@ -317,7 +312,7 @@
// typeCode 为处理结果, 0 表示成功 1 表示失败
String typeCode = "1";
// 处理结果说明
- String returnStr = "患者消毒物料使用登记失败";
+ String returnStr = "使用记录登记失败";
try {
// 登记人姓名
String excutorXpath = "/REQUEST/MSG/REG_OPERATOR_NAME";
@@ -571,12 +566,12 @@
TousseInstance tousseInstance = (TousseInstance) bd;
if(!StringUtils.equals(TousseInstance.STATUS_SHIPPED, tousseInstance.getStatus())
&& !StringUtils.equals(TousseInstance.STATUS_SIGNED, tousseInstance.getStatus())){
- throw new RuntimeException("患者消毒物料使用登记失败 :器械包条码为" + bd.getBarcode() + "的器械包为“" + tousseInstance.getStatus() + "”状态,请录入“已发货”或“已签收”的器械包");
+ throw new RuntimeException("使用记录登记失败 :器械包条码为" + bd.getBarcode() + "的器械包为“" + tousseInstance.getStatus() + "”状态,请录入“已发货”或“已签收”的器械包");
}
if(StringUtils.isNotBlank(tousseInstance.getLocation2()) && !StringUtils.equals(tousseInstance.getLocation2(), departCoding)){
- throw new RuntimeException("患者消毒物料使用登记失败 :器械包条码为" + bd.getBarcode() + "的器械包所在科室为" + tousseInstance.getLocationForDisplay2());
+ throw new RuntimeException("使用记录登记失败 :器械包条码为" + bd.getBarcode() + "的器械包所在科室为" + tousseInstance.getLocationForDisplay2());
}else if(!StringUtils.equals(tousseInstance.getLocation(), departCoding)){
- throw new RuntimeException("患者消毒物料使用登记失败 :器械包条码为" + bd.getBarcode() + "的器械包所在科室为" + tousseInstance.getLocationForDisplay());
+ throw new RuntimeException("使用记录登记失败 :器械包条码为" + bd.getBarcode() + "的器械包所在科室为" + tousseInstance.getLocationForDisplay());
}
tiList.add(tousseInstance);
} else {
@@ -607,7 +602,7 @@
}
}
if (patient == null) {
- throw new RuntimeException("患者消毒物料使用登记失败 :未找到住院号为" + hospitalNumber + "的患者信息");
+ throw new RuntimeException("使用记录登记失败 :未找到住院号为" + hospitalNumber + "的患者信息");
}
}else{
if(findPatientInfoByTreatmentNumDao != null){
@@ -617,7 +612,7 @@
}
}
if (patient == null) {
- throw new RuntimeException("患者消毒物料使用登记失败 :未找到诊疗号为" + treatmentNum + "的患者信息");
+ throw new RuntimeException("使用记录登记失败 :未找到诊疗号为" + treatmentNum + "的患者信息");
}
}
@@ -714,12 +709,11 @@
tousseInstance.setDamageRemark(damageRemarkMap.get(tousseInstance.getBarcode()));
}
}
- objectDao.batchSaveOrUpdate(tiList);
- String useRecordAuditMode = ConfigUtils.getSystemSetConfigByName("useRecordAuditMode", "");
- if(StringUtils.equals(useRecordAuditMode, "3")
- || StringUtils.equals(newUseRecord.getOperationStatus(), UseRecord.OPERATION_STATUS_END_OPERATION)
+ // 手术状态为“手术结束”或者手术结束之后的状态的使用记录,自动审核并生成申请单
+ boolean isOperationEndStatus = (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)){
+ || StringUtils.equals(newUseRecord.getOperationStatus(), UseRecord.OPERATION_STATUS_END_ANESTHESIA));
+ if(isOperationEndStatus){
// 手术状态为“手术结束”或者手术结束之后的状态的使用记录,也需要自动审核并生成申请单
String applicationFormType = ConfigUtils.getSystemSetConfigByName("applicationFormType", "");
String appType = InvoicePlan.TYPE_COMBO_FORM;
@@ -757,7 +751,7 @@
}
if(newUseRecord != null && DatabaseUtil.isPoIdValid(newUseRecord.getId())){
typeCode = "0";
- returnStr = "患者消毒物料使用登记成功";
+ returnStr = "使用记录登记成功";
}
}
} catch (Exception e) {
@@ -777,7 +771,7 @@
}
/**
- * 医院质控管理需要按患者使用的消毒包条码,进行消毒供应处理步骤的追溯并显示相关信息接口
+ * 医院质控管理需要按患者使用的器械包条码,进行消毒供应处理步骤的追溯并显示相关信息接口
* @param action
* @param message
* @return
Index: ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImpl.java
===================================================================
diff -u -r30654 -r32757
--- ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImpl.java (.../HIPMessageWebServiceImpl.java) (revision 30654)
+++ ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImpl.java (.../HIPMessageWebServiceImpl.java) (revision 32757)
@@ -156,7 +156,6 @@
tousseInstance.setDoctorName(patient.getDoctorName());
tousseInstance.setUseTime(useRecord.getOperationTime());
}
- objectDao.batchSaveOrUpdate(tiList);
String useRecordAuditMode = ConfigUtils.getSystemSetConfigByName("useRecordAuditMode", "");
if(StringUtils.equals(useRecordAuditMode, "3")){
String applicationFormType = ConfigUtils.getSystemSetConfigByName("applicationFormType", "");
Index: ssts-web/src/main/webapp/disinfectsystem/config/szslgqdermyy/spring/webservice-cxf.xml
===================================================================
diff -u
--- ssts-web/src/main/webapp/disinfectsystem/config/szslgqdermyy/spring/webservice-cxf.xml (revision 0)
+++ ssts-web/src/main/webapp/disinfectsystem/config/szslgqdermyy/spring/webservice-cxf.xml (revision 32757)
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImplV3.java
===================================================================
diff -u -r31904 -r32757
--- ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImplV3.java (.../HIPMessageWebServiceImplV3.java) (revision 31904)
+++ ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/datasync/common/HIPMessageWebServiceImplV3.java (.../HIPMessageWebServiceImplV3.java) (revision 32757)
@@ -27,7 +27,6 @@
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;
@@ -521,7 +520,6 @@
tousseInstance.setDamageRemark(damageRemarkMap.get(tousseInstance.getBarcode()));
}
}
- objectDao.batchSaveOrUpdate(tiList);
String useRecordAuditMode = ConfigUtils.getSystemSetConfigByName("useRecordAuditMode", "");
if(StringUtils.equals(useRecordAuditMode, "3")
|| StringUtils.equals(newUseRecord.getOperationStatus(), UseRecord.OPERATION_STATUS_END_OPERATION)
@@ -921,6 +919,7 @@
List classifyBasketIdList = Arrays.asList(classifyBasketIdArr);
String classifyBasketHql = String.format("select po from %s po where %s", ClassifyBasket.class.getSimpleName(),
SqlUtils.getNonStringFieldInLargeCollectionsPredicate("po.id", classifyBasketIdList));
+ @SuppressWarnings("unchecked")
List classifyBasketList = objectDao.findByHql(classifyBasketHql);
if(CollectionUtils.isNotEmpty(classifyBasketList)){
List washAndDisinfectRecordList = new ArrayList();