为什么我的家庭查询失败?

Why Does My FAMILY Query Fail?

请看下面的代码,其中我有一个按姓氏搜索的方法和另一个按系统搜索的方法。在代码之后,我提供了调用这两种方法中的每一种方法所产生的结果。您可以看到系统搜索返回了三位患者,第三位患者的姓氏为 Vaessen。但是,当我搜索姓氏 Vaessen 时,结果超时。有人能帮我理解为什么会这样吗?

注意:从超时异常可以看出,我查询的是public fhir服务器http://fhirtest.uhn.ca/baseDstu3

public void findPatientsInFamily(String family) {
    System.out.printf("\n\nFinding patients in family %s\n", family);
    findPatients(Patient.FAMILY.matches().value(family));
}

public void findPatientsInSystem(String system) {
    System.out.printf("\n\nFinding patients in system %s\n", system);
    findPatients(Patient.IDENTIFIER.hasSystemWithAnyCode(system));
}

@SuppressWarnings("rawtypes")
public void findPatients(ICriterion criterion) {

    try {
        Bundle bundle = client.search().forResource(Patient.class).where(criterion).returnBundle(Bundle.class).execute();

        for (BundleEntryComponent entry : bundle.getEntry()) {
            if (entry.getResource().getResourceType() == ResourceType.Patient) {
                Patient patient = (Patient) entry.getResource();
                System.out.printf("%s\n", parser.encodeResourceToString(patient));
            }
        }
    }
    catch(Exception e) {
        System.out.printf("Cannot find patients\n%s\n", e.getMessage());
    }
}

findPatientsInSystem(String system) 方法的结果:

Finding patients in system http://dmw.levy.com/mrn
<Patient xmlns="http://hl7.org/fhir">
   <id value="4172808"></id>
   <meta>
      <versionId value="1"></versionId>
      <lastUpdated value="2018-06-07T14:10:52.336+00:00"></lastUpdated>
   </meta>
   <text>
      <status value="generated"></status>
      <div xmlns="http://www.w3.org/1999/xhtml">
         <div class="hapiHeaderText">Rachael 
            <b>LANEHART </b>
         </div>
         <table class="hapiPropertyTable">
            <tbody>
               <tr>
                  <td>Identifier</td>
                  <td>12345</td>
               </tr>
               <tr>
                  <td>Date of birth</td>
                  <td>
                     <span>30 December 1985</span>
                  </td>
               </tr>
            </tbody>
         </table>
      </div>
   </text>
   <identifier>
      <system value="http://dmw.levy.com/mrn"></system>
      <value value="12345"></value>
   </identifier>
   <name>
      <family value="Lanehart"></family>
      <given value="Rachael"></given>
   </name>
   <gender value="female"></gender>
   <birthDate value="1985-12-30"></birthDate>
</Patient>
<Patient xmlns="http://hl7.org/fhir">
   <id value="4149602"></id>
   <meta>
      <versionId value="1"></versionId>
      <lastUpdated value="2018-06-06T20:52:11.831+00:00"></lastUpdated>
   </meta>
   <text>
      <status value="generated"></status>
      <div xmlns="http://www.w3.org/1999/xhtml">
         <div class="hapiHeaderText">Ravi 
            <b>THAKKAR </b>
         </div>
         <table class="hapiPropertyTable">
            <tbody>
               <tr>
                  <td>Identifier</td>
                  <td>12345</td>
               </tr>
               <tr>
                  <td>Date of birth</td>
                  <td>
                     <span>14 April 1962</span>
                  </td>
               </tr>
            </tbody>
         </table>
      </div>
   </text>
   <identifier>
      <system value="http://dmw.levy.com/mrn"></system>
      <value value="12345"></value>
   </identifier>
   <name>
      <family value="Thakkar"></family>
      <given value="Ravi"></given>
   </name>
   <gender value="male"></gender>
   <birthDate value="1962-04-14"></birthDate>
</Patient>
<Patient xmlns="http://hl7.org/fhir">
   <id value="4013201"></id>
   <meta>
      <versionId value="1"></versionId>
      <lastUpdated value="2018-06-01T18:30:23.902+00:00"></lastUpdated>
   </meta>
   <text>
      <status value="generated"></status>
      <div xmlns="http://www.w3.org/1999/xhtml">
         <div class="hapiHeaderText">Robert Jozef 
            <b>VAESSEN </b>
         </div>
         <table class="hapiPropertyTable">
            <tbody>
               <tr>
                  <td>Identifier</td>
                  <td>12345</td>
               </tr>
               <tr>
                  <td>Date of birth</td>
                  <td>
                     <span>30 January 1954</span>
                  </td>
               </tr>
            </tbody>
         </table>
      </div>
   </text>
   <identifier>
      <system value="http://dmw.levy.com/mrn"></system>
      <value value="12345"></value>
   </identifier>
   <name>
      <family value="Vaessen"></family>
      <given value="Robert"></given>
      <given value="Jozef"></given>
   </name>
   <gender value="male"></gender>
   <birthDate value="1954-01-30"></birthDate>
</Patient>

findPatientsInFamily(String family) 方法的结果:

Finding patients in family Vaessen
Cannot find patients
Failed to parse response from server when performing GET to URL http://fhirtest.uhn.ca/baseDstu3/Patient?family=Vaessen - java.net.SocketTimeoutException: Read timed out

您的代码查询 FHIR 服务器的方式应该适合按系统或姓氏搜索患者。

我在 http://fhirtest.uhn.ca/ and everything appears to be down currently. Every request returns an error. There is already an issue posted here on GIT https://github.com/jamesagnew/hapi-fhir/issues/998 通过 UI 尝试了 public 测试服务器。

也有可能是服务器备份的时候,患者数据太多,导致你的请求还是会报错,除非设置一个大的连接超时时间,或者提供更多的过滤条件。