Rhizonic Careplan Cards
Rhizome library with Ionic and FHIR Careplan and Questionnaire resources
by phollott
HTML
<script src="//code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js"></script>
<link rel="stylesheet" href="//code.ionicframework.com/1.0.0-beta.6/css/ionic.css">
<script src="//phollott.github.io/lib/rhizome/rhizome.js"></script>
<script src="//cdn.jsdelivr.net/snap.svg/0.3.0/snap.svg-min.js"></script>
<div id="demo">
<div id="inset" ng-app="rhzApp" ng-controller="RhzCtrl">
<ion-slide-box active-slide="slide" show-pager="false" rhz-ion-careplan="">
<ion-slide>
<rhz-ion-careplan-context/>
</ion-slide>
<ion-slide>
<rhz-ion-careplan-splash>
<p>This demo was created using Ionic Framework, AngularJS, and the Rhizome and SnapSVG libraries, demonstrating how these can be used together in a Healthcare app.</p>
<p>This demo also makes extensive use of the HL7 FHIR Careplan and Questionnaire resource standard.</p>
</rhz-ion-careplan-splash>
</ion-slide>
<ion-slide ng-repeat="activity in plan.activities">
<div ng-if="activity.media.indexOf('fhir') > -1">
<rhz-ion-questionnaire-test ref="{{activity.id}}"/>
</div>
<div ng-if="activity.media.indexOf('youtube') > -1">
<div>Place Video Here</div>
</div>
<div class="card" ng-if="!activity.media">
<div class="item item-icon-left pull-right"> <i class="icon ion-calendar"></i>
<h2>{{activity.details}}</h2>
<p>{{activity.start}}</p>
</div>
<div class="item item-body">
<p>{{activity.details}}</p>
<p>{{activity.notes}}</p>
</div>
<div class="item item-icon-left pull-right"> <i ng-show="activity.status==='completed'" class="icon ion-checkmark-round"></i>
<i...
CSS
#demo {
width: 305px;
height: 580px;
-moz-border-radius: 15px;
border-radius: 20px;
background-color: goldenrod;
}
#inset {
position: absolute;
width: 280px;
height: 470px;
top: 50px;
left: 12px;
background-color: white
}
.q4c-sq1 {
width: 250px;
height: 250px;
float: left
}
.q4c-sq2 {
width: 250px;
text-align: center;
float: left
}
#rhizSvg {
width: 250px;
height: 250px;
background-color: lightgray
}
.frame {
opacity: 0
}
.buttonface {
width: 250px;
height: 25px;
}
.buttonhalf {
width: 125px;
height: 25px;
font-size: 8pt;
}
ol.buttonlist {
list-style: none;
margin: 0;
padding: 0
}
.question {
padding: 5px;
max-width: 250px;
text-wrap: normal
}
.label {
font-family: Helvetica, sans-serif;
font-size: 10pt;
font-weight: bold
}
JavaScript
var RhzApp;
(function (RhzApp) {
var cfg = angular.module('config', []);
cfg.factory('config', function () {
return {
baseurl: 'http://phollott.github.io/rhizome/fhir'
}
});
var app = angular.module('rhzApp', ['ionic', 'rhizome', 'config']);
/**
* This is about as simple as a controller gets...
*/
app.controller('RhzCtrl', function (config, rhsCareplan, $scope, $ionicActionSheet) {
var url = config.baseurl + "/careplan/112"
rhsCareplan.loadResource(url)
$scope.showMenu = function () {
var hideSheet = $ionicActionSheet.show({
buttons: rhsCareplan.getButtons(),
titleText: 'Available Careplan Resources',
cancelText: 'Cancel',
cancel: function () {},
destructiveText: 'Restart Care Plan',
destructiveButtonClicked: function () {},
buttonClicked: rhsCareplan.resetResource
});
}
});
//need to pass the reference to the panel, so it knows which svg to watch
/* app.directive('rhzSvg', function () {
return {
link: function ($scope, $element, $attr) {
var svg, svgRoot = Snap($element[0])
alert(JSON.stringify($attr))
$scope.$on('RhzFocusSvg', function (evt, obj) {
if (obj.svg) {
loadSvg(obj.svg)
focusFrame(obj.frame, 0)
} else {
focusFrame(obj.frame, 2000)
}
});
loadSvg = function(text) {
var svgFrag = Snap.parse(text)
svgRoot.append(svgFrag)
svg = svgRoot.select("#svg")
}
focusFrame = function(frId, dur) {
var fr = svg.select(frId)
svg.animate({
x: 0-fr.attr('x'),
y:...