1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 |
|
---|
6 | namespace IndianHealthService.ClinicalScheduling
|
---|
7 | {
|
---|
8 |
|
---|
9 | /// <summary>
|
---|
10 | /// You guessed it.
|
---|
11 | /// </summary>
|
---|
12 | public enum Sex
|
---|
13 | {
|
---|
14 | Male, Female
|
---|
15 | };
|
---|
16 |
|
---|
17 | /// <summary>
|
---|
18 | /// Puppet standing for a Real Patient
|
---|
19 | /// </summary>
|
---|
20 | [Serializable]
|
---|
21 | public class Patient
|
---|
22 | {
|
---|
23 | public int DFN { get; set; }
|
---|
24 | public string Name { get; set; }
|
---|
25 | public Sex Sex;
|
---|
26 | public DateTime DOB { get; set; }
|
---|
27 | public string ID { get; set; }
|
---|
28 | public string HRN { get; set; }
|
---|
29 | public List<CGAppointment> Appointments { get; set; }
|
---|
30 | public string Street { get; set; }
|
---|
31 | public string City { get; set; }
|
---|
32 | public string State { get; set; }
|
---|
33 | public string Zip { get; set; }
|
---|
34 | public string Country { get; set; }
|
---|
35 | public string Email { get; set; }
|
---|
36 | public string HomePhone { get; set; }
|
---|
37 | public string WorkPHone { get; set; }
|
---|
38 | public string CellPhone { get; set; }
|
---|
39 | public TimeSpan Age
|
---|
40 | {
|
---|
41 | get
|
---|
42 | {
|
---|
43 | return (DateTime.Today - this.DOB);
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
47 | /// <summary>
|
---|
48 | /// Returns User Friendly Age. If Age < 5, then Years and Months
|
---|
49 | /// If Age > 5, then only Years.
|
---|
50 | /// Humans tend to round down their ages. So I follow the same rule here.
|
---|
51 | /// </summary>
|
---|
52 | public string UserFriendlyAge
|
---|
53 | {
|
---|
54 | get
|
---|
55 | {
|
---|
56 | if (Age.TotalDays / 365.24 > 5)
|
---|
57 | return Math.Floor((Age.TotalDays / 365.24)).ToString() + " " + strings.years;
|
---|
58 | else
|
---|
59 | return Math.Floor((Age.TotalDays / 365.24)).ToString() + " " + strings.years + " " + strings.and + " "
|
---|
60 | + Math.Floor(Age.TotalDays % 365.24 / 30).ToString() + " " + strings.months;
|
---|
61 | }
|
---|
62 | }
|
---|
63 | }
|
---|
64 | }
|
---|