Fixed quote escaping problem in view.php.
[openemr.git] / interface / forms / psychiatrisch_onderzoek / view.php
blob3697f7ae6ebba2a46dcd5f6a76ff3487e46be1a5
1 <?php
2 ////////////////////////////////////////////////////////////////////
3 // Form: Psychiatrisch Onderzoek
4 // Package: Psychiatric Research - Dutch specific form
5 // Created by: Larry Lart
6 // Version: 1.0 - 29-03-2008
7 ////////////////////////////////////////////////////////////////////
9 include_once("../../globals.php");
10 include_once("$srcdir/api.inc");
11 include_once("$srcdir/patient.inc");
13 $returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
15 $result = getPatientData($pid, "fname,lname,pid,pubpid,phone_home,pharmacy_id,DOB,DATE_FORMAT(DOB,'%Y%m%d') as DOB_YMD");
16 $provider_results = sqlQuery("select * from users where username='" . $_SESSION{"authUser"} . "'");
18 ////////////////////////////////////////////////////////////////////
19 // Function: getPatientDateOfLastEncounter
20 function getPatientDateOfLastEncounter( $nPid )
22 // get date of last encounter F103 or F153
23 $strEventDate = sqlQuery("SELECT MAX(pc_eventDate) AS max
24 FROM openemr_postcalendar_events
25 WHERE pc_pid = $nPid
26 AND pc_apptstatus = '@'
27 AND ( pc_catid = 17 OR pc_catid = 25 OR pc_catid = 13 OR pc_catid = 26 )
28 AND pc_eventDate >= '2007-01-01'");
30 // now check if there was a previous encounter
31 if( $strEventDate['max'] != "" )
32 return( $strEventDate['max'] );
33 else
34 return( "00-00-0000" );
37 $m_strEventDate = getPatientDateOfLastEncounter( $result['pid'] );
39 // get autosave id for Psychiatrisch Onderzoek
40 $vectAutosave = sqlQuery( "SELECT id, autosave_flag, autosave_datetime FROM form_psychiatrisch_onderzoek
41 WHERE pid = ".$_SESSION["pid"].
42 " AND groupname='".$_SESSION["authProvider"].
43 "' AND user='".$_SESSION["authUser"]."' AND
44 authorized=$userauthorized AND activity=1
45 AND autosave_flag=1
46 ORDER by id DESC limit 1" );
49 if( $vectAutosave['id'] && $vectAutosave['id'] != "" && $vectAutosave['id'] > 0 )
51 $obj = formFetch("form_psychiatrisch_onderzoek", $vectAutosave['id']);
53 } else
55 $obj = formFetch("form_psychiatrisch_onderzoek", $_GET["id"] );
58 $tmpDate = stripslashes($obj{"datum_onderzoek"});
59 if( $tmpDate && $tmpDate != '0000-00-00 00:00:00' ) $m_strEventDate = $tmpDate;
63 <html>
64 <head>
65 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
66 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
67 </head>
69 <body <?echo $top_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
71 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
73 <style type="text/css">
74 body { font-family:sans-serif; font-size:10pt; font-weight:normal }
75 .dehead { color:#000000; font-family:sans-serif; font-size:10pt; font-weight:bold;
76 padding-left:3px; padding-right:3px; }
77 .detail { color:#000000; font-family:sans-serif; font-size:10pt; font-weight:normal;
78 padding-left:3px; padding-right:3px; }
79 </style>
81 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
82 <script type="text/javascript" src="../../../library/dialog.js"></script>
83 <script type="text/javascript" src="../../../library/textformat.js"></script>
84 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
85 <script type="text/javascript" src="../../../library/dynarch_calendar_en.js"></script>
86 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
88 <script type="text/javascript" src="../../../library/js/jquery121.js"></script>
90 <?php
92 if( $_GET["id"] )
93 $psychiatrisch_onderzoek_id = $_GET["id"];
94 else
95 $psychiatrisch_onderzoek_id = "0";
98 <script type="text/javascript">
99 $(document).ready(function(){
100 autosave();
104 function delete_autosave( )
106 if( confirm('Are you sure you want to completely remove this form?') )
108 $.ajax(
110 type: "POST",
111 url: "../../forms/psychiatrisch_onderzoek/delete_autosave.php",
112 data: "id=" + <?php echo $psychiatrisch_onderzoek_id ?>
114 cache: false,
115 success: function( message )
117 $("#timestamp").empty().append(message);
120 return true;
122 } else
124 return false;
130 function autosave( )
132 var t = setTimeout("autosave()", 20000);
134 var a_datum_onderzoek = $("#datum_onderzoek").val();
135 var a_reden_van_aanmelding = $("#reden_van_aanmelding").val();
136 var a_conclusie_van_intake = $("#conclusie_van_intake").val();
137 var a_medicatie = $("#medicatie").val();
138 var a_anamnese = $("#anamnese").val();
139 var a_psychiatrisch_onderzoek = $("#psychiatrisch_onderzoek").val();
140 var a_beschrijvende_conclusie = $("#beschrijvende_conclusie").val();
141 var a_behandelvoorstel = $("#behandelvoorstel").val();
143 if( a_datum_onderzoek.length > 0 || a_reden_van_aanmelding.length > 0 )
145 $.ajax(
147 type: "POST",
148 url: "../../forms/psychiatrisch_onderzoek/autosave.php",
149 data: "id=" + <?php echo $psychiatrisch_onderzoek_id ?> +
150 "&datum_onderzoek=" + $("#datum_onderzoek").val() +
151 "&reden_van_aanmelding=" + a_reden_van_aanmelding +
152 "&conclusie_van_intake=" + a_conclusie_van_intake +
153 "&medicatie=" + a_medicatie +
154 "&anamnese=" + a_anamnese +
155 "&psychiatrisch_onderzoek=" + a_psychiatrisch_onderzoek +
156 "&beschrijvende_conclusie=" + a_beschrijvende_conclusie +
157 "&behandelvoorstel=" + a_behandelvoorstel +
158 "&mode=update"
160 cache: false,
161 success: function( message )
163 $("#timestamp").empty().append(message);
170 </script>
172 <?php
173 include_once("$srcdir/api.inc");
174 //$obj = formFetch("form_psychiatrisch_onderzoek", (int)$_GET["id"]);
178 <form method=post action="<?echo $rootdir?>/forms/psychiatrisch_onderzoek/save.php?mode=update&id=<?echo $_GET["id"];?>" name="my_form">
179 <span class="title">Psychiatrisch Onderzoek</span><Br><br>
181 <span class=text>Psychiatrisch Onderzoek</span><br>
183 <table>
184 <tr>
185 <td>Datum onderzoek:</td><td>
186 <input type='text' name='datum_onderzoek' id='datum_onderzoek' size='10' value='<?php echo $m_strEventDate ?>'
187 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='Datum onderzoek: yyyy-mm-dd'></input>
188 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
189 id='img_last_encounter' border='0' alt='[?]' style='cursor:pointer'
190 title='<?php xl('Click here to choose a date','e'); ?>'>
193 <?php
195 ?></td>
196 </tr>
197 </table>
199 <br><span class=text>Reden van aanmelding</span><br>
200 <textarea cols=80 rows=5 wrap=virtual name="reden_van_aanmelding" id="reden_van_aanmelding"><?php echo stripslashes($obj{"reden_van_aanmelding"});?></textarea><br>
201 <br><span class=text>Conclusie van intake:</span><br>
202 <textarea cols=80 rows=5 wrap=virtual name="conclusie_van_intake" id="conclusie_van_intake"><?php echo stripslashes($obj{"conclusie_van_intake"});?></textarea><br>
203 <br><span class=text>Medicatie:</span><br>
204 <textarea cols=80 rows=5 wrap=virtual name="medicatie" id="medicatie"><?php echo stripslashes($obj{"medicatie"});?></textarea><br>
205 <br><span class=text>Anamnese:</span><br>
206 <textarea cols=80 rows=5 wrap=virtual name="anamnese" id="anamnese"><?php echo stripslashes($obj{"anamnese"});?></textarea><br>
207 <br><span class=text>Psychiatrisch onderzoek i.e.z.</span><br>
208 <textarea cols=80 rows=5 wrap=virtual name="psychiatrisch_onderzoek" id="psychiatrisch_onderzoek"><?php echo stripslashes($obj{"psychiatrisch_onderzoek"});?></textarea><br>
209 <br><span class=text>Beschrijvende conclusie</span><br>
210 <textarea cols=80 rows=5 wrap=virtual name="beschrijvende_conclusie" id="beschrijvende_conclusie"><?php echo stripslashes($obj{"beschrijvende_conclusie"});?></textarea><br>
211 <br><span class=text>Behandelvoorstel</span><br>
212 <textarea cols=80 rows=5 wrap=virtual name="behandelvoorstel" id="behandelvoorstel"><?php echo stripslashes($obj{"behandelvoorstel"});?></textarea><br>
214 <table><tr>
215 <?php
216 // this to be used/moved above for form header with patient name/etc
218 </tr></table>
220 <br><br><span style="margin: 5px; border: 1px solid green; font-size: 0.8em; padding: 3px;">add note here ?????</span>
222 <br><br>
223 <a href="javascript:document.my_form.submit();" class="link_submit">[<?php xl('Save','e'); ?>]</a>
224 <br>
225 <a href="<?echo "$rootdir/patient_file/encounter/$returnurl";?>" class="link_submit"
226 onclick="delete_autosave();top.restoreSession()">[<?php xl('Don\'t Save Changes','e'); ?>]</a>
227 </form>
229 <script language='JavaScript'>
230 Calendar.setup({inputField:"datum_onderzoek", ifFormat:"%Y-%m-%d", button:"img_last_encounter"});
231 </script>
233 <div id="timestamp"></div>
236 <?php
237 formFooter();