Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAH-3034 | Capturing relationships/contacts in patient registration #632

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions package/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM httpd:2.4-alpine

RUN apk add -y --no-cache wget curl unzip

EXPOSE 8091
COPY package/docker/httpd.conf /usr/local/apache2/conf
COPY package/docker/systemdate.sh /usr/local/apache2/cgi-bin/systemdate
Expand All @@ -11,3 +13,16 @@ COPY package/docker/style.css /usr/local/apache2/htdocs/

# Copy BahmniApps
COPY ui/dist/. /usr/local/apache2/htdocs/bahmni/

# Download Person Management App
RUN <<EOR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason of packaging the person management app like this? We could have just bundled it as another image and/or used from MFE way or even proxy to the container serving the app.
This will also mean that for every build of bahmniapps, we are downloading and packaging person management app.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 here, also this would make versioning difficult, every build/patch fix in person management app would need an commit in bahmniapps also and will need a release of bahmni-web image as well.

LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/Bahmni/person-management-app/releases/latest)
Arjun-Go marked this conversation as resolved.
Show resolved Hide resolved
LATEST_VERSION=$(echo $LATEST_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
ARTIFACT_URL="https://github.com/Bahmni/person-management-app/releases/download/$LATEST_VERSION/person-management-app.zip"
wget $ARTIFACT_URL
unzip person-management-app.zip -d /usr/local/apache2/htdocs/
rm person-management-app.zip
mv /usr/local/apache2/htdocs/build/ /usr/local/apache2/htdocs/person-management/
EOR

RUN apk del wget curl unzip
1 change: 1 addition & 0 deletions ui/app/i18n/registration/locale_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"REGISTRATION_LABEL_DATE_DEATH":"Date of death",
"REGISTRATION_LABEL_TILL":"Till",
"REGISTRATION_LABEL_SELECT_RELATIONSHIP_TYPE":"Select Relationship Type",
"REGISTRATION_LABEL_SELECT_PERSON":"Select Person",
"REGISTRATION_LABEL_ENTER_NAME_ID":"Enter Name or ID",
"REGISTRATION_LABEL_VALID_PATIENT_IDENTIFIER":"Please enter a valid patient identifier",
"REGISTRATION_LABEL_PROVIDER_AUTOCOMPLETE_LIST":"Please select a provider from the autocomplete list",
Expand Down
3 changes: 2 additions & 1 deletion ui/app/registration/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Bahmni.Registration.Constants = {
enableWhatsAppButton: false,
enableDashboardRedirect: false,
dashboardUrl: "/bahmni/clinical/index.html#/default/patient/{{patientUuid}}/dashboard",
certificateHeader: "Print Header"
certificateHeader: "Print Header",
personManagementURL: "/person-management"
};

Bahmni.Registration.Constants.Errors = {
Expand Down
31 changes: 29 additions & 2 deletions ui/app/registration/directives/patientRelationship.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ angular.module('bahmni.registration')
}
};
})
.controller('PatientRelationshipController', ['$window', '$scope', '$rootScope', 'spinner', 'patientService', 'providerService', 'appService', '$q',
function ($window, $scope, $rootScope, spinner, patientService, providerService, appService, $q) {
.controller('PatientRelationshipController', ['$window', '$scope', '$rootScope', 'spinner', 'patientService', 'providerService', 'appService', '$q', '$document',
function ($window, $scope, $rootScope, spinner, patientService, providerService, appService, $q, $document) {
$scope.addPlaceholderRelationship = function () {
$scope.patient.newlyAddedRelationships.push({});
};
Expand Down Expand Up @@ -73,6 +73,32 @@ angular.module('bahmni.registration')
return personRelatedTo ? personRelatedTo.display : "";
};

$scope.closePopupWindow = function () {
$scope.showPopupWindow = false;
};

$scope.openPopupWindow = function (relationship) {
var iframe = $document[0].getElementById("relationship-extension-popup");
iframe.src = Bahmni.Registration.Constants.personManagementURL;
$scope.showPopupWindow = true;
$window.addEventListener("message", function (popupWindowData) {
if (!_.isUndefined(popupWindowData.data.uuid)) {
_.each($scope.patient.newlyAddedRelationships, function (newlyAddedRelationship) {
if (newlyAddedRelationship.hasOwnProperty("relationshipType") &&
newlyAddedRelationship.relationshipType.uuid === relationship.relationshipType.uuid) {
if ($scope.isPatientRelationship(newlyAddedRelationship)) {
newlyAddedRelationship.patientIdentifier = popupWindowData.data.display;
}
else if ($scope.isProviderRelationship(newlyAddedRelationship)) {
newlyAddedRelationship.providerName = popupWindowData.data.display;
}
newlyAddedRelationship.personB = getPersonB(popupWindowData.data.display, popupWindowData.data.uuid);
}
});
}
}, false);
};

var getName = function (patient) {
return patient.givenName + (patient.middleName ? " " + patient.middleName : "") +
(patient.familyName ? " " + patient.familyName : "");
Expand Down Expand Up @@ -276,6 +302,7 @@ angular.module('bahmni.registration')
var init = function () {
$scope.relationshipTypes = $rootScope.relationshipTypes;
$scope.patient.relationships = $scope.patient.relationships || [];
$scope.showPopupWindow = false;
};

init();
Expand Down
12 changes: 11 additions & 1 deletion ui/app/registration/views/patientRelationships.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
</div>
<span class="asterick showOn-desktop">*</span>
</div>
<div class="relationship-extension-btn">
<button class="add-person-btn" type="button" ng-disabled="!newRelationship.relationshipType.uuid"
ng-click="openPopupWindow(newRelationship)">{{ ::'REGISTRATION_LABEL_SELECT_PERSON' | translate }}
</button>
</div>
<div class="col col2 form-field">
<div class="field-attribute showOn-small-screen">
<label>{{ 'REGISTRATION_ENTER_NAME_ID_LABEL'|translate }}
Expand Down Expand Up @@ -83,5 +88,10 @@
</div>
</div>
</div>

<div class="add-person-ui" ng-hide="!showPopupWindow">
<div class="add-person-iframe">
<span class="close" ng-click="closePopupWindow()">&times;</span>
<iframe id="relationship-extension-popup" height="95%" width="100%"></iframe>
</div>
</div>
</div>
111 changes: 105 additions & 6 deletions ui/app/styles/registration/_relationship.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
}

.row {
display: flex;
flex-wrap: wrap;
float: left;
width: 100%;

Expand All @@ -22,34 +24,70 @@
font-size: 12px;
}

width: 30%;
width: 25%;
float: left;

@media (max-width : 1024px) {
width: 25%;
}

@media (max-width : 990px) {
width: 35%;
}

@media (max-width : 768px) {
width: 100%;
}

.field-value {
margin-left: 0.2rem;
}
}

.col2 {
width: 38%;
width: 25%;
float: left;
text-align: left;

@media (max-width : 1024px) {
width: 36%;
width: 25%;
}

@media (max-width : 990px) {
width: 31%;
width: 35%;
}

@media (max-width : 768px) {
width: 100%;
}
}

.relationship-extension-btn {
width: 15%;
float: left;

@media (max-width : 1024px) {
width: 15%;
}

@media (max-width : 990px) {
width: 30%;
}

@media (max-width : 768px) {
display: flex;
justify-content: center;
width: 100%;
padding: 1% 0 0 0;
}

.add-person-btn {
margin: 0.2rem 0 0.2rem 0;
}
}

.col3 {
width: 25%;
width: 28%;
float: left;
text-align: right;

Expand All @@ -58,7 +96,7 @@
}

@media (max-width : 990px) {
width: 36%;
width: 82%;
}

@media (max-width : 768px) {
Expand Down Expand Up @@ -228,4 +266,65 @@
font-weight: normal;
}
}
}

.extension-btn {
margin-left: 5px;
margin-top: 4px;
display: inline-block;

@media (max-width : 768px) {
display: block;
margin-left: 0;
margin-top: 5px;
}

button {
margin-right: 5px;
margin-left: 5px;
}
}

.add-person-ui {
position: fixed;
z-index: 1;
padding-top: 2%;
width: 100%;
height: 100%;
left: 0;
top: 0;
overflow: auto;
background-color: rgba(0, 0, 0, 0.6);

.add-person-iframe {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 70%;
height: 80%;

@media screen and (max-width: 540px) {
width: 90%;
}

@media screen and (min-width: 541px) and (max-width: 1024px) {
width: 80%;
}
}

.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
margin-bottom: 10px;
}

.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
}