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 7ead152835..e202ea237d 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,13 +8,16 @@ display: flex; width: 100%; top: 10px; - right: -30px; + margin-top: 38px; + right: 1px; + /*right: -20px;*/ box-shadow: 0em 0.1em 0.05em #ccc; } .search-input { width: 100%; position: relative; + } .search-bar-container:hover { @@ -28,17 +30,18 @@ max-height: 250px; position: absolute; background-color: #f0e7e7; - top: 45px; - 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 { @@ -49,32 +52,40 @@ cursor: pointer; } -@media (max-width: 768px) { - .patientHead { - flex-direction: column; - } + +/* Large screens (1208px and up) */ +@media (min-width: 1208px) { + .search-bar-container { - flex-direction: column; - align-items: stretch; + width: 45%; + margin-top: 0%; + right: 130px; } .search-input { - width: 100%; - } -} - -@media (min-width: 769px) and (max-width: 1024px) { - .patientHead { - flex-direction: row; + width: 45%; } - .search-bar-container { - flex-direction: row; - align-items: center; + .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; } - - .search-input { - width: 75%; + + .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; } } 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 */ } } 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";