PageRenderTime 40ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/contrib/forms/psychiatrySet/psychiatrisch_onderzoek/view.php

https://github.com/drbowen/openemr
PHP | 233 lines | 175 code | 45 blank | 13 comment | 13 complexity | 88c43685708a8e6a1e30d29d6c77ed54 MD5 | raw file
  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. ////////////////////////////////////////////////////////////////////
  8. include_once("../../globals.php");
  9. include_once("$srcdir/api.inc");
  10. include_once("$srcdir/patient.inc");
  11. $returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
  12. $result = getPatientData($pid, "fname,lname,pid,pubpid,phone_home,pharmacy_id,DOB,DATE_FORMAT(DOB,'%Y%m%d') as DOB_YMD");
  13. $provider_results = sqlQuery("select * from users where username='" . $_SESSION{"authUser"} . "'");
  14. ////////////////////////////////////////////////////////////////////
  15. // Function: getPatientDateOfLastEncounter
  16. function getPatientDateOfLastEncounter( $nPid )
  17. {
  18. // get date of last encounter F103 or F153
  19. $strEventDate = sqlQuery("SELECT MAX(pc_eventDate) AS max
  20. FROM openemr_postcalendar_events
  21. WHERE pc_pid = $nPid
  22. AND pc_apptstatus = '@'
  23. AND ( pc_catid = 17 OR pc_catid = 25 OR pc_catid = 13 OR pc_catid = 26 )
  24. AND pc_eventDate >= '2007-01-01'");
  25. // now check if there was a previous encounter
  26. if( $strEventDate['max'] != "" )
  27. return( $strEventDate['max'] );
  28. else
  29. return( "00-00-0000" );
  30. }
  31. $m_strEventDate = getPatientDateOfLastEncounter( $result['pid'] );
  32. // get autosave id for Psychiatrisch Onderzoek
  33. $vectAutosave = sqlQuery( "SELECT id, autosave_flag, autosave_datetime FROM form_psychiatrisch_onderzoek
  34. WHERE pid = ".$_SESSION["pid"].
  35. " AND groupname='".$_SESSION["authProvider"].
  36. "' AND user='".$_SESSION["authUser"]."' AND
  37. authorized=$userauthorized AND activity=1
  38. AND autosave_flag=1
  39. ORDER by id DESC limit 1" );
  40. if( $vectAutosave['id'] && $vectAutosave['id'] != "" && $vectAutosave['id'] > 0 )
  41. {
  42. $obj = formFetch("form_psychiatrisch_onderzoek", $vectAutosave['id']);
  43. } else
  44. {
  45. $obj = formFetch("form_psychiatrisch_onderzoek", $_GET["id"] );
  46. }
  47. $tmpDate = stripslashes($obj{"datum_onderzoek"});
  48. if( $tmpDate && $tmpDate != '0000-00-00 00:00:00' ) $m_strEventDate = $tmpDate;
  49. ?>
  50. <html>
  51. <head>
  52. <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
  53. </head>
  54. <body <?php echo $top_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
  55. <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
  56. <style type="text/css">
  57. body { font-family:sans-serif; font-size:10pt; font-weight:normal }
  58. .dehead { color:#000000; font-family:sans-serif; font-size:10pt; font-weight:bold;
  59. padding-left:3px; padding-right:3px; }
  60. .detail { color:#000000; font-family:sans-serif; font-size:10pt; font-weight:normal;
  61. padding-left:3px; padding-right:3px; }
  62. </style>
  63. <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
  64. <script type="text/javascript" src="../../../library/dialog.js"></script>
  65. <script type="text/javascript" src="../../../library/textformat.js"></script>
  66. <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
  67. <script type="text/javascript" src="../../../library/dynarch_calendar_en.js"></script>
  68. <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
  69. <script type="text/javascript" src="../../../library/js/jquery121.js"></script>
  70. <?php
  71. if( $_GET["id"] )
  72. $psychiatrisch_onderzoek_id = $_GET["id"];
  73. else
  74. $psychiatrisch_onderzoek_id = "0";
  75. ?>
  76. <script type="text/javascript">
  77. $(document).ready(function(){
  78. autosave();
  79. });
  80. function delete_autosave( )
  81. {
  82. if( confirm("<?php xl('Are you sure you want to completely remove this form?','e'); ?>") )
  83. {
  84. $.ajax(
  85. {
  86. type: "POST",
  87. url: "../../forms/psychiatrisch_onderzoek/delete_autosave.php",
  88. data: "id=" + <?php echo $psychiatrisch_onderzoek_id ?>
  89. ,
  90. cache: false,
  91. success: function( message )
  92. {
  93. $("#timestamp").empty().append(message);
  94. }
  95. });
  96. return true;
  97. } else
  98. {
  99. return false;
  100. }
  101. }
  102. function autosave( )
  103. {
  104. var t = setTimeout("autosave()", 20000);
  105. var a_datum_onderzoek = $("#datum_onderzoek").val();
  106. var a_reden_van_aanmelding = $("#reden_van_aanmelding").val();
  107. var a_conclusie_van_intake = $("#conclusie_van_intake").val();
  108. var a_medicatie = $("#medicatie").val();
  109. var a_anamnese = $("#anamnese").val();
  110. var a_psychiatrisch_onderzoek = $("#psychiatrisch_onderzoek").val();
  111. var a_beschrijvende_conclusie = $("#beschrijvende_conclusie").val();
  112. var a_behandelvoorstel = $("#behandelvoorstel").val();
  113. if( a_datum_onderzoek.length > 0 || a_reden_van_aanmelding.length > 0 )
  114. {
  115. $.ajax(
  116. {
  117. type: "POST",
  118. url: "../../forms/psychiatrisch_onderzoek/autosave.php",
  119. data: "id=" + <?php echo $psychiatrisch_onderzoek_id ?> +
  120. "&datum_onderzoek=" + $("#datum_onderzoek").val() +
  121. "&reden_van_aanmelding=" + a_reden_van_aanmelding +
  122. "&conclusie_van_intake=" + a_conclusie_van_intake +
  123. "&medicatie=" + a_medicatie +
  124. "&anamnese=" + a_anamnese +
  125. "&psychiatrisch_onderzoek=" + a_psychiatrisch_onderzoek +
  126. "&beschrijvende_conclusie=" + a_beschrijvende_conclusie +
  127. "&behandelvoorstel=" + a_behandelvoorstel +
  128. "&mode=update"
  129. ,
  130. cache: false,
  131. success: function( message )
  132. {
  133. $("#timestamp").empty().append(message);
  134. }
  135. });
  136. }
  137. }
  138. </script>
  139. <?php
  140. include_once("$srcdir/api.inc");
  141. //$obj = formFetch("form_psychiatrisch_onderzoek", (int)$_GET["id"]);
  142. ?>
  143. <form method=post action="<?php echo $rootdir?>/forms/psychiatrisch_onderzoek/save.php?mode=update&id=<?php echo $_GET["id"];?>" name="my_form">
  144. <span class="title"><?php xl('Psychiatric Examination','e'); ?></span><Br><br>
  145. <table>
  146. <tr>
  147. <td><?php xl('Examination Date','e'); ?>:</td><td>
  148. <input type='text' name='datum_onderzoek' id='datum_onderzoek' size='10' value='<?php echo $m_strEventDate ?>'
  149. onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='<?php xl('Examination Date','e'); ?>: yyyy-mm-dd'></input>
  150. <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
  151. id='img_last_encounter' border='0' alt='[?]' style='cursor:pointer'
  152. title='<?php xl('Click here to choose a date','e'); ?>'>
  153. <?php
  154. ?></td>
  155. </tr>
  156. </table>
  157. <br><span class=text><?php xl('Reason for Visit','e'); ?></span><br>
  158. <textarea cols=80 rows=5 wrap=virtual name="reden_van_aanmelding" id="reden_van_aanmelding"><?php echo stripslashes($obj{"reden_van_aanmelding"});?></textarea><br>
  159. <br><span class=text><?php xl('Intake Conclusion','e'); ?></span><br>
  160. <textarea cols=80 rows=5 wrap=virtual name="conclusie_van_intake" id="conclusie_van_intake"><?php echo stripslashes($obj{"conclusie_van_intake"});?></textarea><br>
  161. <br><span class=text><?php xl('Medications','e'); ?></span><br>
  162. <textarea cols=80 rows=5 wrap=virtual name="medicatie" id="medicatie"><?php echo stripslashes($obj{"medicatie"});?></textarea><br>
  163. <br><span class=text><?php xl('History','e'); ?></span><br>
  164. <textarea cols=80 rows=5 wrap=virtual name="anamnese" id="anamnese"><?php echo stripslashes($obj{"anamnese"});?></textarea><br>
  165. <br><span class=text><?php xl('Psychiatric Examination','e'); ?></span><br>
  166. <textarea cols=80 rows=5 wrap=virtual name="psychiatrisch_onderzoek" id="psychiatrisch_onderzoek"><?php echo stripslashes($obj{"psychiatrisch_onderzoek"});?></textarea><br>
  167. <br><span class=text><?php xl('Conclusions','e'); ?></span><br>
  168. <textarea cols=80 rows=5 wrap=virtual name="beschrijvende_conclusie" id="beschrijvende_conclusie"><?php echo stripslashes($obj{"beschrijvende_conclusie"});?></textarea><br>
  169. <br><span class=text><?php xl('Treatment Plan','e'); ?></span><br>
  170. <textarea cols=80 rows=5 wrap=virtual name="behandelvoorstel" id="behandelvoorstel"><?php echo stripslashes($obj{"behandelvoorstel"});?></textarea><br>
  171. <table><tr>
  172. <?php
  173. // this to be used/moved above for form header with patient name/etc
  174. ?>
  175. </tr></table>
  176. <br><br>
  177. <a href="javascript:document.my_form.submit();" class="link_submit">[<?php xl('Save','e'); ?>]</a>
  178. <br>
  179. <a href="<?php echo "$rootdir/patient_file/encounter/$returnurl";?>" class="link_submit"
  180. onclick="delete_autosave();top.restoreSession()">[<?php xl('Don\'t Save Changes','e'); ?>]</a>
  181. </form>
  182. <script language='JavaScript'>
  183. Calendar.setup({inputField:"datum_onderzoek", ifFormat:"%Y-%m-%d", button:"img_last_encounter"});
  184. </script>
  185. <div id="timestamp"></div>
  186. <?php
  187. formFooter();
  188. ?>