-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
discharge an episode if its on the list and you want to add the same …
…hospital number, needs unit tests
- Loading branch information
1 parent
8b9603d
commit f035a66
Showing
6 changed files
with
125 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* is a patient is currently on the list, give the option to discharge | ||
*/ | ||
angular.module('opal.controllers').controller('ConfirmDischargeCtrl', function( | ||
$scope, $modal, $modalInstance, DischargePatientService, | ||
patient, episode, tags, context | ||
){ | ||
$scope.newPatient = function(result){ | ||
// There is no patient with this hospital number | ||
// Show user the form for creating a new episode, | ||
// with the hospital number pre-populated | ||
modal = $modal.open({ | ||
backdrop: 'static', | ||
templateUrl: '/templates/modals/add_episode.html', | ||
controller: 'DiagnosisAddEpisodeCtrl', | ||
resolve: { | ||
referencedata: function(Referencedata) { return Referencedata; }, | ||
demographics: function() { | ||
return patient.demographics[0]; | ||
}, | ||
tags: function(){ return tags; } | ||
} | ||
}).result.then(function(result) { | ||
// The user has created the episode, or cancelled | ||
if(result.then){ | ||
result.then(function(r){ | ||
$modalInstance.close(r); | ||
}); | ||
}else{ | ||
$modalInstance.close(result); | ||
} | ||
}); | ||
}; | ||
|
||
$scope.confirm = function(){ | ||
var dischargePatientService = new DischargePatientService(); | ||
dischargePatientService.discharge(episode, {category: "Discharged"}, tags).then(function(){ | ||
context.removeFromList(episode.id); | ||
$scope.newPatient(patient); | ||
}); | ||
}; | ||
|
||
$scope.cancel = function(){ | ||
$modalInstance.close(); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% extends 'base_templates/form_modal_base.html' %} | ||
{% load forms %} | ||
{% block icon_name %}glyphicon glyphicon-plus{% endblock %} | ||
{% block title %}Confirm Addition{% endblock %} | ||
{% block modal_body %} | ||
<form class="form-horizontal text-center" name="form"> | ||
<p class="lead"> | ||
The Patient is already on the list, awaiting follow up tasks from their discharge. | ||
</p> | ||
<p class="lead"> | ||
Would you like to close this episode of care and readmit the patient? | ||
</p> | ||
<span ng-show="form"> | ||
<button one-click-only class="btn btn-primary" ng-click="confirm()"> | ||
<i class="fa fa-save"></i> | ||
Confirm | ||
</button> | ||
</span> | ||
</form> | ||
{% endblock %} | ||
{% block modal_save %}{% endblock %} |