我收到以下Web服务响应,我正在尝试使用下面的代码打开 Id ,该ID在我的前端与n个 RefCode 相关联但它不是循环的。如您所见,当我选择63caa566-ed9e-4489-94f9-74cc3d75d9d3时,我期望有4个与4个RefCode相关的结果,而当我选择另一个53be6dfd-2ae8-4dd1-b9e5-33e78e2a2821时,我希望显示2个结果。我的代码如下:
`for each (patient in response.Patients.Patient) {
var pid=patient.Id;
webService=webServiceFactory.createWebService('http://servername/Services/Patients/' + pid + '/Episodes?format=xml');
webService.setValidHostnamePattern('http://acthdevmedchart.dev.act.gov.au');
webService.setMethod("GET");
webService.addHttpHeader('Accept','application/xml');
response=webService.call(null);
for each (episode in response.Episodes.Episode) {
var epid= episode.Id;
for each (admission in response.episode.Admissions.Admission) {
if (admission.RefCode == '51576222') {
give me all the results for that RefCode }`
我编写上面代码的XML响应如下:
<PatientsResponse
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.datacontract.org/2004/07/iSOFT.MedicationManagement.Models.Patients">
<Next
xmlns:d2p1="http://schemas.datacontract.org/2004/07/iSOFT.MedicationManagement.Models.Common">
<d2p1:Href>~/Patients?ExternalId=20350227&Skip=1&Take=25</d2p1:Href>
<d2p1:Rel>~/Relationships/Collections-Succeding-Subset</d2p1:Rel>
</Next>
<Patients>
<Patient>
<Addresses>
<Address>
123 street
</Address>
<Address>
Country
</Address>
</Addresses>
<AllergyInfoKnown>1</AllergyInfoKnown>
<AllergyStatus>Allergies Known and Recorded</AllergyStatus>
<Dob>1956-02-02T00:00:00</Dob>
<Episodes>
<Episode>
<Admissions>
<Admission>
<ClosedOn i:nil="true"/>
<RefCode>51576227</RefCode>
</Admission>
<Admission>
<ClosedOn>2018-07-17T11:11:00</ClosedOn>
<RefCode>51576224</RefCode>
</Admission>
<Admission>
<ClosedOn>2018-07-17T11:12:00</ClosedOn>
<RefCode>51576225</RefCode>
</Admission>
<Admission>
<ClosedOn>2018-07-17T11:42:00</ClosedOn>
<RefCode>51576226</RefCode>
</Admission>
</Admissions>
<Id>63caa566-ed9e-4489-94f9-74cc3d75d9d3</Id>
</Episode>
<Episode>
<Admissions>
<Admission>
<ClosedOn>2018-07-16T15:38:00</ClosedOn>
<RefCode>51576220</RefCode>
</Admission>
<Admission>
<ClosedOn>2018-07-16T15:38:00</ClosedOn>
<RefCode>51576222</RefCode>
</Admission>
</Admissions>
<Id>53be6dfd-2ae8-4dd1-b9e5-33e78e2a2821</Id>
<OpenedOn>2018-07-16T15:21:00</OpenedOn>
</Episode>
</Episodes>
<ExternalId>20350227</ExternalId>
<Gender>Female</Gender>
<Height>0</Height>
<HeightMeasuredOn i:nil="true"/>
<Identifiers>
<Identifier>
<Type>HR</Type>
<Value>20350227</Value>
</Identifier>
<Identifier>
<Type>MC</Type>
<Value>C-U</Value>
</Identifier>
</Identifiers>
</Patient>
</Patients>