Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // EFFECTS JS
- // ====================================================================
- // This file contains all effects, transitions and animatinos between pages.
- // ====================================================================
- var effect = {
- // ====================================================================
- // Physician Flow
- // ====================================================================
- physicianFlow: function() {
- // Hide Patient Table & Results
- $(patientTable).hide();
- $(medicalRecordTable).hide();
- $patientMedical.hide();
- // Show next page
- $patientMedical.fadeIn();
- $(patientUpdate).fadeIn();
- $physicanBtnExam.fadeIn();
- // Change Page Title
- $title.fadeIn().text('Patient Medical Info');
- },
- exam: function() {
- // Fetch the Error
- var errorCheck = effect.validation();
- // Error Checking
- if ( errorCheck.val != 0 ) {
- // Hide any Alerts
- $alert.hide();
- // Hide Patient Update Info
- $(patientUpdate).hide();
- // Show Progress & next page
- $progress.fadeIn();
- $patientVitals.fadeIn();
- // Change Page Title (Since they're now in the Exam flow.)
- $title.fadeIn().text('Examination');
- // Reset Button
- $(this).text('Continue to Ears, Nose & Throat');
- $(this).off('click').on('click', effect.examEarsNoseThroat);
- // Reset to Top
- effect.pageReset();
- } else {
- // Attach Error Classes & Show Messaging
- $(errorCheck.container).each(function(){
- $(this).parent().addClass('has-error');
- $alert.fadeIn();
- });
- }
- },
- examEarsNoseThroat: function() {
- // Show/Hide Content
- $patientVitals.hide();
- $patientEarsNoseThroat.fadeIn();
- $restartBtn.fadeIn();
- // Update Progress Bar
- $progressBar.attr('aria-valuenow', '11');
- $progressBar.attr('style', 'width: 11%');
- $progressBar.text('11%');
- // Reset Button
- $(this).text('Continue to Upper Extremity');
- $(this).off('click').on('click', effect.examUpperExtremity);
- // Reset to Top
- effect.pageReset();
- },
- examUpperExtremity: function() {
- // Show/Hide Content
- $patientEarsNoseThroat.hide();
- $patientUpperExtremity.fadeIn();
- // Update Progress Bar
- $progressBar.attr('aria-valuenow', '22');
- $progressBar.attr('style', 'width: 22%');
- $progressBar.text('22%');
- // Reset Button
- $(this).text('Continue to Lower Extremity');
- $(this).off('click').on('click', effect.examLowerExtremity);
- // Reset to Top
- effect.pageReset();
- },
- examLowerExtremity: function() {
- // Show/Hide Content
- $patientUpperExtremity.hide();
- $patientLowerExtremity.fadeIn();
- // Update Progress Bar
- $progressBar.attr('aria-valuenow', '33');
- $progressBar.attr('style', 'width: 33%');
- $progressBar.text('33%');
- // Reset Button
- $(this).text('Continue to Chest & Lungs');
- $(this).off('click').on('click', effect.examChestLungs);
- // Reset to Top
- effect.pageReset();
- },
- examChestLungs: function() {
- // Show/Hide Content
- $patientLowerExtremity.hide();
- $patientChestLungs.fadeIn();
- // Update Progress Bar
- $progressBar.attr('aria-valuenow', '44');
- $progressBar.attr('style', 'width: 44%');
- $progressBar.text('44%');
- // Reset Button
- $(this).text('Continue to Heart & Blood');
- $(this).off('click').on('click', effect.examHeartBlood);
- // Reset to Top
- effect.pageReset();
- },
- examHeartBlood: function() {
- // Show/Hide Content
- $patientChestLungs.hide();
- $patientHeartBlood.fadeIn();
- // Update Progress Bar
- $progressBar.attr('aria-valuenow', '56');
- $progressBar.attr('style', 'width: 56%');
- $progressBar.text('56%');
- // Reset Button
- $(this).text('Continue to Abdominal');
- $(this).off('click').on('click', effect.examAbdominal);
- // Reset to Top
- effect.pageReset();
- },
- examAbdominal: function() {
- // Show/Hide Content
- $patientHeartBlood.hide();
- $patientAbdominal.fadeIn();
- // Update Progress Bar
- $progressBar.attr('aria-valuenow', '67');
- $progressBar.attr('style', 'width: 67%');
- $progressBar.text('67%');
- // Reset Button
- $(this).text('Continue to Neurological');
- $(this).off('click').on('click', effect.examNeurological);
- // Reset to Top
- effect.pageReset();
- },
- examNeurological: function() {
- // Show/Hide Content
- $patientAbdominal.hide();
- $patientNeurological.fadeIn();
- // Update Progress Bar
- $progressBar.attr('aria-valuenow', '78');
- $progressBar.attr('style', 'width: 78%');
- $progressBar.text('78%');
- // Reset Button
- $(this).text('Continue to Procedure');
- $(this).off('click').on('click', effect.examProcedure);
- // Reset to Top
- effect.pageReset();
- },
- examProcedure: function() {
- // Show/Hide Content
- $patientNeurological.hide();
- $patientProcedure.fadeIn();
- // Update Progress Bar
- $progressBar.attr('aria-valuenow', '89');
- $progressBar.attr('style', 'width: 89%');
- $progressBar.text('89%');
- // Reset Button
- $(this).text('Complete Exam');
- $(this).off('click').on('click', effect.examComplete);
- // Reset to Top
- effect.pageReset();
- },
- examComplete: function() {
- // Show/Hide Content
- $patientProcedure.hide();
- $restartBtn.hide();
- $backBtn.hide();
- $(this).hide();
- $physicanBtnExam.hide();
- // Update Progress Bar
- $progressBar.attr('aria-valuenow', '100');
- $progressBar.attr('style', 'width: 100%');
- $progressBar.text('100%');
- // Fade out the progress bar and fade in the completion screen
- $progress.addClass('success-highlight').delay(2000).fadeOut(1000, function(e){
- $patientComplete.fadeIn();
- });
- },
- patientDDX: function() {
- // Change Page Title
- $title.fadeIn().text('DDX Results & Referrals');
- // Show/Hide Content
- $patientComplete.hide();
- $patientDDX.fadeIn();
- $patientNextBtn.fadeIn();
- },
- patientReferred: function() {
- // Grab the Button ID
- var $rID = $patientDDXRefBtn.prop('id');
- // Change the Button Text & Class to disabled
- $('#' + $rID).text('Referred').addClass('btn-disabled');
- },
- patientNext: function() {
- // Show/Hide Content
- $patientNextBtn.hide();
- $patientDDX.hide();
- $(patientTable).fadeIn();
- // Change Page Title
- $title.fadeIn().text('Find Patient');
- // Scroll to Top table result
- var $offset = $(patientTable).offset();
- $htmlBody.animate({
- scrollTop: $offset.top,
- scrollLeft: $offset.left
- });
- },
- medicalEncounters: function() {
- // Hide Patient Table & Results
- $(patientTable).hide();
- $patientMedical.hide();
- // Show next page
- $(medicalRecordTable).fadeIn();
- // Change Page Title
- $title.fadeIn().text('Medical Encounters');
- },
- referrals: {
- init: function(viewType) {
- // Process & Show Ref data
- referrals.initialize(viewType);
- // Hide Patient Table & Results
- $(medicalInfoPatient).hide();
- $(patientTable).hide();
- $patientMedical.hide();
- $navFileManager.hide();
- $(fileManager).hide();
- $(patientFlowCtn).hide();
- $(patientEncounters).hide();
- $(medicalInfoPatientEdit).hide();
- effect.progress.revert();
- effect.btn.hide();
- // Show sub nav
- $(subNav).fadeIn();
- $navReferrals.fadeIn();
- $searchCtn.fadeIn();
- // Show next page
- $(referralsTable).fadeIn();
- // Change Page Title
- $title.fadeIn().text('Referrals');
- },
- process: function(viewType) {
- // Process & Show Ref data
- referrals.initialize(viewType);
- },
- },
- patientEdit: function() {
- // Hide Patient Table & Results
- $(patientTable).hide();
- $(patientUpdate).hide();
- $(medicalRecordTable).hide();
- $physicanBtnExam.hide();
- $patientVitals.hide();
- effect.progress.revert();
- // Show next page
- $patientMedical.fadeIn();
- $(patientEdit).fadeIn();
- $physicanBtnEdit.fadeIn();
- // Change Page Title
- $title.fadeIn().text('Patient Medical Info');
- },
- patientEditComplete: function() {
- // Hide Patient Table & Results
- $(patientEdit).hide();
- $(patientAdd).hide();
- $physicanBtnEdit.hide();
- // Show next page
- $(patientTable).fadeIn();
- // Change Page Title
- $title.fadeIn().text('Manage Patient(s)');
- },
- addPatient: function(data) {
- if ( $(data).closest('body').prop('id') == 'admin' ) {
- console.log('Admin Add Patient Scope');
- // Hide Patient Table & Results
- $examManager.hide();
- $ddxManager.hide();
- // Show next page
- $patientMedical.fadeIn();
- $(patientAdd).fadeIn();
- $physicanBtnAdd.fadeIn();
- } else {
- console.log('Normal Add Patient Scope');
- // Hide Patient Table & Results
- $searchCtn.hide();
- $(patientTable).hide();
- $(medicalRecordTable).hide();
- $(patientUpdate).hide();
- $physicanBtnExam.hide();
- $patientVitals.hide();
- $genericFiles.hide();
- $labManager.hide();
- $(fileManager).hide();
- $(subNav).hide();
- $(referralsTable).hide();
- $(patientFlowCtn).hide();
- $(patientEncounters).hide();
- $patientFlowPanel.hide();
- $(medicalInfoPatientEdit).hide();
- effect.progress.revert();
- effect.btn.init();
- effect.btn.hideEdit();
- // Show next page
- $patientsMedicalInfoNew.fadeIn();
- $patientMedical.fadeIn();
- $(patientAdd).fadeIn();
- $physicanBtnAdd.fadeIn();
- $(patientUpdate).show();
- // Change Page Title
- $title.fadeIn().text('Patient Medical Info');
- $ptBtn.text('Begin Questionnaire');
- }
- },
- patientAddComplete: function() {
- // Hide Patient Table & Results
- $(patientAdd).hide();
- $physicanBtnAdd.hide();
- // Show next page
- $(patientTable).fadeIn();
- // Change Page Title
- $title.fadeIn().text('Manage Patient(s)');
- },
- files: {
- requiredFiles: function() {
- // Hide Patient Table & Results
- $(medicalInfoPatient).hide();
- $(medicalRecordTable).hide();
- $(patientTable).hide();
- $navReferrals.hide();
- $(referralsTable).hide();
- $genericFiles.hide();
- $labManager.hide();
- $(patientFlowCtn).hide();
- $(patientEncounters).hide();
- $(medicalInfoPatientEdit).hide();
- effect.progress.revert();
- effect.btn.hide();
- // Show
- $(fileManager).fadeIn();
- $requiredFiles.fadeIn();
- $(subNav).fadeIn();
- $navFileManager.fadeIn();
- $searchCtn.fadeIn();
- // Change Page Title
- $title.fadeIn().text('Required Files');
- },
- genericFiles: function() {
- // Hide Patient Table & Results
- $(medicalInfoPatient).hide();
- $(medicalRecordTable).hide();
- $(patientTable).hide();
- $navReferrals.hide();
- $requiredFiles.hide();
- $labManager.hide();
- // Show
- $genericFiles.fadeIn();
- $(subNav).fadeIn();
- $navFileManager.fadeIn();
- effect.btn.init();
- // Change Page Title
- $title.fadeIn().text('Generic Files');
- $ptBtn.fadeIn().html('<span class="glyphicon glyphicon-open-file"></span> Upload New File');
- },
- labManager: function() {
- // Hide Patient Table & Results
- $(medicalInfoPatient).hide();
- $(medicalRecordTable).hide();
- $(patientTable).hide();
- $navReferrals.hide();
- $requiredFiles.hide();
- $genericFiles.hide();
- // Show
- $labManager.fadeIn();
- $(subNav).fadeIn();
- $navFileManager.fadeIn();
- effect.btn.init();
- // Change Page Title
- $title.fadeIn().text('Lab Manager');
- $ptBtn.fadeIn().html('<span class="glyphicon glyphicon-open-file"></span> Upload New File');
- }
- },
- // ====================================================================
- // Patient Flow
- // ====================================================================
- patientFlow: function(data){
- // Fetch the Error
- var errorCheck = effect.validation();
- // alex error overrride
- errorCheck.val = 1;
- // end alex error override
- // Error Checking
- if ( errorCheck.val != 0 ) {
- // Hide any Alerts
- $alert.hide();
- // Hide Patient Update Info
- $(patientUpdate).hide();
- // Show Progress & next page
- $(patientFlowCtn).fadeIn();
- $patientInfo.fadeIn();
- // Insert Restart Button
- $restartBtn.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Insurance');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientInsurance);
- } else {
- $ptBtn.off('click').on('click', effect.patientInsurance);
- }
- // Add Current state to history
- History.addEntry('patientFlow');
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.saveInformation();
- // Reset to Top
- effect.pageReset();
- } else {
- console.log('patient flow errors' + errorCheck.container);
- // Attach Error Classes & Show Messaging
- $(errorCheck.container).each(function(){
- $(this).parent().addClass('has-error');
- $alert.fadeIn();
- });
- }
- },
- patientInsurance: function(data) {
- // Show/Hide Content
- $patientInfo.hide();
- $patientInsurance.fadeIn();
- $backBtn.css('visibility', 'visible');
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Allergies');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientAllergy);
- } else {
- $ptBtn.off('click').on('click', effect.patientAllergy);
- }
- // Add Current state to history
- History.addEntry('patientInsurance');
- console.log('btn id: ' + $id);
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.saveContactInfo();
- // Reset to Top
- effect.pageReset();
- },
- patientAllergy: function(data) {
- // Show/Hide Content
- $patientInsurance.hide();
- $patientAllergy.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Shot History');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientShots);
- } else {
- $ptBtn.off('click').on('click', effect.patientShots);
- }
- // Add Current state to history
- History.addEntry('patientAllergy');
- console.log('btn id: ' + $id);
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.saveInsurance();
- // Reset to Top
- effect.pageReset();
- },
- patientShots: function(data) {
- // Show/Hide Content
- $patientAllergy.hide();
- $patientShots.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Medications');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientMedications);
- } else {
- $ptBtn.off('click').on('click', effect.patientMedications);
- }
- // Add Current state to history
- History.addEntry('patientShots');
- console.log('btn id: ' + $id);
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.saveAllergies();
- // Reset to Top
- effect.pageReset();
- },
- patientMedications: function(data) {
- // Show/Hide Content
- $patientShots.hide();
- $patientMedications.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Family History');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientFamilyHistory);
- } else {
- $ptBtn.off('click').on('click', effect.patientFamilyHistory);
- }
- // Add Current state to history
- History.addEntry('patientMedications');
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.saveShotHistory();
- // Reset to Top
- effect.pageReset();
- },
- patientFamilyHistory: function(data) {
- // Show/Hide Content
- $patientMedications.hide();
- $patientFamilyHistory.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Current Complaint');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientComplaint);
- } else {
- $ptBtn.off('click').on('click', effect.patientComplaint);
- }
- // Add Current state to history
- History.addEntry('patientFamilyHistory');
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.saveMedications();
- // Reset to Top
- effect.pageReset();
- },
- patientComplaint: function(data) {
- // Show/Hide Content
- $patientFamilyHistory.hide();
- $patientComplaint.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to History of Present Illness');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientHPI);
- } else {
- $ptBtn.off('click').on('click', effect.patientHPI);
- }
- // Add Current state to history
- History.addEntry('patientComplaint');
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.saveFamilyHistory();
- // Reset to Top
- effect.pageReset();
- },
- patientHPI: function(data) {
- // Show/Hide Content
- $patientComplaint.hide();
- $patientHPI.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Review of Symptoms');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientReviewSymptoms);
- } else {
- $ptBtn.off('click').on('click', effect.patientReviewSymptoms);
- }
- // Add Current state to history
- History.addEntry('patientHPI');
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.saveCurrentComplaint();
- // Reset to Top
- effect.pageReset();
- },
- patientReviewSymptoms: function(data) {
- // Show/Hide Content
- $patientHPI.hide();
- $patientReviewSymptoms.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Past Medical');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientPastMedical);
- } else {
- $ptBtn.off('click').on('click', effect.patientPastMedical);
- }
- // Add Current state to history
- History.addEntry('patientReviewSymptoms');
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.saveHpi();
- // Reset to Top
- effect.pageReset();
- },
- patientPastMedical: function(data) {
- // Show/Hide Content
- $patientReviewSymptoms.hide();
- $patientPastMedical.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Previous Medications');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientPreviousMedications);
- } else {
- $ptBtn.off('click').on('click', effect.patientPreviousMedications);
- }
- // Add Current state to history
- History.addEntry('patientPastMedical');
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.saveReviewOfSymptoms();
- // Reset to Top
- effect.pageReset();
- },
- patientPreviousMedications: function(data) {
- // Show/Hide Content
- $patientPastMedical.hide();
- $patientPreviousMedications.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Previous Treatments');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientPreviousTreatments);
- } else {
- $ptBtn.off('click').on('click', effect.patientPreviousTreatments);
- }
- // Add Current state to history
- History.addEntry('patientPreviousMedications');
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.savePastMedicalHistory();
- // Reset to Top
- effect.pageReset();
- },
- patientPreviousTreatments: function(data) {
- // Show/Hide Content
- $patientPreviousMedications.hide();
- $patientPreviousTreatments.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Continue to Hospitalizations');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientHospitalizations);
- } else {
- $ptBtn.off('click').on('click', effect.patientHospitalizations);
- }
- // Add Current state to history
- History.addEntry('patientPreviousTreatments');
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.savePreviousMedications();
- // Reset to Top
- effect.pageReset();
- },
- patientHospitalizations: function(data) {
- // Show/Hide Content
- $patientPreviousTreatments.hide();
- $patientHospitalizations.fadeIn();
- // Get the button id and check to see if the button was Clicked vs Swiped
- var $id = $(this).attr('id');
- // Reset Button
- $ptBtn.text('Complete');
- if ( this.id = $id ) {
- $(this).off('click').on('click', effect.patientInfoComplete);
- } else {
- $ptBtn.off('click').on('click', effect.patientInfoComplete);
- }
- // Add Current state to history
- History.addEntry('patientHospitalizations');
- if ( $id != null || $id != undefined || data == 'swipe' ) {
- effect.progress.init();
- }
- // Save Data
- patient.savePreviousTreatments();
- // Reset to Top
- effect.pageReset();
- },
- patientInfoComplete: function() {
- // Save Data
- patient.savePreviousHospitalizations();
- // Show/Hide Content
- $patientHospitalizations.hide();
- $restartBtn.hide();
- $backBtn.hide();
- $ptBtn.hide();
- // Init Progress
- effect.progress.init('1');
- // Fade out the progress bar and fade in the completion screen
- $patientInfoComplete.fadeIn(2000);
- // Footer Fix
- $(footer).addClass('footer-fix');
- },
- symptom: {
- cats: {
- // Drop data from db here?
- name: 'Bleeding'
- },
- types: {
- // Drop data from db here?
- name: 'Trauma / Injury'
- },
- category: function() {
- //$symptomList.fadeIn(500);
- // Fade in text of of Symptom Category
- $symptomCategory.text(effect.symptom.cats.name).fadeIn();
- // Fade in Checkbox and set name of checkbox based on Symptom Category
- $symptomCategoryForm.fadeIn().attr('name', effect.symptom.cats.name);
- },
- result: function() {
- $symptomCategoryCheck.prop('disabled', true);
- $symptomTypeAnswer.fadeIn(1000).attr('name', effect.symptom.types.name);
- },
- restart: function() {
- $symptomList.hide();
- $symptomCategory.empty();
- $symptomCategoryCheck.prop('disabled', false).attr('checked', false).removeAttr('name');
- $symptomTypeAnswer.val('').removeAttr('name').hide();
- },
- // Body Part Hover Effets
- part: {
- knee: function() {
- $markerKnee.stop().fadeToggle();
- $tipKnee.stop().fadeToggle();
- },
- shoulder: function() {
- $markerShoulder.stop().fadeToggle();
- $tipShoulder.stop().fadeToggle();
- }
- }
- },
- list: {
- add: function(data, textValue) {
- var preload = false;
- var $id = $(data).closest('.listForm').attr('id');
- console.log($id);
- var $listType = $('#' + $id + ' select option:selected').text();
- if(typeof textValue !== 'undefined')
- {
- preload = true;
- $listType = textValue;
- }
- num++;
- // Grab row id
- // Add a Medication Condition)
- if ($id == 'medForm' ) {
- if(!preload)
- {
- var $medName = $('#patientDrug').val();
- var $medDose = $('#patientDosage').val();
- var $medRowId = '';
- }
- else
- {
- var $medRowId = $listType.id;
- var $medName = $listType.medName.trim();
- var $medDose = $listType.medDosage.trim();
- $listType = $listType.dosageFrequency.trim();
- }
- //$listType = $medDose +' of ' + $medName + ' ' + $listType + ' times a day';
- var html= '';
- html+= '<tr class="listRow" id="listRow' + num + '">';
- html+= '<input type="hidden" class="hiddenDelId" value="'+$medRowId+'">';
- html+= '<td class="col-md-3 listRecord medname">' + $medName + '</td>';
- html+= '<td class="col-md-3 listRecord medose">' + $medDose + '</td>';
- html+= '<td class="col-md-4 listRecord medfreq">' + $listType;
- if(!preload) html+= ' a day';
- html+= '</td>';
- html+= '<td class="col-md-2 text-right">';
- html+= '<button type="button" class="btn btn-danger removeBtn" alt="Remove" title="Remove">';
- html+= '<div class="glyphicon glyphicon-minus-sign"></div>';
- html+= '</button>';
- html+= '</td>';
- html+= '</tr>';
- // Add a Hospital Condition
- } else if ($id == 'hospForm' ) {
- if(!preload)
- {
- var $hospDate = patient.getDateDropdown('#patientHospMonth', '#patientHospDay', '#patientHospYear');
- var $hospReason = $('#patientHospReason').val();
- var $hospLocation = $('#patientHospLocation').val();
- var $hospRowId = '';
- }
- else
- {
- var $hospRowId = $listType.id;
- var $hospDate = $listType.startDate;
- var $hospReason = $listType.reason;
- var $hospLocation = $listType.location;
- }
- var html= '';
- html+= '<tr class="listRow" id="listRow' + num + '">';
- html+= '<input type="hidden" class="hospHiddenDelId" value="'+$hospRowId+'">';
- //html+= '<td class="col-md-10 listRecord">' + $listType + '</td>';
- html+= '<td class="col-md-3 hospReason">' + $hospReason + '</td>';
- html+= '<td class="col-md-3 hospLoc">' + $hospLocation + '</td>';
- html+= '<td class="col-md-4 hospDate">' + $hospDate + '</td>';
- html+= '<td class="col-md-2 text-right">';
- html+= '<button type="button" class="btn btn-danger removeBtn" alt="Remove" title="Remove">';
- html+= '<div class="glyphicon glyphicon-minus-sign"></div>';
- html+= '</button>';
- html+= '</td>';
- html+= '</tr>';
- // All else (Generic Single Item List)
- } else {
- var html= '';
- html+= '<tr class="listRow" id="listRow' + num + '">';
- html+= '<td class="col-md-10 listRecord">' + $listType + '</td>';
- html+= '<td class="col-md-2 text-right">';
- html+= '<button type="button" class="btn btn-danger removeBtn" alt="Remove" title="Remove">';
- html+= '<div class="glyphicon glyphicon-minus-sign"></div>';
- html+= '</button>';
- html+= '</td>';
- html+= '</tr>';
- }
- $('#' + $id + ' ' + listRecord).fadeIn();
- $('#' + $id + ' ' + listEntry).append(html);
- },
- remove: function(data) {
- var $formId = $(data).closest('.listForm').attr('id');
- // Grab row id
- var $id = $(data).closest('.listRow').attr('id');
- if($formId == 'medForm')
- {
- var delList = $('#medFormDeleteList');
- var oldValue = delList.val();
- var newVal = $('#' + $id + ' .hiddenDelId').val();
- // don't add to delete list if medication was added this session
- if(typeof newVal !== 'undefined' && newVal != '')
- {
- if(oldValue == '')
- delList.val(newVal);
- else
- delList.val(oldValue + ',' + newVal);
- }
- }
- if($formId == 'hospForm')
- {
- var delList = $('#hospFormDeleteList');
- var oldValue = delList.val();
- var newVal = $('#' + $id + ' .hospHiddenDelId').val();
- // don't add to delete list if medication was added this session
- if(typeof newVal !== 'undefined' && newVal != '')
- {
- if(oldValue == '')
- delList.val(newVal);
- else
- delList.val(oldValue + ',' + newVal);
- }
- }
- // Remove row
- $('#' + $id).remove();
- }
- },
- // ====================================================================
- // Nurse
- // ====================================================================
- nurse: function() {
- $nurseInfo.fadeIn();
- $nurseBtn.off('click').on('click', effect.nurseContactInfo);
- },
- nurseContactInfo: function() {
- $nurseInfo.hide();
- $nurseContactInfo.fadeIn();
- $nurseBtn.text('Continue to Insurance');
- $nurseBtn.off('click').on('click', effect.nurseInsurance);
- // Reset to Top
- effect.pageReset();
- },
- nurseInsurance: function() {
- $nurseContactInfo.hide();
- $nurseInsurance.fadeIn();
- $nurseBtn.text('Complete');
- $nurseBtn.off('click').on('click', effect.nurseComplete);
- // Reset to Top
- effect.pageReset();
- },
- nurseComplete: function() {
- $nurseInsurance.hide();
- $nurseBtn.hide();
- // Reset to Top
- effect.pageReset();
- // Fade out the progress bar and fade in the completion screen
- $patientInfoComplete.fadeIn(2000);
- },
- // ====================================================================
- // Global
- // ====================================================================
- restart: function() {
- try{physician.hideAll();}catch(e){}
- // Hide Titles
- $title.empty();
- if ( $('body').hasClass('patient') ) {
- // Reset Title
- $title.text('Patient Information');
- // Hide any Alerts
- $alert.hide();
- // Show Patient Update Info
- $(patientUpdate).fadeIn();
- $patientFlowPanel.hide();
- $(patientFlowCtn).hide();
- // Hide Buttons
- $restartBtn.hide();
- $backBtn.css('visibility', 'hidden');
- // Reset button to default
- $ptBtn.text('Begin Questionnaire');
- $ptBtn.off('click').on('click', effect.patientFlow);
- } else {
- // Reset Title
- $title.text('Manage Patient(s)');
- // Show/Hide Content Blocks
- $searchCtn.fadeIn();
- $(patientTable).fadeIn();
- $patientMedical.hide();
- $(medicalRecordTable).hide();
- $patientComplete.hide();
- $patientDDX.hide();
- $(patientAdd).hide();
- $physicanBtnAdd.hide();
- $(patientEdit).hide();
- $physicanBtnEdit.hide();
- $genericFiles.hide();
- $labManager.hide();
- $(fileManager).hide();
- $(subNav).hide();
- $(patientUpdate).hide();
- $patientFlowPanel.hide();
- $(patientEncounters).hide();
- $(medicalInfoPatientEdit).hide();
- effect.progress.revert();
- effect.btn.hide();
- // Reset button to default
- $examBtn.text('Start Exam');
- $examBtn.off('click').on('click', effect.exam);
- }
- // Reset to the Home page
- // $(start).slideDown('fast', function(){
- // $(this).removeClass('page-sliver');
- // $(start + ' .container').fadeIn();
- // });
- // Hide Modal
- this.modalClose();
- },
- login: {
- error: function() {
- $(login + ' .alert').text('Error: Your username (or) password is incorrect. Please try again.').fadeIn();
- }
- },
- sort: {
- asc: function(data) {
- $(data).removeClass('glyphicon-triangle-top').addClass('glyphicon-triangle-bottom');
- },
- desc: function(data) {
- $(data).removeClass('glyphicon-triangle-bottom').addClass('glyphicon-triangle-top');
- }
- },
- filter: {
- renderSearch: function(data) {
- // Increment
- num++
- var $ctnName = $(data).closest('.container').prop('id');
- console.log('id: ' + $ctnName);
- if ( $('#' + $ctnName + ' .filter').length == 1 ) {
- var $searchTypeVal = $('.filter0 .search-type option:selected').val();
- var $searchType = $('.filter0 .search-type');
- var $options = $('.filter0 .search-type option');
- } else {
- var $searchTypeVal = $('.filter' + num + ' .search-type option:selected').val();
- var $searchType = $('.filter' + num + ' .search-type');
- var $options = $('.filter' + num + ' .search-type option');
- }
- var $values = $.map($options, function(option) {
- if ( option.value != $searchTypeVal ) {
- return '<option>' + option.value + '</option>';
- }
- });
- // Remove commas from the string
- $values = String($values).replace(/,/g , '');
- $values = String($values).replace('<option>', '<option selected="selected">');
- $searchType.prop('disabled', true);
- var html= '';
- html+= '<div class="row filter filter' + num + '" style="display: none;">';
- html+= '<div class="col-lg-8 col-md-8 col-xs-6">';
- html+= '<div class="input-group">';
- html+= '<span class="input-group-addon" id="basic-addon1">';
- html+= '<span class="glyphicon glyphicon-search" aria-hidden="true"></span>';
- html+= '</span>';
- html+= '<input type="text" class="form-control" placeholder="Type your search string here...">';
- html+= '</div>';
- html+= '</div>';
- html+= '<div class="col-lg-2 col-md-2 col-xs-4">';
- html+= '<select class="form-control search-type">';
- html+= $values;
- html+= '</select>';
- html+= '</div>';
- html+= '<div class="col-lg-2 col-md-2 col-xs-4">';
- html+= '<button type="button" class="btn btn-danger" id="removeFilter' + num + '">Remove Filter</button>';
- html+= '</div>';
- html+= '</div>';
- $(html).appendTo('.form-group').slideDown();
- },
- changeOption: function(data) {
- var $currentSelection = $(data).find('.filter:last .search-type option');
- var $selected = $(data).find('.filter:last .search-type option:selected');
- // Remove current selection
- $currentSelection.removeAttr('selected');
- // Update new selection and refresh selected item
- $selected.attr('selected', 'selected').prop('selected', true);
- $(data).attr('selected');
- },
- removeOption: function(data) {
- if ( $(data).attr('id') == 'removeFilter0' ) {
- var $currentSelection = $('#first input');
- $currentSelection.val('');
- } else {
- var $currentSelection = $(data).closest('.filter');
- var $btn = $(data).attr('id');
- $currentSelection.fadeOut().remove();
- }
- }
- },
- pageReset: function() {
- // Reset to the top of page. (Mostly for smaller resolutions.)
- var offset = $pageWrap.offset();
- $htmlBody.animate({
- scrollTop: offset.top,
- scrollLeft: offset.left
- });
- },
- navClick: function() {
- $(patientEdit).hide();
- $physicanBtnEdit.hide();
- },
- loading: function() {
- arr = {
- 'title': 'Please wait while your Results load...',
- 'content': '<div class="text-center"><span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span></div>'
- }
- this.modalAlert(arr.title, arr.content, 'static', 'false');
- },
- // Progress Function
- progress: {
- init: function(data) {
- console.log('Data: ' + data);
- $progress.fadeIn();
- $flowCount = $('#patientFlow .panel-default').size();
- $percent = $progressBar.attr('aria-valuenow');
- console.log('Current flow: ' + $flowCount);
- console.log('Current Percent: ' + $percent);
- // if ( data == 'start' ) {
- // // If the user is in the first part of the flow, set to 0
- // var panel = 0;
- // } else {
- // Divide Result (# of Panels) & Assign %
- var panel = 100 / $flowCount;
- // }
- var panelRound = Math.round(panel);
- console.log('Panel Round: ' + panelRound);
- if ( data == 'back' ) {
- var addedPercent = Number($percent) - Number(panelRound);
- console.log('back: ' + addedPercent);
- } else {
- var addedPercent = Number($percent) + Number(panelRound);
- console.log('forward: ' + addedPercent);
- }
- console.log('Added Percent: ' + addedPercent);
- var percent = Math.round(addedPercent);
- if ( data != 1 ) {
- console.log('Completion: ' + percent);
- // Update Progress Bar with values
- $progressBar.attr('aria-valuenow', percent);
- $progressBar.attr('style', 'width: ' + percent + '%');
- $progressBar.text(percent + '%');
- } else {
- console.log('Completion is DONE');
- $('.progress-container .well').addClass('success-highlight');
- $progressBar.attr('aria-valuenow', '100');
- $progressBar.attr('style', 'width: 100%');
- $progressBar.text('100%');
- // Fade out the progress bar and fade in the completion screen
- $progress.delay(2000).fadeOut(1000);
- }
- },
- revert: function() {
- $progress.hide();
- $('.progress-container .well').removeClass('success-highlight');
- $progressBar.attr('aria-valuenow', '0');
- $progressBar.attr('style', 'width: 0%');
- $progressBar.text('0%');
- }
- },
- accordion: function(data) {
- var $accordionID = $(data).prop('id');
- $('.' + $accordionID).slideToggle();
- },
- register: function() {
- // Fix footer issue
- $('body#home').css('height', 'auto');
- $registerQ.fadeOut();
- $registerHero.fadeOut();
- $registration.slideDown();
- },
- disableRow: function(data) {
- $(data).addClass('active').addClass('text-muted');
- },
- date: {
- year: function() {
- var start = 1900;
- var end = new Date().getFullYear();
- var options = "";
- for(var year = start ; year <=end; year++){
- options += "<option>"+ year +"</option>";
- }
- $('.year').append(options);
- }
- },
- btn: {
- init: function() {
- $btnWrap.fadeIn();
- $ptBtn.show();
- },
- hide: function() {
- $backBtn.css('visibility', 'hidden');
- $btnWrap.hide();
- $ptBtn.text('');
- },
- hideEdit: function () {
- $('.btn-wrapper-edit').hide();
- }
- },
- other: function(data) {
- var $id = $(data).closest('.columns').attr('id');
- var $id2 = $(data).closest('.rows').attr('id');
- console.log('id2: ' + $id2);
- if ( $('#' + $id).hasClass('columns') ) {
- $('#' + $id + 'Text').fadeToggle();
- } else {
- $('#' + $id2 + 'Text').fadeToggle();
- }
- },
- // ====================================================================
- // Modals
- // ====================================================================
- modal: function() {
- // Grab the Modal Name from the ID attribute
- function modalName() {
- var $modalID = '#' + $modal.prop('id');
- return $modalID;
- }
- return modalName();
- },
- modalAlert: function(title, text, confirmText, cancelText) {
- // Error Checking
- if (title == null || title == undefined || text == null || text == undefined) {
- try{console.log('Incorrect inputs for modal alert');}catch(e){}
- return false;
- }
- // Fetch the modal name
- var name = this.modal();
- if ( confirmText == 'static' && cancelText == 'false' ) {
- console.log('Disabled Modal.');
- // Launch Bootstrap modal with messaging
- $(name).on('show.bs.modal', function() {
- $(name + ' .modal-title').empty().append(title);
- $(name + ' .modal-body p').empty().append(text);
- }).modal({
- backdrop: 'static',
- keyboard: false
- });
- } else {
- console.log('Normal Modal.');
- // Launch Bootstrap modal with messaging
- $(name).on('show.bs.modal', function() {
- $(name + ' .modal-title').empty().append(title);
- $(name + ' .modal-body p').empty().append(text);
- $(name + ' .modal-footer .btn-primary').empty().append(confirmText);
- $(name + ' .modal-footer .btn-default').empty().append(cancelText);
- }).modal('show');
- }
- },
- modalClose: function() {
- // Fetch the modal name
- var modalName = this.modal();
- // Close the modal
- $(modalName).modal('hide');
- },
- // ====================================================================
- // Admin
- // ====================================================================
- examManage: function() {
- //$(patientTable).hide();
- $patientMedical.hide();
- $ddxManager.hide();
- $examManager.fadeIn();
- },
- ddxManage: function() {
- $patientMedical.hide();
- $examManager.hide();
- $ddxManager.fadeIn();
- },
- question: {
- formOpen: function(data) {
- // Pull Click ID to target DOM elements
- var $clickID = $(data).prop('id');
- $('#' + $clickID).closest(questionWrapper).hide();
- $('.' + $clickID).fadeIn();
- },
- formClose: function(data) {
- // Pull Click ID to target DOM elements
- var $clickID = $(data).data('id');
- $('.' + $clickID).hide();
- $('#' + $clickID).closest(questionWrapper).fadeIn();
- }
- },
- answer: {
- formOpen: function(data) {
- // Pull Click ID to target DOM elements
- var $clickID = $(data).prop('id');
- $('#' + $clickID).closest(answerWrapper).hide();
- $('.' + $clickID).fadeIn();
- },
- formClose: function(data) {
- // Pull Click ID to target DOM elements
- var $clickID = $(data).data('id');
- $('.' + $clickID).hide();
- $('#' + $clickID).closest(answerWrapper).fadeIn();
- }
- },
- // ====================================================================
- // ID (This might be removed.)
- // ====================================================================
- patientID: function() {
- // Get the Patient ID to pass
- // var patientID = e.attr('id');
- // console.log('id: ' + patientID);
- },
- // ====================================================================
- // Form Input
- // ====================================================================
- formInput: function() {
- if ( $formInput.parent().hasClass('has-error') ) {
- $formInput.parent().removeClass('has-error');
- }
- },
- // ====================================================================
- // Error Checking
- // ====================================================================
- validation: function() {
- // Grab the Modal Name from the ID attribute
- function input() {
- var $input = $(patientUpdate + ' input');
- $input.each(function(){
- value = $(this).val();
- });
- // Check to see if there's a value
- if ( value === undefined || value === null || value === '' ) {
- var value = 0;
- effect.pageReset();
- }
- return { container: $input, val: value };
- }
- return input();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement