From 0be7826daba880f01f64f21ab8d9cc19d6037109 Mon Sep 17 00:00:00 2001 From: Brian308 Date: Wed, 30 Oct 2024 19:43:19 +0300 Subject: [PATCH 1/9] made the search bar responsive --- frontend/src/components/Style.css | 10 +---- .../components/layout/search/searchBar.css | 43 ++++++++++++++++--- .../src/components/layout/search/searchBar.js | 2 +- frontend/src/index.css | 3 +- 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/Style.css b/frontend/src/components/Style.css index d9e8fefcb3..7e113f90bd 100644 --- a/frontend/src/components/Style.css +++ b/frontend/src/components/Style.css @@ -57,7 +57,8 @@ li.clickableUserDetails:hover { .inputSearch { --cds-text-primary: black; - width: 100%; + /*width: 100%;*/ + width: 50%; --cds-text-secondary: black; --cds-icon-primary: black; } @@ -279,13 +280,6 @@ button { --cds-text-secondary: black; } -.inputSearch { - --cds-text-primary: black; - width: 100%; - --cds-text-secondary: black; - --cds-icon-primary: black; -} - .results { display: flex; justify-content: space-between; diff --git a/frontend/src/components/layout/search/searchBar.css b/frontend/src/components/layout/search/searchBar.css index 4e1e7aabc7..263b4414a3 100644 --- a/frontend/src/components/layout/search/searchBar.css +++ b/frontend/src/components/layout/search/searchBar.css @@ -16,6 +16,7 @@ .search-input { width: 100%; position: relative; + } .search-bar-container:hover { @@ -48,24 +49,54 @@ cursor: pointer; } +/* Small screens - Mobile layout (768px and below) */ @media (max-width: 768px) { .patientHead { - flex-direction: column; + flex-direction: column; /* Stack elements vertically on small screens */ + align-items: center; /* Center items for mobile view */ + width: 50%; /* Allow full width on mobile */ } .search-bar-container { - flex-direction: column; - align-items: stretch; + flex-direction: row; /* Stack search elements vertically */ + align-items: centre; + margin-top: 40px; + width: 50%; /* Expand to full width on mobile */ + /* padding: 10px; Optional padding for better spacing */ } .search-input { - width: 100%; + width: 90%; /* Set search input to almost full width */ + /*margin: 10px 0; Add margin to separate elements */ } } -@media (min-width: 769px) and (max-width: 1024px) { + + +/* Medium screens - Tablet layout */ +@media (min-width: 769px) and (max-width: 1099px) { + .patientHead { + flex-direction: row; + justify-content: space-between; + } + + .search-bar-container { + flex-direction: row; + align-items: center; + justify-content: space-between; + margin-top: 40px; + } + + .search-input { + width: 75%; /* Adjust for better usability on tablets */ + } +} + +/* Larger screens - Desktop layout */ +@media (min-width: 1100px) { .patientHead { flex-direction: row; + justify-content: space-between; } .search-bar-container { @@ -74,6 +105,6 @@ } .search-input { - width: 75%; + width: 50%; /* Width for desktop */ } } diff --git a/frontend/src/components/layout/search/searchBar.js b/frontend/src/components/layout/search/searchBar.js index e1db0c5216..a3223b6b28 100644 --- a/frontend/src/components/layout/search/searchBar.js +++ b/frontend/src/components/layout/search/searchBar.js @@ -148,4 +148,4 @@ const SearchBar = (props) => { ); }; -export default SearchBar; +export default SearchBar; \ No newline at end of file diff --git a/frontend/src/index.css b/frontend/src/index.css index 026fe15cfc..5aa3ee2f3b 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -71,7 +71,8 @@ code { .slide-over-panel { width: 25%; /* Use percentage for width on larger screens */ - max-width: 25%; + /* max-width: 25%;*/ + max-width: 50%; /* Use percentage for max-width on larger screens */ } } From 676c1d44589a5282dd4ae080e924fd94d7d11d1f Mon Sep 17 00:00:00 2001 From: Brian308 Date: Wed, 30 Oct 2024 22:10:42 +0300 Subject: [PATCH 2/9] modified the searchBar.css --- .../components/layout/search/searchBar.css | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/layout/search/searchBar.css b/frontend/src/components/layout/search/searchBar.css index 263b4414a3..92a164d3b4 100644 --- a/frontend/src/components/layout/search/searchBar.css +++ b/frontend/src/components/layout/search/searchBar.css @@ -49,8 +49,30 @@ cursor: pointer; } -/* Small screens - Mobile layout (768px and below) */ -@media (max-width: 768px) { +/* Small screens - Mobile layout (768px and 600px) */ +@media (max-width: 600px) { + .patientHead { + flex-direction: column; /* Stack elements vertically on small screens */ + align-items: center; /* Center items for mobile view */ + width: 50%; /* Allow full width on mobile */ + } + + .search-bar-container { + flex-direction: row; /* Stack search elements vertically */ + align-items: right; + margin-top: 40px; + width: 35%; /* Expand to full width on mobile */ + /* padding: 10px; Optional padding for better spacing */ + } + + .search-input { + width: 90%; /* Set search input to almost full width */ + /*margin: 10px 0; Add margin to separate elements */ + } +} + +/* Small screens - Mobile layout (768px and 601px) */ +@media (min-width: 601px) and (max-width: 768px) { .patientHead { flex-direction: column; /* Stack elements vertically on small screens */ align-items: center; /* Center items for mobile view */ From fe9ef5a205a05867c8f3d44d90eed9a2c7a85edc Mon Sep 17 00:00:00 2001 From: Brian308 Date: Thu, 31 Oct 2024 08:01:22 +0300 Subject: [PATCH 3/9] made improvements to the searchBar --- frontend/src/components/layout/search/searchBar.css | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/layout/search/searchBar.css b/frontend/src/components/layout/search/searchBar.css index 92a164d3b4..52a64f98ab 100644 --- a/frontend/src/components/layout/search/searchBar.css +++ b/frontend/src/components/layout/search/searchBar.css @@ -58,16 +58,15 @@ } .search-bar-container { - flex-direction: row; /* Stack search elements vertically */ - align-items: right; + flex-direction: row; /* Stack search elements horizontally */ margin-top: 40px; - width: 35%; /* Expand to full width on mobile */ + width: 35%; + box-shadow: none; /* padding: 10px; Optional padding for better spacing */ } .search-input { width: 90%; /* Set search input to almost full width */ - /*margin: 10px 0; Add margin to separate elements */ } } From af5b3e04aedd6ea2b1cbb49e9ae20ac693d59cff Mon Sep 17 00:00:00 2001 From: Brian308 Date: Thu, 31 Oct 2024 11:14:21 +0300 Subject: [PATCH 4/9] refactored media --- .../components/layout/search/searchBar.css | 63 ++++++++++++------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/frontend/src/components/layout/search/searchBar.css b/frontend/src/components/layout/search/searchBar.css index 52a64f98ab..bf1d35b83a 100644 --- a/frontend/src/components/layout/search/searchBar.css +++ b/frontend/src/components/layout/search/searchBar.css @@ -49,52 +49,65 @@ cursor: pointer; } -/* Small screens - Mobile layout (768px and 600px) */ -@media (max-width: 600px) { +/* Small screens - Mobile layout (300px to 479px) */ +@media (min-width: 300px) and (max-width: 479px) { .patientHead { - flex-direction: column; /* Stack elements vertically on small screens */ - align-items: center; /* Center items for mobile view */ - width: 50%; /* Allow full width on mobile */ + flex-direction: row; + align-items: stretch; } .search-bar-container { - flex-direction: row; /* Stack search elements horizontally */ margin-top: 40px; - width: 35%; + width: 30%; box-shadow: none; - /* padding: 10px; Optional padding for better spacing */ } .search-input { - width: 90%; /* Set search input to almost full width */ + width: 30%; } } -/* Small screens - Mobile layout (768px and 601px) */ -@media (min-width: 601px) and (max-width: 768px) { +/* Small-medium screens (480px to 600px) */ +@media (min-width: 480px) and (max-width: 600px) { .patientHead { - flex-direction: column; /* Stack elements vertically on small screens */ - align-items: center; /* Center items for mobile view */ - width: 50%; /* Allow full width on mobile */ + flex-direction: column; + align-items: center; + width: 35%; } .search-bar-container { - flex-direction: row; /* Stack search elements vertically */ - align-items: centre; + flex-direction: row; margin-top: 40px; - width: 50%; /* Expand to full width on mobile */ - /* padding: 10px; Optional padding for better spacing */ + width: 35%; + box-shadow: none; } .search-input { - width: 90%; /* Set search input to almost full width */ - /*margin: 10px 0; Add margin to separate elements */ + width: 35%; } } +/* Medium screens (601px to 768px) */ +@media (min-width: 601px) and (max-width: 768px) { + .patientHead { + flex-direction: column; + align-items: center; + width: 40%; + } + + .search-bar-container { + flex-direction: row; + align-items: center; + margin-top: 40px; + width: 40%; + } + .search-input { + width: 40%; + } +} -/* Medium screens - Tablet layout */ +/* Medium-large screens (769px to 1099px) */ @media (min-width: 769px) and (max-width: 1099px) { .patientHead { flex-direction: row; @@ -106,14 +119,15 @@ align-items: center; justify-content: space-between; margin-top: 40px; + width: 60%; } .search-input { - width: 75%; /* Adjust for better usability on tablets */ + width: 60%; } } -/* Larger screens - Desktop layout */ +/* Large screens (1100px and up) */ @media (min-width: 1100px) { .patientHead { flex-direction: row; @@ -123,9 +137,10 @@ .search-bar-container { flex-direction: row; align-items: center; + width: 60%; } .search-input { - width: 50%; /* Width for desktop */ + width: 60%; } } From 98c3f49c97f7f16e3e998e2c8a93bf938f4afbf0 Mon Sep 17 00:00:00 2001 From: Brian308 Date: Thu, 31 Oct 2024 11:26:29 +0300 Subject: [PATCH 5/9] modifications --- frontend/src/components/layout/search/searchBar.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/layout/search/searchBar.css b/frontend/src/components/layout/search/searchBar.css index bf1d35b83a..b65e369153 100644 --- a/frontend/src/components/layout/search/searchBar.css +++ b/frontend/src/components/layout/search/searchBar.css @@ -92,18 +92,18 @@ .patientHead { flex-direction: column; align-items: center; - width: 40%; + width: 45%; } .search-bar-container { flex-direction: row; align-items: center; margin-top: 40px; - width: 40%; + width: 45%; } .search-input { - width: 40%; + width: 45%; } } From 534396b0a98b65283e99014b2ca95768fd1e4ca5 Mon Sep 17 00:00:00 2001 From: Brian308 Date: Fri, 1 Nov 2024 17:26:20 +0300 Subject: [PATCH 6/9] made searchBar occupy screen width and refactored the code too --- .../components/layout/search/searchBar.css | 97 ++----------------- 1 file changed, 9 insertions(+), 88 deletions(-) diff --git a/frontend/src/components/layout/search/searchBar.css b/frontend/src/components/layout/search/searchBar.css index ef61e5efee..ddaacebf1b 100644 --- a/frontend/src/components/layout/search/searchBar.css +++ b/frontend/src/components/layout/search/searchBar.css @@ -1,7 +1,6 @@ .main { position: absolute; - right: 175px; - width: 700px; + width: 100%; } .search-bar-container { @@ -9,7 +8,9 @@ display: flex; width: 100%; top: 10px; - right: -30px; + margin-top: 38px; + right: 1px; + /*right: -20px;*/ box-shadow: 0em 0.1em 0.05em #ccc; } @@ -50,98 +51,18 @@ cursor: pointer; } -/* Small screens - Mobile layout (300px to 479px) */ -@media (min-width: 300px) and (max-width: 479px) { - .patientHead { - flex-direction: row; - align-items: stretch; - } - - .search-bar-container { - margin-top: 40px; - width: 30%; - box-shadow: none; - } - - .search-input { - width: 30%; - } -} - -/* Small-medium screens (480px to 600px) */ -@media (min-width: 480px) and (max-width: 600px) { - .patientHead { - flex-direction: column; - align-items: center; - width: 35%; - } - - .search-bar-container { - flex-direction: row; - margin-top: 40px; - width: 35%; - box-shadow: none; - } - - .search-input { - width: 35%; - } -} -/* Medium screens (601px to 768px) */ -@media (min-width: 601px) and (max-width: 768px) { - .patientHead { - flex-direction: column; - align-items: center; - width: 45%; - } +/* Large screens (1208px and up) */ +@media (min-width: 1208px) { + .search-bar-container { - flex-direction: row; - align-items: center; - margin-top: 40px; width: 45%; + margin-top: 0%; + right: 130px; } .search-input { width: 45%; } } - -/* Medium-large screens (769px to 1099px) */ -@media (min-width: 769px) and (max-width: 1099px) { - .patientHead { - flex-direction: row; - justify-content: space-between; - } - - .search-bar-container { - flex-direction: row; - align-items: center; - justify-content: space-between; - margin-top: 40px; - width: 60%; - } - - .search-input { - width: 60%; - } -} - -/* Large screens (1100px and up) */ -@media (min-width: 1100px) { - .patientHead { - flex-direction: row; - justify-content: space-between; - } - - .search-bar-container { - flex-direction: row; - align-items: center; - width: 60%; - } - - .search-input { - width: 60%; - } -} From 6863f83d78a67fee22c197640c50f235192d44d9 Mon Sep 17 00:00:00 2001 From: josephbate Date: Tue, 5 Nov 2024 12:59:00 +0300 Subject: [PATCH 7/9] adding more tests for patientService --- .../patient/PatientServiceTest.java | 445 ++++++++++++++++++ 1 file changed, 445 insertions(+) diff --git a/src/test/java/org/openelisglobal/patient/PatientServiceTest.java b/src/test/java/org/openelisglobal/patient/PatientServiceTest.java index cd3ebb0b8a..960db97bb0 100644 --- a/src/test/java/org/openelisglobal/patient/PatientServiceTest.java +++ b/src/test/java/org/openelisglobal/patient/PatientServiceTest.java @@ -18,6 +18,9 @@ import org.openelisglobal.patient.service.PatientService; import org.openelisglobal.patient.service.PatientTypeService; import org.openelisglobal.patient.valueholder.Patient; +import org.openelisglobal.patientidentity.service.PatientIdentityService; +import org.openelisglobal.patientidentity.valueholder.PatientIdentity; +import org.openelisglobal.patientidentitytype.service.PatientIdentityTypeService; import org.openelisglobal.patienttype.valueholder.PatientType; import org.openelisglobal.person.service.PersonService; import org.openelisglobal.person.valueholder.Person; @@ -34,15 +37,26 @@ public class PatientServiceTest extends BaseWebContextSensitiveTest { @Autowired PersonService personService; + @Autowired + PatientIdentityTypeService identityTypeService; + + @Autowired + PatientIdentityService identityService; + @Before public void init() throws Exception { + // identityTypeService.deleteAll(identityTypeService.getAll()); + identityService.deleteAll(identityService.getAll()); patientService.deleteAll(patientService.getAll()); personService.deleteAll(personService.getAll()); patientTypeService.deleteAll(patientTypeService.getAll()); + } @After public void tearDown() { + // identityTypeService.deleteAll(identityTypeService.getAll()); + identityService.deleteAll(identityService.getAll()); patientService.deleteAll(patientService.getAll()); personService.deleteAll(personService.getAll()); patientTypeService.deleteAll(patientTypeService.getAll()); @@ -83,6 +97,413 @@ public void getData_shouldCopyPropertiesFromDatabase() throws Exception { Assert.assertEquals(gender, savedPatient.getGender()); } + @Test + public void getSubjectNumber_shouldReturnSubjectNumber() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("SUBJECT").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("334-422-A"); + identityService.insert(patientIdentity); + + Assert.assertEquals("334-422-A", patientService.getSubjectNumber(patient)); + } + + @Test + public void getIdentityList_shouldReturnIdentityList() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("AKA").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("BigMan"); + identityService.insert(patientIdentity); + + String typeID2 = identityTypeService.getNamedIdentityType("GUID").getId(); + + PatientIdentity patientIdentity2 = new PatientIdentity(); + patientIdentity2.setIdentityTypeId(typeID2); + patientIdentity2.setPatientId(patientId); + patientIdentity2.setIdentityData("EA400A1"); + identityService.insert(patientIdentity2); + + Assert.assertEquals(2, patientService.getIdentityList(patient).size()); + } + + @Test + public void getNationality_shouldReturnNationality() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("NATIONALITY").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("Ugandan"); + identityService.insert(patientIdentity); + + Assert.assertEquals("Ugandan", patientService.getNationality(patient)); + } + + @Test + public void getOtherNationality_shouldReturnOtherNationality() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("OTHER NATIONALITY").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("USA"); + identityService.insert(patientIdentity); + + Assert.assertEquals("USA", patientService.getOtherNationality(patient)); + } + + @Test + public void getMother_shouldReturnMother() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("MOTHER").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("Jackie Moore"); + identityService.insert(patientIdentity); + + Assert.assertEquals("Jackie Moore", patientService.getMother(patient)); + } + + @Test + public void getMothersInitial_shouldReturnMothersInitial() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("MOTHERS_INITIAL").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("Jackie Moore"); + identityService.insert(patientIdentity); + + Assert.assertEquals("Jackie Moore", patientService.getMothersInitial(patient)); + } + + @Test + public void getInsurance_shouldReturnInsurance() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("INSURANCE").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("US119a36"); + identityService.insert(patientIdentity); + + Assert.assertEquals("US119a36", patientService.getInsurance(patient)); + } + + @Test + public void getOccupation_shouldReturnOccupation() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("OCCUPATION").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("Truck Driver"); + identityService.insert(patientIdentity); + + Assert.assertEquals("Truck Driver", patientService.getOccupation(patient)); + } + + @Test + public void getOrgSite_shouldReturnOrgSite() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("ORG_SITE").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("orgSite"); + identityService.insert(patientIdentity); + + Assert.assertEquals("orgSite", patientService.getOrgSite(patient)); + } + + @Test + public void getEducation_shouldReturnEducationQualification() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("EDUCATION").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("MBA Certificate"); + identityService.insert(patientIdentity); + + Assert.assertEquals("MBA Certificate", patientService.getEducation(patient)); + } + + @Test + public void getHealthDistrict_shouldReturnHealthDistrict() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("HEALTH DISTRICT").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("Jinja"); + identityService.insert(patientIdentity); + + Assert.assertEquals("Jinja", patientService.getHealthDistrict(patient)); + } + + @Test + public void getHealthRegion_shouldReturnHealthRegion() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("HEALTH REGION").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("EastAfrica"); + identityService.insert(patientIdentity); + + Assert.assertEquals("EastAfrica", patientService.getHealthRegion(patient)); + } + + @Test + public void getMaritalStatus_shouldReturnMaritalStatus() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("MARITIAL").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("Married"); + identityService.insert(patientIdentity); + + Assert.assertEquals("Married", patientService.getMaritalStatus(patient)); + } + + @Test + public void getObNumber_shouldReturngObNumber() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("OB_NUMBER").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("1234"); + identityService.insert(patientIdentity); + + Assert.assertEquals("1234", patientService.getObNumber(patient)); + } + + @Test + public void getPCNumber_shouldReturngPCNumber() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("PC_NUMBER").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("1234"); + identityService.insert(patientIdentity); + + Assert.assertEquals("1234", patientService.getPCNumber(patient)); + } + + @Test + public void getSTNumber_shouldReturngSTNumber() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("ST").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("1234"); + identityService.insert(patientIdentity); + + Assert.assertEquals("1234", patientService.getSTNumber(patient)); + } + + @Test + public void getAKA_shouldReturnAKA() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("AKA").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("BigMan"); + identityService.insert(patientIdentity); + + Assert.assertEquals("BigMan", patientService.getAKA(patient)); + } + + @Test + public void getGUID_shouldReturnGUID() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("GUID").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("EA400A1"); + identityService.insert(patientIdentity); + + Assert.assertEquals("EA400A1", patientService.getGUID(patient)); + } + + @Test + public void getGUID_shouldReturnEmptyStringForNullPatient() throws Exception { + Assert.assertEquals("", patientService.getGUID(null)); + } + + @Test + public void getGUID_shouldReturnEmptyStringForNullPatientWithNoGUID() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + Assert.assertEquals("", patientService.getGUID(patient)); + } + + @Test + public void getPatientForGuid_shouldReturnPatientForGuid() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + String patientId = patientService.insert(patient); + + String typeID = identityTypeService.getNamedIdentityType("GUID").getId(); + + PatientIdentity patientIdentity = new PatientIdentity(); + patientIdentity.setIdentityTypeId(typeID); + patientIdentity.setPatientId(patientId); + patientIdentity.setIdentityData("EA400A1"); + identityService.insert(patientIdentity); + + Patient savedPatient = patientService.getPatientForGuid("EA400A1"); + + Assert.assertEquals(gender, savedPatient.getGender()); + } + @Test public void getData_shouldCopyPropertiesFromDatabaseById() throws Exception { String firstName = "John"; @@ -171,6 +592,18 @@ public void getAllPatients_shouldGetAllPatients() throws Exception { Assert.assertEquals(1, patientService.getAllPatients().size()); } + @Test + public void getByExternalId_shouldGetAllPatients() throws Exception { + String firstName = "John"; + String lastname = "Doe"; + String dob = "12/12/1992"; + String gender = "M"; + Patient patient = createPatient(firstName, lastname, dob, gender); + patient.setExternalId("432"); + patientService.insert(patient); + Assert.assertEquals(gender, patientService.getByExternalId("432").getGender()); + } + @Test public void getPatientByPerson_shouldReturnPatientByPerson() throws Exception { String firstName = "John"; @@ -501,6 +934,18 @@ public void getLocalizedGender_shouldReturnCorrectLocalizedGender() throws Excep Assert.assertEquals("MALE", localizedGender); } + @Test + public void getBirthdayForDisplay_shouldReturnBirthdayForDisplay() throws Exception { + String firstName = "Tayebwa"; + String lastName = "Noah"; + String dob = "01/01/2020"; + String gender = "M"; + Patient pat = createPatient(firstName, lastName, dob, gender); + pat.setBirthDateForDisplay("01/01/2020"); + + Assert.assertEquals(dob, patientService.getBirthdayForDisplay(pat)); + } + @Test public void getPageOfPatients_shouldReturnCorrectPatients() throws Exception { String firstName1 = "Josh"; From 73104245062c15c6562a57d308b336469a289129 Mon Sep 17 00:00:00 2001 From: Brian308 Date: Wed, 6 Nov 2024 20:12:25 +0300 Subject: [PATCH 8/9] made modifications for patients class not obstract the search bar on small screens --- frontend/src/components/layout/search/searchBar.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/layout/search/searchBar.css b/frontend/src/components/layout/search/searchBar.css index ddaacebf1b..6fa1fb47cd 100644 --- a/frontend/src/components/layout/search/searchBar.css +++ b/frontend/src/components/layout/search/searchBar.css @@ -30,7 +30,7 @@ max-height: 250px; position: absolute; background-color: #f0e7e7; - top: 45px; + top: 90px; right: -30px; box-shadow: 0em 0.1em 0.5em #ccc; } @@ -65,4 +65,7 @@ .search-input { width: 45%; } + .patients{ + top: 45px; + } } From 8e8eff5cb6d3efdb29b313d9f39ec27d4bcbd5bd Mon Sep 17 00:00:00 2001 From: Brian308 Date: Wed, 6 Nov 2024 21:44:28 +0300 Subject: [PATCH 9/9] modified the patients class to make it responsive --- .../components/layout/search/searchBar.css | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/layout/search/searchBar.css b/frontend/src/components/layout/search/searchBar.css index 6fa1fb47cd..e202ea237d 100644 --- a/frontend/src/components/layout/search/searchBar.css +++ b/frontend/src/components/layout/search/searchBar.css @@ -30,17 +30,18 @@ max-height: 250px; position: absolute; background-color: #f0e7e7; - top: 90px; - right: -30px; + top: 89px; + right: -1px; box-shadow: 0em 0.1em 0.5em #ccc; } .patientHead { - width: 680px; + width: 103%; position: relative; border-bottom: 2px solid #eee3e3; background-color: #fcfbfb; height: 52px; + right: -1px; box-shadow: 0em 0.01em 0.05em #ccc; } .tags { @@ -65,7 +66,26 @@ .search-input { width: 45%; } - .patients{ - top: 45px; + + .patients { + overflow-y: auto; + width: 45%; + max-height: 250px; + position: absolute; + background-color: #f0e7e7; + top: 48px; + right: 130px; + box-shadow: 0em 0.1em 0.5em #ccc; + } + + .patientHead { + overflow-y: auto; + width: 600px; + right: -1px; + position: relative; + border-bottom: 2px solid #eee3e3; + background-color: #fcfbfb; + height: 52px; + box-shadow: 0em 0.01em 0.05em #ccc; } }