Fixed php short tags
[openemr.git] / contrib / forms / psychiatrySet / psychiatrisch_onderzoek / view.php
blobd68e509f629a739d6e36306266a32cc42ddc0a4a
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="<?php echo $css_header;?>" type="text/css">
66 </head>
68 <body <?php echo $top_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
70 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
72 <style type="text/css">
73 body { font-family:sans-serif; font-size:10pt; font-weight:normal }
74 .dehead { color:#000000; font-family:sans-serif; font-size:10pt; font-weight:bold;
75 padding-left:3px; padding-right:3px; }
76 .detail { color:#000000; font-family:sans-serif; font-size:10pt; font-weight:normal;
77 padding-left:3px; padding-right:3px; }
78 </style>
80 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
81 <script type="text/javascript" src="../../../library/dialog.js"></script>
82 <script type="text/javascript" src="../../../library/textformat.js"></script>
83 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
84 <script type="text/javascript" src="../../../library/dynarch_calendar_en.js"></script>
85 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
87 <script type="text/javascript" src="../../../library/js/jquery121.js"></script>
89 <?php
91 if( $_GET["id"] )
92 $psychiatrisch_onderzoek_id = $_GET["id"];
93 else
94 $psychiatrisch_onderzoek_id = "0";
97 <script type="text/javascript">
98 $(document).ready(function(){
99 autosave();
103 function delete_autosave( )
105 if( confirm("<?php xl('Are you sure you want to completely remove this form?','e'); ?>") )
107 $.ajax(
109 type: "POST",
110 url: "../../forms/psychiatrisch_onderzoek/delete_autosave.php",
111 data: "id=" + <?php echo $psychiatrisch_onderzoek_id ?>
113 cache: false,
114 success: function( message )
116 $("#timestamp").empty().append(message);
119 return true;
121 } else
123 return false;
129 function autosave( )
131 var t = setTimeout("autosave()", 20000);
133 var a_datum_onderzoek = $("#datum_onderzoek").val();
134 var a_reden_van_aanmelding = $("#reden_van_aanmelding").val();
135 var a_conclusie_van_intake = $("#conclusie_van_intake").val();
136 var a_medicatie = $("#medicatie").val();
137 var a_anamnese = $("#anamnese").val();
138 var a_psychiatrisch_onderzoek = $("#psychiatrisch_onderzoek").val();
139 var a_beschrijvende_conclusie = $("#beschrijvende_conclusie").val();
140 var a_behandelvoorstel = $("#behandelvoorstel").val();
142 if( a_datum_onderzoek.length > 0 || a_reden_van_aanmelding.length > 0 )
144 $.ajax(
146 type: "POST",
147 url: "../../forms/psychiatrisch_onderzoek/autosave.php",
148 data: "id=" + <?php echo $psychiatrisch_onderzoek_id ?> +
149 "&datum_onderzoek=" + $("#datum_onderzoek").val() +
150 "&reden_van_aanmelding=" + a_reden_van_aanmelding +
151 "&conclusie_van_intake=" + a_conclusie_van_intake +
152 "&medicatie=" + a_medicatie +
153 "&anamnese=" + a_anamnese +
154 "&psychiatrisch_onderzoek=" + a_psychiatrisch_onderzoek +
155 "&beschrijvende_conclusie=" + a_beschrijvende_conclusie +
156 "&behandelvoorstel=" + a_behandelvoorstel +
157 "&mode=update"
159 cache: false,
160 success: function( message )
162 $("#timestamp").empty().append(message);
169 </script>
171 <?php
172 include_once("$srcdir/api.inc");
173 //$obj = formFetch("form_psychiatrisch_onderzoek", (int)$_GET["id"]);
177 <form method=post action="<?php echo $rootdir?>/forms/psychiatrisch_onderzoek/save.php?mode=update&id=<?php echo $_GET["id"];?>" name="my_form">
178 <span class="title"><?php xl('Psychiatric Examination','e'); ?></span><Br><br>
180 <table>
181 <tr>
182 <td><?php xl('Examination Date','e'); ?>:</td><td>
183 <input type='text' name='datum_onderzoek' id='datum_onderzoek' size='10' value='<?php echo $m_strEventDate ?>'
184 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='<?php xl('Examination Date','e'); ?>: yyyy-mm-dd'></input>
185 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
186 id='img_last_encounter' border='0' alt='[?]' style='cursor:pointer'
187 title='<?php xl('Click here to choose a date','e'); ?>'>
190 <?php
192 ?></td>
193 </tr>
194 </table>
196 <br><span class=text><?php xl('Reason for Visit','e'); ?></span><br>
197 <textarea cols=80 rows=5 wrap=virtual name="reden_van_aanmelding" id="reden_van_aanmelding"><?php echo stripslashes($obj{"reden_van_aanmelding"});?></textarea><br>
198 <br><span class=text><?php xl('Intake Conclusion','e'); ?></span><br>
199 <textarea cols=80 rows=5 wrap=virtual name="conclusie_van_intake" id="conclusie_van_intake"><?php echo stripslashes($obj{"conclusie_van_intake"});?></textarea><br>
200 <br><span class=text><?php xl('Medications','e'); ?></span><br>
201 <textarea cols=80 rows=5 wrap=virtual name="medicatie" id="medicatie"><?php echo stripslashes($obj{"medicatie"});?></textarea><br>
202 <br><span class=text><?php xl('History','e'); ?></span><br>
203 <textarea cols=80 rows=5 wrap=virtual name="anamnese" id="anamnese"><?php echo stripslashes($obj{"anamnese"});?></textarea><br>
204 <br><span class=text><?php xl('Psychiatric Examination','e'); ?></span><br>
205 <textarea cols=80 rows=5 wrap=virtual name="psychiatrisch_onderzoek" id="psychiatrisch_onderzoek"><?php echo stripslashes($obj{"psychiatrisch_onderzoek"});?></textarea><br>
206 <br><span class=text><?php xl('Conclusions','e'); ?></span><br>
207 <textarea cols=80 rows=5 wrap=virtual name="beschrijvende_conclusie" id="beschrijvende_conclusie"><?php echo stripslashes($obj{"beschrijvende_conclusie"});?></textarea><br>
208 <br><span class=text><?php xl('Treatment Plan','e'); ?></span><br>
209 <textarea cols=80 rows=5 wrap=virtual name="behandelvoorstel" id="behandelvoorstel"><?php echo stripslashes($obj{"behandelvoorstel"});?></textarea><br>
211 <table><tr>
212 <?php
213 // this to be used/moved above for form header with patient name/etc
215 </tr></table>
217 <br><br>
218 <a href="javascript:document.my_form.submit();" class="link_submit">[<?php xl('Save','e'); ?>]</a>
219 <br>
220 <a href="<?php echo "$rootdir/patient_file/encounter/$returnurl";?>" class="link_submit"
221 onclick="delete_autosave();top.restoreSession()">[<?php xl('Don\'t Save Changes','e'); ?>]</a>
222 </form>
224 <script language='JavaScript'>
225 Calendar.setup({inputField:"datum_onderzoek", ifFormat:"%Y-%m-%d", button:"img_last_encounter"});
226 </script>
228 <div id="timestamp"></div>
231 <?php
232 formFooter();