Skip to content

Commit f846a97

Browse files
author
ganesan.arunachalam
committed
Initial implementation for TMH
1 parent cd48e7a commit f846a97

3 files changed

Lines changed: 96 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
namespace In.ProjectEKA.TMHHip.Discovery
2+
{
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Net.Http;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
using HipLibrary.Patient;
9+
using HipLibrary.Patient.Model;
10+
using Newtonsoft.Json;
11+
using JsonSerializer = System.Text.Json.JsonSerializer;
12+
using Patient = HipLibrary.Patient.Model.Patient;
13+
14+
public class PatientMatchingRepository : IMatchingRepository
15+
{
16+
private readonly HttpClient client;
17+
18+
public PatientMatchingRepository(HttpClient client)
19+
{
20+
this.client = client;
21+
}
22+
23+
public async Task<IQueryable<Patient>> Where(HipLibrary.Patient.Model.Request.DiscoveryRequest predicate)
24+
{
25+
return new List<Patient>
26+
{
27+
new Patient
28+
{
29+
Identifier = "5",
30+
PhoneNumber = "8340289040",
31+
CareContexts = new List<CareContext>
32+
{
33+
new CareContext
34+
{
35+
Description = "National Cancer Program",
36+
ReferenceNumber = "131"
37+
}
38+
},
39+
FirstName = "Ron",
40+
LastName = "Doe"
41+
}
42+
}.AsQueryable();
43+
// var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost:49699/patients/find");
44+
// request.Content = new StringContent(
45+
// JsonConvert.SerializeObject(new {mobileNumber = predicate.Patient.VerifiedIdentifiers.First().Value}),
46+
// Encoding.UTF8, "application/json");
47+
// var response = await client.SendAsync(request);
48+
// await using var responseStream = await response.Content.ReadAsStreamAsync();
49+
// var result = await JsonSerializer.DeserializeAsync<IEnumerable<Patient>>(responseStream);
50+
// return result.AsQueryable();
51+
}
52+
}
53+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="health-information-provider-library" Version="0.1.3" />
9+
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.1" />
10+
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
11+
<PackageReference Include="Optional" Version="4.0.0" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace In.ProjectEKA.TMHHip.Link
2+
{
3+
using System.Collections.Generic;
4+
using HipLibrary.Patient;
5+
using HipLibrary.Patient.Model;
6+
using Optional;
7+
8+
public class PatientRepository : IPatientRepository
9+
{
10+
public Option<Patient> PatientWith(string referenceNumber)
11+
{
12+
return Option.Some(new Patient
13+
{
14+
Identifier = "5",
15+
PhoneNumber = "8340289040",
16+
CareContexts = new List<CareContext>
17+
{
18+
new CareContext
19+
{
20+
Description = "National Cancer Program",
21+
ReferenceNumber = "131"
22+
}
23+
},
24+
FirstName = "Ron",
25+
LastName = "Doe"
26+
});
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)