7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../globals.php");
15 use OpenEMR\Common\Csrf\CsrfUtils
;
16 use OpenEMR\Core\Header
;
18 if ($GLOBALS['full_new_patient_form']) {
19 require("new_comprehensive.php");
23 // For a layout field return 0=unused, 1=optional, 2=mandatory.
24 function getLayoutUOR($form_id, $field_id)
26 $crow = sqlQuery("SELECT uor FROM layout_options WHERE " .
27 "form_id = ? AND field_id = ? LIMIT 1", array($form_id, $field_id));
28 return 0 +
$crow['uor'];
31 // Determine if the registration date should be requested.
32 $regstyle = getLayoutUOR('DEM', 'regdate') ?
"" : " style='display:none'";
34 $form_pubpid = $_POST['pubpid' ] ?
trim($_POST['pubpid' ]) : '';
35 $form_title = $_POST['title' ] ?
trim($_POST['title' ]) : '';
36 $form_fname = $_POST['fname' ] ?
trim($_POST['fname' ]) : '';
37 $form_mname = $_POST['mname' ] ?
trim($_POST['mname' ]) : '';
38 $form_lname = $_POST['lname' ] ?
trim($_POST['lname' ]) : '';
39 $form_refsource = $_POST['refsource'] ?
trim($_POST['refsource']) : '';
40 $form_sex = $_POST['sex' ] ?
trim($_POST['sex' ]) : '';
41 $form_refsource = $_POST['refsource'] ?
trim($_POST['refsource']) : '';
42 $form_dob = $_POST['DOB' ] ?
trim($_POST['DOB' ]) : '';
43 $form_regdate = $_POST['regdate' ] ?
trim($_POST['regdate' ]) : date('Y-m-d');
50 Header
::setupHeader('datetime-picker');
51 include_once($GLOBALS['srcdir'] . "/options.js.php");
57 var f
= document
.forms
[0];
58 <?php
if ($GLOBALS['inhouse_pharmacy']) { ?
>
59 if (f
.refsource
.selectedIndex
<= 0) {
60 alert('Please select a referral source!');
64 <?php
if (getLayoutUOR('DEM', 'sex') == 2) { ?
>
65 if (f
.sex
.selectedIndex
<= 0) {
66 alert('Please select a value for sex!');
70 <?php
if (getLayoutUOR('DEM', 'DOB') == 2) { ?
>
71 if (f
.DOB
.value
.length
== 0) {
72 alert('Please select a birth date!');
81 $
('.datepicker').datetimepicker({
82 <?php
$datetimepicker_timepicker = false; ?
>
83 <?php
$datetimepicker_showseconds = false; ?
>
84 <?php
$datetimepicker_formatInput = true; ?
>
85 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
86 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
88 $
('.datetimepicker').datetimepicker({
89 <?php
$datetimepicker_timepicker = true; ?
>
90 <?php
$datetimepicker_showseconds = false; ?
>
91 <?php
$datetimepicker_formatInput = true; ?
>
92 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
93 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
101 <body
class="body_top" onload
="javascript:document.new_patient.fname.focus();">
103 <form name
='new_patient' method
='post' action
="new_patient_save.php"
104 onsubmit
='return validate()'>
105 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
107 <span
class='title'><?php
echo xlt('Add Patient Record'); ?
></span
>
113 <?php
if ($GLOBALS['omit_employers']) { ?
>
114 <input type
='hidden' name
='title' value
='' />
117 <table
class="border-0">
119 <?php
if (!$GLOBALS['omit_employers']) { ?
>
122 <span
class='font-weight-bold'><?php
echo xlt('Title'); ?
>:</span
>
125 <select name
='title'>
127 $ores = sqlStatement("SELECT option_id, title FROM list_options " .
128 "WHERE list_id = 'titles' AND activity = 1 ORDER BY seq");
129 while ($orow = sqlFetchArray($ores)) {
130 echo " <option value='" . attr($orow['option_id']) . "'";
131 if ($orow['option_id'] == $form_title) {
135 echo ">" . text($orow['title']) . "</option>\n";
145 <span
class='font-weight-bold'><?php
echo xlt('First Name'); ?
>: </span
>
148 <input type
='entry' size
='15' name
='fname' value
='<?php echo attr($form_fname); ?>' />
154 <span
class='font-weight-bold'><?php
echo xlt('Middle Name'); ?
>: </span
>
157 <input type
='entry' size
='15' name
='mname' value
='<?php echo attr($form_mname); ?>' />
163 <span
class='font-weight-bold'><?php
echo xlt('Last Name'); ?
>: </span
>
166 <input type
='entry' size
='15' name
='lname' value
='<?php echo attr($form_lname); ?>' />
172 <span
class='font-weight-bold'><?php
echo xlt('Sex'); ?
>: </span
>
176 <option value
=''>Unassigned
</option
>
178 $ores = sqlStatement("SELECT option_id, title FROM list_options " .
179 "WHERE list_id = 'sex' AND activity = 1 ORDER BY seq");
180 while ($orow = sqlFetchArray($ores)) {
181 echo " <option value='" . attr($orow['option_id']) . "'";
182 if ($orow['option_id'] == $form_sex) {
186 echo ">" . text($orow['title']) . "</option>\n";
193 <?php
if ($GLOBALS['inhouse_pharmacy']) { ?
>
196 <span
class='font-weight-bold'><?php
echo xlt('Referral Source'); ?
>: </span
>
199 <select name
='refsource'>
200 <option value
=''><?php
echo xlt("Unassigned"); ?
></option
>
202 $ores = sqlStatement("SELECT option_id, title FROM list_options " .
203 "WHERE list_id = 'refsource' AND activity = 1 ORDER BY seq");
204 while ($orow = sqlFetchArray($ores)) {
205 echo " <option value='" . attr($orow['option_id']) . "'";
206 if ($orow['option_id'] == $form_refsource) {
210 echo ">" . text($orow['title']) . "</option>\n";
220 <span
class='font-weight-bold'><?php
echo xlt('Birth Date'); ?
>:</span
>
223 <input type
='text' size
='10' class='datepicker' name
='DOB' id
='DOB'
224 value
='<?php echo attr($form_dob); ?>' />
228 <tr
<?php
echo $regstyle ?
>>
230 <span
class='font-weight-bold'><?php
echo xlt('Registration Date'); ?
>: </span
>
233 <input type
='text' size
='10' class='datepicker' name
='regdate' id
='regdate'
234 value
='<?php echo attr($form_regdate); ?>' />
240 <span
class='font-weight-bold'><?php
echo xlt('Patient Number'); ?
>: </span
>
243 <input type
='entry' size
='5' name
='pubpid' value
='<?php echo attr($form_pubpid); ?>' />
244 <span
class='text'><?php
echo xlt('omit to autoassign'); ?
>  
;  
; </span
>
251 <input type
='submit' name
='form_create' value
='<?php echo xla('Create
New Patient
'); ?>' />
263 echo "alert(" . xlj('This patient ID is already in use!') . ");\n";