2 * Copyright (C) 2016 Kevin Yeh <kevin.y@integralemr.com>
4 * LICENSE: This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 3
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
16 * @author Kevin Yeh <kevin.y@integralemr.com>
17 * @link http://www.open-emr.org
20 function encounter_data(id,date,category)
23 self.id=ko.observable(id);
24 self.date=ko.observable(date);
25 self.category=ko.observable(category);
29 function patient_data_view_model(pname,pid,pubpid,str_dob)
32 self.pname=ko.observable(pname);
33 self.pid=ko.observable(pid);
34 self.pubpid=ko.observable(pubpid);
35 self.str_dob=ko.observable(str_dob);
36 self.patient_picture=ko.computed(function(){
37 return webroot_url + '/controller.php' +
38 '?document&retrieve' +
39 '&patient_id=' + pubpid +
42 '&original_file=true' +
43 '&disable_exit=false' +
44 '&show_original=true' +
45 '&context=patient_picture';
48 self.encounterArray=ko.observableArray();
49 self.selectedEncounterID=ko.observable();
50 self.selectedEncounter=ko.observable();
51 self.selectedEncounterID.extend({notify: 'always'});
52 self.selectedEncounterID.subscribe(function(newVal)
54 for(var encIdx=0;encIdx<self.encounterArray().length;encIdx++)
56 var curEnc=self.encounterArray()[encIdx];
57 if(curEnc.id()===newVal)
60 self.selectedEncounter(curEnc);
64 // No valid encounter ID found, so clear selected encounter;
65 self.selectedEncounter(null);