import com.imt.intimamedia.events.patient.SearchPatientEvent; import com.imt.intimamedia.events.patient.UpdateAppointmentEvent; import com.imt.intimamedia.model.ApplicationModelLocator; import com.imt.intimamedia.views.common.ImtToaster; import com.imt.intimamedia.views.physician.patient.AtherosclerosisRiskFactors; import com.imt.intimamedia.views.physician.patient.FamilyHistory; import com.imt.intimamedia.views.physician.patient.PatientFile; import com.imt.intimamedia.vo.AtsVo; import com.imt.intimamedia.vo.CvExaminatorVo; import com.imt.intimamedia.vo.FamilyHistoryVo; import com.imt.intimamedia.vo.PersonalHistoryVo; import com.imt.intimamedia.vo.TobaccoVo; import mx.containers.Box; import mx.controls.Alert; import mx.controls.Image; import mx.controls.LinkButton; import mx.events.ItemClickEvent; import mx.resources.ResourceManager; [Embed(source="images/patient/startArrowRedTimeLine.png")] [Bindable] public var startArrowRedTimeLine : Class; [Embed(source="images/patient/endArrowRedTimeLine.png")] [Bindable] public var endArrowRedTimeLine : Class; [Embed(source="images/patient/startArrowGreyTimeLine.png")] [Bindable] public var startArrowGreyTimeLine : Class; [Embed(source="images/patient/endArrowGreyTimeLine.png")] [Bindable] public var endArrowGreyTimeLine : Class; private var _currentStartArrow : Image; private var _currentEndArrow : Image; private var _currentBox : Box; private var _currentLinkButton : LinkButton; [Bindable] private var _model : ApplicationModelLocator = ApplicationModelLocator.getInstance(); import mx.events.BrowserChangeEvent; import mx.managers.BrowserManager; import mx.managers.IBrowserManager; import mx.utils.URLUtil; import com.imt.intimamedia.vo.AppointmentVo; import mx.core.Application; import com.imt.intimamedia.helpers.HelpUtils; private var browserManager:IBrowserManager; private function showView() : void { displayPatientList(); // load help if needed if (ApplicationModelLocator.getInstance().connectedUser.help) { HelpUtils.loadHelp(HelpUtils.buildPatientHelpPages(), 0); } } private function creationCompleteHandler() : void { //loadBrowserManager(); } private function loadBrowserManager() : void { /*browserManager = BrowserManager.getInstance(); browserManager.addEventListener( BrowserChangeEvent.BROWSER_URL_CHANGE, parseUrl )*/ } private function parseUrl(e:BrowserChangeEvent = null):void { /* var o:Object = URLUtil.stringToObject(browserManager.fragment); if (!o.b) { ApplicationModelLocator.getInstance().application.menuPhysician.selectedIndex = o.p; patientView.selectedIndex = 0; browserManager.setFragment("p=" + o.p); } else patientView.selectedIndex = o.b; */ } private function updateUrl():void { //browserManager.setFragment("b=" + patientView.selectedIndex); } private function displayPatientList() : void { selectView(patientStart, patientEnd, patientBox, patientLinkButton, 0); //patientFile.dg.enabled = false; new SearchPatientEvent( "", this ).dispatch(); } public function setSearchPatientText() : void { /* nothing to do */ return; } public function selectView( start : Image, end : Image, box : Box, linkButton : LinkButton, index : int ) : void { var toastMessage : ImtToaster; // no patient selected or created if (index && (_model.patientSelected.uid == "" || !_model.patientActive)) { toastMessage = new ImtToaster(); toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'warning.use'); toastMessage.message = ResourceManager.getInstance().getString('labels', 'warning.choosePatient'); toastMessage.timeToLive = 6; toastMessage.level = ImtToaster.WARNING; ApplicationModelLocator.getInstance().toaster.toast( toastMessage ); return; } // patient selected but not appointment if (index && _model.noAppointmentSelected) { toastMessage = new ImtToaster(); toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'warning.use'); toastMessage.message = ResourceManager.getInstance().getString('labels', 'warning.chooseAppointment'); toastMessage.timeToLive = 6; toastMessage.level = ImtToaster.WARNING; _model.toaster.toast( toastMessage ); return; } if ( _currentStartArrow == null ) { _currentStartArrow = patientStart; _currentEndArrow = patientEnd; _currentBox = patientBox; _currentLinkButton = patientLinkButton; } _currentStartArrow.source = startArrowGreyTimeLine; _currentEndArrow.source = endArrowGreyTimeLine; _currentBox.setStyle( "styleName", "backgroundGreyTimeLine" ); _currentLinkButton.setStyle( "styleName", "linkButtonGreyTimeLine" ); start.source = startArrowRedTimeLine; end.source = endArrowRedTimeLine; box.setStyle( "styleName", "backgroundRedTimeLine" ); linkButton.setStyle( "styleName", "linkButtonRedTimeLine" ); patientView.selectedIndex = index; _currentStartArrow = start; _currentEndArrow = end; _currentBox = box; _currentLinkButton = linkButton; if (!_model.viewPatient) { switch (index) { case 2: updateAts(); break; case 3: updatePersonalHistory(); break; case 4: updateFamilyHistory(); break; case 5: updateCve(); break; default: break; } } //if (index == 0) //this.patientFile.updatePatientDatagrid(); } private function showHelp() : void { patientFile.showHelp(patientFile.patientTabHelp); } public function updateAts() : void { var atsVo : AtsVo = new AtsVo(); atsVo.hta = ats.htaButtonGroup.selectedValue; atsVo.htaDuration = parseInt(ats.htaDurationTextInput.text); atsVo.htg = ats.htgButtonGroup.selectedValue; atsVo.htgDuration = parseInt(ats.htgDurationTextInput.text); atsVo.hct = ats.hctButtonGroup.selectedValue; atsVo.hctDuration = parseInt(ats.hctDurationTextInput.text); atsVo.diabete = ats.diabeteButtonGroup.selectedValue; atsVo.diabeteDuration = parseInt(ats.diabeteDurationTextInput.text); var tobaccoVo : TobaccoVo = new TobaccoVo(); tobaccoVo.smoke = ats.smokeButtonGroup.selectedValue; tobaccoVo.age = ats.smokeDurationNumericStepper.value; tobaccoVo.cigarettesPerDay = ats.cbdNumericStepper.value; tobaccoVo.ageStopSmoking = ats.stopSmokingDurationNumericStepper.value; tobaccoVo.paquetYear = ats.pbyNumericStepper.value; _model.appointmentSelected.ats = atsVo; _model.appointmentSelected.tobacco = tobaccoVo; } public function updatePersonalHistory() : void { var personalHistoryVo : PersonalHistoryVo = new PersonalHistoryVo(); personalHistoryVo.coronaryDisease = personalHistory.coronaryButtonGroup.selectedValue; if( personalHistory.coronaryDiseaseTypeComboBox.selectedItem != null ) personalHistoryVo.typeCoronaryDisease = personalHistory.coronaryDiseaseTypeComboBox.selectedItem.code; personalHistoryVo.aic = personalHistory.aicButtonGroup.selectedValue; personalHistoryVo.numberAic = personalHistory.numberAicNumericStepper.value; personalHistoryVo.lastCoronaryDiseaseAge = personalHistory.lastCoronaryDiseaseAgeTextInput.text; personalHistoryVo.lastAicAge = personalHistory.lastAicAgeTextInput.text; if( personalHistory.aicTypeComboBox.selectedItem != null ) personalHistoryVo.typeAic = personalHistory.aicTypeComboBox.selectedItem.code; if( personalHistory.ethiologyTypeComboBox.selectedItem != null ) personalHistoryVo.ethiologyAic = personalHistory.ethiologyTypeComboBox.selectedItem.code; _model.appointmentSelected.personalHistory = personalHistoryVo; } public function updateFamilyHistory() : void { var familyHistoryVo : FamilyHistoryVo = new FamilyHistoryVo(); familyHistoryVo.fatherCoronaryPathology = familyHistory.fatherCoronaryButtonGroup.selectedValue; familyHistoryVo.fatherCoronaryPathologyAge = parseInt(familyHistory.fatherCoronaryAgeTextInput.text); familyHistoryVo.fatherVascularPathology = familyHistory.fatherVascularButtonGroup.selectedValue; familyHistoryVo.fatherVascularPathologyAge = parseInt(familyHistory.fatherVascularAgeTextInput.text); familyHistoryVo.motherCoronaryPathology = familyHistory.motherCoronaryButtonGroup.selectedValue; familyHistoryVo.motherCoronaryPathologyAge = parseInt(familyHistory.motherCoronaryAgeTextInput.text); familyHistoryVo.motherVascularPathology = familyHistory.motherVascularButtonGroup.selectedValue; familyHistoryVo.motherVascularPathologyAge = parseInt(familyHistory.motherVascularAgeTextInput.text); familyHistoryVo.bsCoronaryPathology = familyHistory.bsCoronaryButtonGroup.selectedValue; familyHistoryVo.bsCoronaryPathologyAge = parseInt(familyHistory.bsCoronaryAgeTextInput.text); familyHistoryVo.bsVascularPathology = familyHistory.bsVascularButtonGroup.selectedValue; familyHistoryVo.bsVascularPathologyAge = parseInt(familyHistory.bsVascularAgeTextInput.text); _model.appointmentSelected.familyHistory = familyHistoryVo; } public function updateCve() : void { var cvExaminatorVo : CvExaminatorVo = new CvExaminatorVo(); cvExaminatorVo.frequency = parseInt(cve.heartFrequencyTextInput.text); cvExaminatorVo.arythmia = cve.arythmiaButtonGroup.selectedValue; cvExaminatorVo.pressureLeftMaxArm = parseInt(cve.leftMaxArmTextInput.text); cvExaminatorVo.pressureRightMaxArm = parseInt(cve.rightMaxArmTextInput.text); cvExaminatorVo.pressureLeftMaxLeg = parseInt(cve.leftMaxLegTextInput.text); cvExaminatorVo.pressureRightMaxLeg = parseInt(cve.rightMaxLegTextInput.text); cvExaminatorVo.pressureLeftMinArm = parseInt(cve.leftMinArmTextInput.text); cvExaminatorVo.pressureRightMinArm = parseInt(cve.rightMinArmTextInput.text); cvExaminatorVo.pressureLeftMinLeg = parseInt(cve.leftMinLegTextInput.text); cvExaminatorVo.pressureRightMinLeg = parseInt(cve.rightMinLegTextInput.text); _model.appointmentSelected.cvExaminator = cvExaminatorVo; } public function loadAppointmentData(appointmentVo : AppointmentVo, newAppointment : Boolean) : void { ats.loadAppointmentData(appointmentVo.ats, appointmentVo.tobacco); personalHistory.loadAppointmentData(appointmentVo.personalHistory); familyHistory.loadAppointmentData(appointmentVo.familyHistory); if (!newAppointment) cve.loadAppointmentData(appointmentVo.cvExaminator); treatments.loadAppointmentData(appointmentVo.treatmentCollection); } public function updateErrorStrings() : void { patientFile.updateErrorStrings(); treatments.updateErrorStrings(); } public function resetPatientData() : void { ats.reset(); personalHistory.reset(); familyHistory.reset(); cve.reset(); treatments.reset(); }