$count = 0; foreach ($value_list as $value) { $retval .= $value; $count++; if ($count < count($value_list)) { $retval .= ", "; } } return $retval; } else { if ($custom_field->fieldTypeId == CustomField::$FIELD_DATE) { $value_yyyy = $name_prefix . "_yyyy"; $value_mm = $name_prefix . "_mm"; $value_dd = $name_prefix . "_dd"; $date_value = $_REQUEST[$value_yyyy] . "-" . $_REQUEST[$value_mm] . "-" . $_REQUEST[$value_dd]; return $date_value; } } } } $patient_id = $_REQUEST['pid2']; $custom_field_list = get_custom_fields_patient(); foreach ($custom_field_list as $custom_field) { $custom_value = get_custom_value($custom_field); $custom_data = new PatientCustomData(); $custom_data->fieldId = $custom_field->id; $custom_data->fieldValue = $custom_value; $custom_data->patientId = $patient_id; add_custom_data_patient($custom_data); } SessionUtil::restore($saved_session);
public function getPatientUpdateForm($pid) { $patient = get_patient_by_id($pid); $lab_config = LabConfig::getById($_SESSION['lab_config_id']); ?> <form name='profile_update_form' id='profile_update_form'> <input type='hidden' value='<?php echo $patient->patientId; ?>' name='patient_id'></input> <input type='hidden' value='0' name='pd_ym' id='pd_ym'></input> <input type='hidden' value='0' name='pd_y' id='pd_y'></input> <table class='hor-minimalist-b'> <tbody> <tr <?php if($lab_config->pid == 0) { echo " style='display:none;' "; } ?>> <td><u><?php echo LangUtil::$generalTerms['PATIENT_ID']; ?></u></td> <td> <input type='text' name='surr_id' id='surr_id' value='<?php echo $patient->surrogateId; ?>' class='uniform_width'></input> </td> </tr> <tr <?php if($lab_config->patientAddl == 0) { echo " style='display:none;' "; } ?>> <td><u><?php echo LangUtil::$generalTerms['ADDL_ID']; ?></u></td> <td> <input type='text' value='<?php echo $patient->addlId; ?>' name='addl_id' class='uniform_width'></input> </td> </tr> <tr> <td><u><?php echo LangUtil::$generalTerms['NAME']; ?></u></td> <td> <input type='text' value='<?php echo $patient->name; ?>' name='name' class='uniform_width'></input> </td> </tr> <tr> <td><u><?php echo LangUtil::$generalTerms['GENDER']; ?></u></td> <td> <select name='sex' class='uniform_width'> <option value='M' <?php if($patient->sex == 'M') echo " selected "; ?> > <?php echo LangUtil::$generalTerms['MALE']; ?> </option> <option value='F' <?php if($patient->sex == 'F') echo " selected "; ?> > <?php echo LangUtil::$generalTerms['FEMALE']; ?> </option> </select> </tr> <tr> <td><u title='Enter either Age or Date of Birth'><?php echo LangUtil::$generalTerms['AGE']; ?></u></td> <td> <?php if($patient->age != null and $patient->age != "" and $patient->age != "0") { ?> <input type='text' name='age' id='age' value='<?php echo $patient->age; ?>' class='uniform_width'></input> <?php } else { ?> <input type='text' name='age' id='age' value='' class='uniform_width'></input> <?php } ?> <select name='age_param' id='age_param'> <option value='1'><?php echo LangUtil::$generalTerms['YEARS']; ?></option> <option value='2'><?php echo LangUtil::$generalTerms['MONTHS']; ?></option> </select> </td> </tr> <tr valign='top'> <td><u title='Enter either Age or Date of Birth'><?php echo LangUtil::$generalTerms['DOB']; ?></u></td> <td><?php $value_list = array(); $name_list = array(); $id_list = array(); $name_list[] = "yyyy"; $name_list[] = "mm"; $name_list[] = "dd"; $id_list = $name_list; if($patient->partialDob != null && $patient->partialDob != "") { # Partial DoB value is present if(strpos($patient->partialDob, "-") === false) { # Year-only available $value_list[] = $patient->partialDob; $value_list[] = ""; $value_list[] = ""; } else { # Year and month available $partial_dob_parts = explode("-", $patient->partialDob); $value_list[] = $partial_dob_parts[0]; $value_list[] = $partial_dob_parts[1]; $value_list[] = ""; } } else if($patient->dob == null || $patient->dob == "") { # DoB not previously entered $value_list[] = ""; $value_list[] = ""; $value_list[] = ""; } else { # Previous DoB value exists $dob_parts = explode("-", $patient->dob); $value_list = $dob_parts; } $this->getDatePicker($name_list, $id_list, $value_list, $show_format=true); ?> </td> </tr> <?php # Custom fields here $custom_field_list = get_custom_fields_patient(); $custom_data_list = get_custom_data_patient($patient->patientId); $custom_data_map = array(); foreach($custom_data_list as $custom_data) { $custom_data_map[$custom_data->fieldId] = $custom_data->fieldValue; } foreach($custom_field_list as $custom_field) { ?> <tr valign='top'> <td><u><?php echo $custom_field->fieldName; ?></u></td> <td> <?php if(isset($custom_data_map[$custom_field->id])) $field_value = $custom_data_map[$custom_field->id]; else $field_value = ""; $this->getCustomFormField($custom_field, $field_value); ?> </td> </tr> <?php } ?> <tr> <td> </td> <td> <input type='button' value='<?php echo LangUtil::$generalTerms['CMD_UPDATE']; ?>' onclick='javascript:update_profile();'></input> <a href='javascript:toggle_profile_divs();'><?php echo LangUtil::$generalTerms['CMD_CANCEL']; ?></a> <span id='update_profile_progress' style='display:none;'><?php $this->getProgressSpinner(LangUtil::$generalTerms['CMD_SUBMITTING']); ?></span> </td> </tr> </tbody> </table> </form> <?php }
public function generateHTML($fieldName) { if (self::$custom_field_list == null) { self::$custom_field_list = get_custom_fields_patient(); foreach (self::$custom_field_list as $custom_field) { if ($custom_field->flag == NULL) { array_push(self::$custom_field_name_array, $custom_field->fieldName); } } } if ($fieldName == "pid" || $fieldName == "Patient ID") { CustomFieldOrderGeneration_Patient::generate_patient_Id(); } else { if ($fieldName == "patientaddl" || $fieldName == "patientAddl" || $fieldName == "Patient Addl ID") { CustomFieldOrderGeneration_Patient::generate_patient_addl(); } else { if ($fieldName == "rdate" || $fieldName == "Registration Date") { //CustomFieldOrderGeneration_Patient::generate_patient_rdate(); } else { if ($fieldName == "dnum" || $fieldName == "Daily Number") { CustomFieldOrderGeneration_Patient::generate_patient_dailynum(); } else { if ($fieldName == "pname" || $fieldName == "Patient Name") { CustomFieldOrderGeneration_Patient::generate_patient_name(); } else { if ($fieldName == "sex" || $fieldName == "Sex") { CustomFieldOrderGeneration_Patient::generate_patient_sex(); } else { if (in_array($fieldName, self::$custom_field_name_array)) { $custom_field_obj = get_custom_fields_patient_by_name($fieldName); CustomFieldOrderGeneration_Patient::generate_patient_custom_fields($custom_field_obj); } } } } } } } }