diff --git a/src/main/java/com/ann/demo/interfaces/impl/HomepageDictionaryImpl.java b/src/main/java/com/ann/demo/interfaces/impl/HomepageDictionaryImpl.java index 17cdd75..f355554 100644 --- a/src/main/java/com/ann/demo/interfaces/impl/HomepageDictionaryImpl.java +++ b/src/main/java/com/ann/demo/interfaces/impl/HomepageDictionaryImpl.java @@ -17,9 +17,11 @@ import com.ann.demo.repository.MessageScanningRepository; import com.ann.demo.service.*; import com.ann.demo.utils.FileUtils; import com.ann.demo.utils.XMLUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import javax.jws.WebService; import java.io.IOException; @@ -60,18 +62,29 @@ public class HomepageDictionaryImpl implements HomepageDictionary { @Autowired private MessageScanningRepository messageScanningRepository; + private static String deptName; + + @Value("${dept.deptName}") + public void setDeptName(String deptName) { + HomepageDictionaryImpl.deptName = deptName; + } + + public static String getDeptName() { + return deptName; + } + @Override public String NurseData(String xmlStr) { String outContent = "失败"; try { // 1、定义变量 boolean flag = false; + boolean flagForFlag = true; Integer result = 0; String type = "", patientMainStr = null,remark = null,masterId = null; ArchiveMaster archiveMaster ; long startTime = System.currentTimeMillis(); Date xmlCreateTime = null; - MessageLog messageLog = new MessageLog(xmlStr, InterfaceName.NURSE_DATA, new Date(), WebserviceId.NURSE_DATA); messageService.save(messageLog); // 2、 解析 @@ -79,6 +92,44 @@ public class HomepageDictionaryImpl implements HomepageDictionary { if (messageDto != null) { archiveMaster = archiveMasterRepository.findByInpNoAndVisitIdAndIsValid(messageDto.getInpNo(),messageDto.getVisitId(),0); if(archiveMaster != null){ + //传进来的入院部门不为空,且配置文件配置了部门 + if(deptName!=null&&!"".equals(deptName)) { + //出院科室 + String deptNameOut=archiveMaster.getDeptName(); + //入院科室 + String deptAdmissionTo=archiveMaster.getDeptAdmissionTo(); + //多个部门 + ln: if (deptName.indexOf(",") != -1) { + String[] deptList = deptName.split(","); + for (int i = 0; i < deptList.length; i++) { + if(StringUtils.isNotBlank(deptAdmissionTo)) { + if (deptAdmissionTo.equals(deptList[i])) { + flagForFlag = false; + break ln; + } + } + if(StringUtils.isNotBlank(deptNameOut)) { + if (deptNameOut.equals(deptList[i])) { + flagForFlag = false; + break ln; + } + } + } + //单个部门 + } else { + if(StringUtils.isNotBlank(deptAdmissionTo)) { + if (deptNameOut.equals(deptName)) { + flagForFlag = false; + } + } + if(StringUtils.isNotBlank(deptNameOut)) { + if (deptAdmissionTo.equals(deptName)) { + flagForFlag = false; + } + } + } + + } masterId = archiveMaster.getId(); // 区分类型 String reportType = messageDto.getType(); @@ -173,6 +224,7 @@ public class HomepageDictionaryImpl implements HomepageDictionary { try { // 1、定义变量 boolean flag = false; + boolean flagForFlag =true; Integer result = 0; String type = "", patientMainStr = null,remark = null,masterId = null; ArchiveMaster archiveMaster ; @@ -185,6 +237,44 @@ public class HomepageDictionaryImpl implements HomepageDictionary { if (messageDto != null) { archiveMaster = archiveMasterRepository.findByInpNoAndVisitIdAndIsValid(messageDto.getInpNo(),messageDto.getVisitId(),0); if(archiveMaster != null) { + //传进来的入院部门不为空,且配置文件配置了部门 + if(deptName!=null&&!"".equals(deptName)) { + //出院科室 + String deptNameOut=archiveMaster.getDeptName(); + //入院科室 + String deptAdmissionTo=archiveMaster.getDeptAdmissionTo(); + //多个部门 + ln: if (deptName.indexOf(",") != -1) { + String[] deptList = deptName.split(","); + for (int i = 0; i < deptList.length; i++) { + if(StringUtils.isNotBlank(deptAdmissionTo)) { + if (deptAdmissionTo.equals(deptList[i])) { + flagForFlag = false; + break ln; + } + } + if(StringUtils.isNotBlank(deptNameOut)) { + if (deptNameOut.equals(deptList[i])) { + flagForFlag = false; + break ln; + } + } + } + //单个部门 + } else { + if(StringUtils.isNotBlank(deptAdmissionTo)) { + if (deptNameOut.equals(deptName)) { + flagForFlag = false; + } + } + if(StringUtils.isNotBlank(deptNameOut)) { + if (deptAdmissionTo.equals(deptName)) { + flagForFlag = false; + } + } + } + + } masterId = archiveMaster.getId(); // 区分类型 String reportType = messageDto.getType(); @@ -258,7 +348,7 @@ public class HomepageDictionaryImpl implements HomepageDictionary { long endTime = System.currentTimeMillis(); messageLog.setValue(masterId,outContent, result, messageDto == null ? "" : JSON.toJSONString(messageDto), xmlCreateTime, (endTime - startTime), new Date(), type,remark); messageService.save(messageLog); - if( remark == null && flag){ + if( remark == null && flag&&flagForFlag){ messageSubordinateService.save(new MessageSubordinate(messageLog.getId(), patientMainStr, JSON.toJSONString(messageLog))); } }catch (Exception e){