| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904 |
- import com.imt.intimamedia.events.patient.CreateAppointmentEvent;
- import com.imt.intimamedia.events.patient.CreatePatientEvent;
- import com.imt.intimamedia.events.patient.SearchAppointmentsEvent;
- import com.imt.intimamedia.events.patient.SearchPatientEvent;
- import com.imt.intimamedia.events.patient.UpdateAppointmentEvent;
- import com.imt.intimamedia.events.patient.UpdatePatientEvent;
- import com.imt.intimamedia.events.measures.GetCTPAEvent;
- import com.imt.intimamedia.helpers.AES;
- import com.imt.intimamedia.helpers.ComboBoxHelper;
- import com.imt.intimamedia.helpers.FlashHelper;
- import com.imt.intimamedia.helpers.FormatString;
- import com.imt.intimamedia.helpers.HelpUtils;
- import com.imt.intimamedia.model.ApplicationModelLocator;
- import com.imt.intimamedia.views.common.ImtToaster;
- import com.imt.intimamedia.views.physician.measure.MeasureView;
- import com.imt.intimamedia.views.physician.patient.PatientView;
- import com.imt.intimamedia.vo.AppointmentVo;
- import com.imt.intimamedia.vo.AtsVo;
- import com.imt.intimamedia.vo.CvExaminatorVo;
- import com.imt.intimamedia.vo.FamilyHistoryVo;
- import com.imt.intimamedia.vo.PatientVo;
- import com.imt.intimamedia.vo.PersonalHistoryVo;
- import com.imt.intimamedia.vo.TobaccoVo;
- import flash.display.Stage;
- import flash.events.Event;
- import flash.events.FocusEvent;
- import flash.events.KeyboardEvent;
- import flash.events.MouseEvent;
- import flash.events.TextEvent;
- import flash.ui.Mouse;
- import flash.utils.ByteArray;
- import mx.collections.ArrayCollection;
- import mx.controls.Alert;
- import mx.controls.ComboBox;
- import mx.controls.Image;
- import mx.controls.dataGridClasses.DataGridColumn;
- import mx.core.Application;
- import mx.core.UIComponent;
- import mx.events.DataGridEvent;
- import mx.events.ListEvent;
- import mx.events.ValidationResultEvent;
- import mx.formatters.DateFormatter;
- import mx.managers.CursorManager;
- import mx.resources.ResourceManager;
- import mx.utils.ObjectUtil;
- import mx.validators.Validator;
- private var _viewMessageSearch : Boolean = false;
- private var _viewMessageDisplay : Boolean = false;
- [Bindable]
- private var _model : ApplicationModelLocator = ApplicationModelLocator.getInstance();
- [Bindable]
- private var _minYearOfBirth : int = new Date().fullYear - 100;
- [Bindable]
- private var _maxYearOfBirth : int = new Date().fullYear - 2;
- [Bindable]
- private var _currentYear : int = new Date().fullYear;
- [Bindable]
- private var _disabledRangesDateOfBirth : Array = [ {rangeEnd: new Date(new Date().fullYear - 110, new Date().getMonth(), new Date().getDate())}, {rangeStart: new Date()} ];
- [Bindable]
- //private var _disabledRangesVisitDate : Array = [ {rangeStart: new Date(new Date().fullYear, new Date().getMonth(), new Date().getDate()+1)} ];
- private var _disabledRangesVisitDate : Array = [ {rangeEnd: new Date(new Date().fullYear, new Date().getMonth(), new Date().getDate())}, {rangeStart: new Date(new Date().fullYear, new Date().getMonth(), new Date().getDate())} ];
- [Bindable]
- private var _currentPatientVisit : String = "1";
- private function creationCompleteHandler() : void
- {
- loadKeyboardListeners();
-
- searchPatientHelp.source = 'images/help/' + ResourceManager.getInstance().getString('labels', 'lang') + '/patientSearch.png';
- createPatientHelp.source = 'images/help/' + ResourceManager.getInstance().getString('labels', 'lang') + '/patientCreate.png';
- patientTabHelp.source = 'images/help/' + ResourceManager.getInstance().getString('labels', 'lang') + '/patientTab.png';
- }
- private function navigationNext() : void
- {
- var parent : PatientView = this.parentDocument as PatientView;
- parent.selectView(parent.atsStart, parent.atsEnd, parent.atsBox, parent.atsLinkButton, 1)
- }
- private function showInformation( zone : String ) : void { }
- private function loadKeyboardListeners() : void
- {
- firstNameTextInput.addEventListener(KeyboardEvent.KEY_UP, translateFirstCharToUpperCase);
- lastNameTextInput.addEventListener(KeyboardEvent.KEY_DOWN, translateToUpperCase);
- lastNameTextInput.addEventListener(KeyboardEvent.KEY_UP, checkTranslateToUpperCase);
- }
- public function showHelp(image : Image) : void
- {
- if (ApplicationModelLocator.getInstance().application.menuPhysician.selectedIndex == 0
- && ApplicationModelLocator.getInstance().application.menuPhysician.patient.patientView.selectedIndex == 0)
- HelpUtils.loadPatientHelp(image);
- else
- HelpUtils.showHelp(this, image, zoomHelpAdd, zoomHelpRemove);
- }
- private function patientFileController() : PatientVo
- {
- var toastMessage : ImtToaster;
-
- var validators : Array = [ firstNameValidator, lastNameValidator, sexValidator, dateOfBirthValidator ];
-
- var validatorsError : Array = Validator.validateAll( validators );
-
- if (dateOfBirthDateField.errorString)
- {
- dateOfBirthDateText.setStyle("color", "#7c0b13");
- dateOfBirthDateText.setStyle("fontWeight", "bold");
- }
- else
- {
- dateOfBirthDateText.setStyle("color", "#555557");
- dateOfBirthDateText.setStyle("fontWeight", "normal");
- }
- if (firstNameTextInput.errorString)
- {
- firstNameLabel.setStyle("color", "#7c0b13");
- firstNameLabel.setStyle("fontWeight", "bold");
- }
- else
- {
- firstNameLabel.setStyle("color", "#555557");
- firstNameLabel.setStyle("fontWeight", "normal");
- }
- if (lastNameTextInput.errorString)
- {
- lastNameLabel.setStyle("color", "#7c0b13");
- lastNameLabel.setStyle("fontWeight", "bold");
- }
- else
- {
- lastNameLabel.setStyle("color", "#555557");
- lastNameLabel.setStyle("fontWeight", "normal");
- }
- if (!sexRadioButtonGroup.selectedValue)
- {
- sexLabel.setStyle("color", "#7c0b13");
- sexLabel.setStyle("fontWeight", "bold");
- }
- else
- {
- sexLabel.setStyle("color", "#555557");
- sexLabel.setStyle("fontWeight", "normal");
- }
-
- if( validatorsError.length != 0 || !isDateOfBirthValid())
- {
- toastMessage = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'error.allFieldsTitle');
- toastMessage.timeToLive = 7;
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'error.allFieldsCreatePatient');
- toastMessage.level = ImtToaster.WARNING;
-
- _model.toaster.toast( toastMessage );
-
- return null;
- }
-
- var patientVo : PatientVo = new PatientVo();
-
- patientVo.uid = uidPatientLabel.text;
- patientVo.firstName = firstNameTextInput.text;
- patientVo.lastName = lastNameTextInput.text;
- patientVo.sex = sexRadioButtonGroup.selectedValue as String;
- patientVo.birthDate = dateOfBirthDateField.selectedDate;
-
- patientVo.birthDate.setHours(12,0,0,0);
-
- patientVo.lastVisit = new Date();
-
- for each (var currentPatient : PatientVo in _model.listOfPatients)
- {
- if (currentPatient.firstName.toLowerCase() == patientVo.firstName.toLowerCase()
- && currentPatient.lastName.toLowerCase() == patientVo.lastName.toLowerCase()
- && currentPatient.birthDate.toDateString() == patientVo.birthDate.toDateString())
- {
-
- toastMessage = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'warning.use');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'error.patientAlreadyExists');
- toastMessage.level = ImtToaster.WARNING;
-
- _model.toaster.toast( toastMessage );
-
- return null;
- }
- }
-
- if ( ethnicGroupComboBox.selectedItem != null )
- patientVo.ethnicGroup = ethnicGroupComboBox.selectedItem.code;
-
- return patientVo;
- }
- private function createPatient() : void
- {
- Application.application.menuPhysician.acquire.label = ResourceManager.getInstance().getString('labels', 'physicianAcquire');
-
- // reset patient data and appointment
- resetAppointment();
- resetPatientData();
-
- // not an existing patient but a new patient
- _model.noAppointmentSelected = false;
- _model.enabledAcquire = false;
- _model.enabledMeasure = false;
- _model.enabledReport = false;
- _model.patientActive = false;
- _model.updatePatient = false;
- _model.viewPatient = false;
- _model.acquireViewLoaded = false;
-
- _model.appointmentSelected = null;
-
- // reset acquire and measure pages if needed
- Application.application.menuPhysician.acquire.clearPage();
- Application.application.menuPhysician.generalMeasure.measures.clearPage();
-
- var newPatient : PatientVo = patientFileController();
-
- if (!newPatient)
- return;
- var appointmentVo : AppointmentVo = new AppointmentVo();
-
- appointmentVo.number = 1;
- appointmentVo.date = visitDateField.selectedDate;
-
- appointmentVo.date.setHours(12,0,0,0);
-
- _model.patientSelected = newPatient;
- _model.patientActive = true;
-
- new CreatePatientEvent( newPatient, appointmentVo, _model.connectedUser.person.id, this ).dispatch();
-
- this.parentDocument.selectView(this.parentDocument.atsStart, this.parentDocument.atsEnd, this.parentDocument.atsBox, this.parentDocument.atsLinkButton, 1);
- }
- public function createPatientCompleted() : void
- {
- var toastMessage : ImtToaster = new ImtToaster();
-
- toastMessage = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'patient.createdTitle');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'patient.createdMessage');
- toastMessage.level = ImtToaster.VALIDATION;
-
- _model.toaster.toast( toastMessage );
-
- _model.patientName = firstNameTextInput.text + " " + lastNameTextInput.text;
-
- firstNameValidator.enabled = false;
- lastNameValidator.enabled = false;
- sexValidator.enabled = false;
- dateOfBirthValidator.enabled = false;
-
- firstNameValidator.enabled = true;
- lastNameValidator.enabled = true;
- sexValidator.enabled = true;
- dateOfBirthValidator.enabled = true;
-
- uidPatientLabel.text = FormatString.generateRandomUID();
-
- _model.appointmentNumber = 1;
- visitNumberLabel.text = _currentPatientVisit = _model.appointmentNumber.toString();
-
- _model.enabledAcquire = true;
-
- // refresh patient list
- new SearchPatientEvent( "", this ).dispatch();
-
- new SearchAppointmentsEvent( _model.patientSelected.uid, this ).dispatch();
- }
- private function searchPatient() : void
- {
- var toastMessage : ImtToaster;
- var searchCriteria : String = criteria.text;
-
- criteria.text = ResourceManager.getInstance().getString('labels', 'search.patient.info');
-
- if (searchCriteria.length > 0 && searchCriteria != ResourceManager.getInstance().getString('labels', 'search.patient.info'))
- {
- var keyWords : Array = searchCriteria.split(' ');
-
- if (keyWords.length > 2)
- {
- toastMessage = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'patient.searchTitle');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'patient.searchMessageError');
- toastMessage.level = ImtToaster.ERROR;
-
- _model.toaster.toast( toastMessage );
- }
-
- _model.listOfDisplayedPatients.removeAll();
-
- for each (var patient : PatientVo in _model.listOfPatients)
- {
- if (
- ( keyWords.length == 2
- && patient.firstName.toLowerCase() == (keyWords[0] as String).toLowerCase()
- && patient.lastName.toLowerCase() == (keyWords[1] as String).toLowerCase()
- )
- ||
- ( keyWords.length == 2
- && patient.firstName.toLowerCase() == (keyWords[1] as String).toLowerCase()
- && patient.lastName.toLowerCase() == (keyWords[0] as String).toLowerCase()
- )
- ||
- ( keyWords.length == 1 && patient.firstName.toLowerCase() == (keyWords[0] as String).toLowerCase() )
- ||
- ( keyWords.length == 1 && patient.lastName.toLowerCase() == (keyWords[0] as String).toLowerCase() )
- )
- {
- _model.listOfDisplayedPatients.addItem(patient);
- }
- }
- }
- else
- {
- _model.listOfDisplayedPatients.removeAll();
- _model.listOfDisplayedPatients.addAll(_model.listOfPatients);
- }
-
- searchButton.setFocus();
- }
- private function selectPatient( event : ListEvent ) : void
- {
- actionOnSearch.visible = true;
-
- _model.patientSelected = event.currentTarget.selectedItem as PatientVo;
-
- // to do later
- //_patientSelectedIndex = event.currentTarget.selectedIndex;
-
- _model.patientName = _model.patientSelected.firstName + " " + _model.patientSelected.lastName;
-
- _model.patientActive = true;
- _model.updatePatient = false;
- _model.enabledAcquire = false;
- _model.enabledMeasure = false;
- _model.enabledReport = false;
- _model.noAppointmentSelected = true;
-
- resetPatientData();
-
- if (_model.patientSelected.uid)
- {
- //dg.enabled = false;
- new SearchAppointmentsEvent( _model.patientSelected.uid, this ).dispatch();
- }
- }
- private function modifyPatient() : void
- {
- _model.updatePatient = true;
-
- firstNameTextInput.text = _model.patientSelected.firstName;
- lastNameTextInput.text = _model.patientSelected.lastName;
- sexRadioButtonGroup.selectedValue = _model.patientSelected.sex;
- dateOfBirthDateField.text = dateFormatter.format(_model.patientSelected.birthDate);
- dateOfBirthDateField.selectedDate = _model.patientSelected.birthDate;
- }
- private function updatePatient() : void
- {
- var patientVo : PatientVo = patientFileController();
-
- if (!patientVo)
- return;
-
- patientVo.id = _model.patientSelected.id;
-
- _model.patientSelected.firstName = patientVo.firstName;
- _model.patientSelected.lastName = patientVo.lastName;
- _model.patientSelected.birthCountry = patientVo.birthCountry;
- _model.patientSelected.birthDate = patientVo.birthDate;
- _model.patientSelected.ethnicGroup = patientVo.ethnicGroup;
- _model.patientSelected.sex = patientVo.sex;
-
- new UpdatePatientEvent(_model.patientSelected, this).dispatch();
- }
- public function updatePatientComplete() : void
- {
- _model.updatePatient = false;
- }
- private function prepareCreateAppointment( event : Event ) : void
- {
- if ( _model.patientSelected.uid == "" )
- {
- var toastMessage : ImtToaster = 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;
- }
- _model.patientActive = true;
- _model.updatePatient = false;
- _model.viewPatient = false;
- _model.enabledAcquire = false;
- _model.enabledMeasure = false;
- _model.enabledReport = false;
- _model.acquireViewLoaded = false;
- _model.cptMesuresVisite = 0;
-
- Application.application.menuPhysician.acquire.label = ResourceManager.getInstance().getString('labels', 'physicianAcquire');
-
- _model.appointmentNumber++;
-
- // to do : decide if we keep prepareCreateAppointment or not
- createAppointment();
- }
- public function createAppointment() : void
- {
- // create an appointment so reset acquire and measure pages if needed
- Application.application.menuPhysician.acquire.clearPage();
- Application.application.menuPhysician.generalMeasure.measures.clearPage();
-
- var appointmentVo : AppointmentVo = new AppointmentVo();
-
- appointmentVo.patientId = _model.patientSelected.id;
- appointmentVo.number = _model.appointmentNumber;
- appointmentVo.date = visitDateField.selectedDate;
- appointmentVo.date.setHours(12,0,0,0);
-
- _currentPatientVisit = _model.appointmentNumber.toString();
-
- _model.noAppointmentSelected = false;
- _model.acquireViewLoaded = false;
-
- new CreateAppointmentEvent( appointmentVo, _model.patientSelected.uid, this ).dispatch();
- }
- public function createAppointmentComplete() : void
- {
- FlashHelper.resetAll();
- var toastMessage : ImtToaster = new ImtToaster();
-
- toastMessage = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'patient.addAppointmentTitle');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'patient.addAppointmentMessage');
- toastMessage.timeToLive = 7;
- toastMessage.level = ImtToaster.VALIDATION;
-
- _model.toaster.toast( toastMessage );
-
- dateOfBirthDateField.text = "";
-
- _model.patientName = _model.patientSelected.firstName + " " + _model.patientSelected.lastName;
-
- _model.enabledAcquire = true;
- _model.enabledMeasure = false;
- _model.enabledReport = false;
-
- // to do later
- //_appointmentSelectedIndex = -1;
-
- // appointmentNumber - 1 => last appointment (or current appointment)
- // appointmentNumber - 2 => previous appointment
-
- if (_model.appointmentNumber > 1)
- {
- var previousAppointmentVo : AppointmentVo = _model.listOfAppointments.getItemAt(_model.appointmentNumber-2) as AppointmentVo;
- // copy previous appointment in treatmentCollection
- _model.appointmentSelected.treatmentCollection.addAll(previousAppointmentVo.treatmentCollection);
- var parent : PatientView = this.parentDocument as PatientView;
- // load appointment data from previous appointment
- _model.appointmentSelected.height = previousAppointmentVo.height;
- _model.appointmentSelected.weight = previousAppointmentVo.weight;
- var newAppointment : Boolean = true;
- parent.loadAppointmentData(previousAppointmentVo, newAppointment);
- updateAppointment();
- }
-
- this.parentDocument.selectView(this.parentDocument.atsStart, this.parentDocument.atsEnd, this.parentDocument.atsBox, this.parentDocument.atsLinkButton, 1);
-
- //new SearchAppointmentsEvent( _model.patientSelected.uid, this ).dispatch();
- }
- private function selectAppointment( event : ListEvent ) : void
- {
- _model.appointmentSelected = event.currentTarget.selectedItem as AppointmentVo;
-
- // to do later
- //_appointmentSelectedIndex = event.currentTarget.selectedIndex;
-
- visitDateField.selectedDate = event.currentTarget.selectedItem.date;
- dateAppointment.text = dateFormatter.format(event.currentTarget.selectedItem.date);
- _model.appointmentNumber = event.currentTarget.selectedItem.number;
-
- visitNumberLabel.text = _currentPatientVisit = event.currentTarget.selectedItem.number;
-
- if (!_model.appointmentSelected.type)
- {
- recoverLastAppointment(false);
- return;
- }
-
- _model.patientActive = true;
- _model.updatePatient = false;
- _model.viewPatient = true;
- _model.enabledAcquire = true;
- _model.enabledMeasure = true;
- _model.enabledReport = true;
- _model.noAppointmentSelected = false;
- _model.acquireViewLoaded = false;
-
- // select an appointment so reset acquire and measure pages if needed
- Application.application.menuPhysician.acquire.clearPage();
- Application.application.menuPhysician.acquire.label = ResourceManager.getInstance().getString('labels', 'physicianDisplay');
- Application.application.menuPhysician.generalMeasure.measures.clearPage();
- Application.application.menuPhysician.report.clearReportConfiguration();
-
- var parent : PatientView = this.parentDocument as PatientView;
- parent.loadAppointmentData(_model.appointmentSelected, false);
-
- }
- public function recoverLastAppointment(displayToaster : Boolean) : void
- {
- if (displayToaster)
- {
- var toastMessage : ImtToaster = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'information');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'goToLastIncompleteAppointment');
- toastMessage.timeToLive = 7;
- toastMessage.level = ImtToaster.WARNING;
- ApplicationModelLocator.getInstance().toaster.toast( toastMessage );
- }
-
- _model.patientActive = true;
- _model.updatePatient = false;
- _model.viewPatient = false;
- _model.enabledAcquire = true;
- _model.enabledMeasure = false;
- _model.enabledReport = false;
- _model.noAppointmentSelected = false;
- _model.acquireViewLoaded = false;
-
- var lastAppointmentId : int = 0;
- var lastAppointmentNumber : int = 0;
- var lastAppointmentVo : AppointmentVo = null;
-
- for each (var appointmentVo : AppointmentVo in _model.listOfAppointments)
- {
- if (lastAppointmentId < appointmentVo.id)
- {
- lastAppointmentId = appointmentVo.id;
- lastAppointmentNumber = appointmentVo.number;
- lastAppointmentVo = appointmentVo;
- }
- }
-
- _model.appointmentNumber = lastAppointmentNumber;
- _model.appointmentSelected = lastAppointmentVo;
-
- _model.patientName = _model.patientSelected.firstName + " " + _model.patientSelected.lastName;
-
- _model.appointmentSelected.livingCountry = appointmentVo.livingCountry;
-
- visitDateField.selectedDate = new Date();
- lastAppointmentVo.date = new Date();
- visitNumberLabel.text = _model.appointmentNumber.toString();
- _currentPatientVisit = _model.appointmentNumber.toString();
-
- var idx : int = -1;
- for( var i : int = 0; i < _model.countries.length; i++ )
- {
- if( _model.countries.getItemAt(i).code == appointmentVo.livingCountry )
- {
- idx = i;
- break;
- }
- }
-
- // select an appointment so reset acquire and measure pages if needed
- Application.application.menuPhysician.acquire.clearPage();
- Application.application.menuPhysician.generalMeasure.measures.clearPage();
-
- Application.application.menuPhysician.acquire.label = ResourceManager.getInstance().getString('labels', 'physicianAcquire');
-
- var parent : PatientView = this.parentDocument as PatientView;
- parent.loadAppointmentData(lastAppointmentVo, false);
-
- this.parentDocument.selectView(this.parentDocument.atsStart, this.parentDocument.atsEnd, this.parentDocument.atsBox, this.parentDocument.atsLinkButton, 1);
- }
- public function updateAppointment() : void
- {
- if (!_model.viewPatient && _model.appointmentSelected && _model.appointmentSelected.id > 0)
- {
- _model.application.menuPhysician.patient.updateAts();
- _model.application.menuPhysician.patient.updateCve();
- _model.application.menuPhysician.patient.updatePersonalHistory();
- _model.application.menuPhysician.patient.updateFamilyHistory();
-
- // be more smart in the future : when save patient informations ?
- new UpdateAppointmentEvent( _model.appointmentSelected, _model.patientSelected.uid ).dispatch();
- }
- }
- public function updatePatientFile() : void
- {
- _currentPatientVisit = _model.appointmentNumber.toString();
-
- var idx : int = -1;
- for( var i : int = 0; i < _model.countries.length; i++ )
- {
- if( _model.countries.getItemAt(i).code == _model.appointmentSelected.livingCountry )
- {
- idx = i;
- break;
- }
- }
-
- _model.appointmentSelected.livingCountry = _model.appointmentSelected.livingCountry;
-
- visitNumberLabel.text = _model.appointmentNumber.toString();
-
- dateAppointment.text = dateFormatter.format( _model.appointmentSelected.date );
- }
- public function resetView() : void
- {
- firstNameTextInput.text = "";
- lastNameTextInput.text = "";
- sexRadioButtonGroup.selection = null;
- dateOfBirthDateField.selectedDate = null;
- ethnicGroupComboBox.selectedIndex = -1;
-
- visitDateField.selectedDate = new Date();
- criteria.text = "";
- _currentPatientVisit = "1";
-
- dateOfBirthDateText.setStyle("color", "#555557");
- dateOfBirthDateText.setStyle("fontWeight", "normal");
- dateOfBirthDateText.errorString = "";
- firstNameLabel.setStyle("color", "#555557");
- firstNameLabel.setStyle("fontWeight", "normal");
- firstNameTextInput.errorString = "";
- lastNameLabel.setStyle("color", "#555557");
- lastNameLabel.setStyle("fontWeight", "normal");
- lastNameTextInput.errorString = "";
- sexLabel.setStyle("color", "#555557");
- sexLabel.setStyle("fontWeight", "normal");
- _model.patientActive = false;
- _model.updatePatient = false;
- _model.viewPatient = false;
-
- actionOnSearch.visible = false;
-
- _model.appointmentNumber = 1;
- }
- public function resetPatientData() : void
- {
- var parent : PatientView = this.parentDocument as PatientView;
- parent.resetPatientData();
- }
- public function resetAppointment() : void
- {
- _model.appointmentSelected = new AppointmentVo();
- _model.appointmentSelected.ats = new AtsVo();
- _model.appointmentSelected.cvExaminator = new CvExaminatorVo();
- _model.appointmentSelected.familyHistory = new FamilyHistoryVo();
- _model.appointmentSelected.personalHistory = new PersonalHistoryVo();
- _model.appointmentSelected.tobacco = new TobaccoVo();
- _model.appointmentSelected.treatments = new Array();
- }
- private function formatBirthDate( item : Object, column : DataGridColumn ) : String
- {
- var dateFormatter : DateFormatter = new DateFormatter();
-
- dateFormatter.formatString = ResourceManager.getInstance().getString( 'labels', 'date' );
- return dateFormatter.format( item.birthDate );
- }
- private function formatLastVisit( item : Object, column : DataGridColumn ) : String
- {
- var dateFormatter : DateFormatter = new DateFormatter();
-
- dateFormatter.formatString = ResourceManager.getInstance().getString( 'labels', 'date' );
-
- return dateFormatter.format( item.lastVisit );
- }
- private function formatAppointment( item : Object ) : String
- {
- var dateFormatter : DateFormatter = new DateFormatter();
-
- dateFormatter.formatString = ResourceManager.getInstance().getString( 'labels', 'date' );
-
- var zone : String = "";
-
- switch (item.type)
- {
- case 'CL':
- case 'CR':
- zone = ' (' + ResourceManager.getInstance().getString( 'labels', 'carotids' ) + ')';
- break;
- case 'AR':
- case 'AL':
- zone = ' (' + ResourceManager.getInstance().getString( 'labels', 'arms' ) + ')';
- break;
- case 'LL':
- case 'LR':
- zone = ' (' + ResourceManager.getInstance().getString( 'labels', 'legs' ) + ')';
- break;
- case 'BO':
- zone = ' (' + ResourceManager.getInstance().getString( 'labels', 'body' ) + ')';
- break;
- default:
- break;
- }
-
- return dateFormatter.format( item.date ) + zone;
- }
- private function resetCreatePatientForm() : void
- {
- _model.enabledAcquire = false;
- _model.enabledMeasure = false;
- _model.enabledReport = false;
- _model.cptMesuresVisite = 0;
-
- resetPatientData();
- resetView();
- }
- private function removeSearchPatientText() : void
- {
- criteria.text = "";
- }
- public function setSearchPatientText() : void
- {
- searchButton.setFocus();
- criteria.text = ResourceManager.getInstance().getString('labels', 'search.patient.info');
- }
- private function translateFirstCharToUpperCase( e : KeyboardEvent ) : void
- {
- if (firstNameTextInput.text.length == 1)
- {
- if (e.keyCode > 64 && e.keyCode < 91)
- {
- var b:String = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- firstNameTextInput.text = b.charAt(e.keyCode - 65);
- }
- }
- else
- {
- var firstCharFirstName : String = firstNameTextInput.text.substr(0, 1);
- var firstNameLessFirstChar : String = firstNameTextInput.text.substr(1, firstNameTextInput.text.length);
- firstNameTextInput.text = firstCharFirstName.toUpperCase() + firstNameLessFirstChar;
-
- }
- }
- private function checkTranslateToUpperCase( e : KeyboardEvent ) : void
- {
- lastNameTextInput.text = lastNameTextInput.text.toUpperCase();
- }
- private function translateToUpperCase( e : KeyboardEvent ) : void
- {
- var lastName : String = "";
- if (lastNameTextInput.text.length > 1)
- lastName = lastNameTextInput.text.substr(0, lastNameTextInput.text.length);
- else
- lastName = lastNameTextInput.text;
-
- if (e.keyCode > 64 && e.keyCode < 91)
- {
- var b:String = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- lastName += b.charAt(e.keyCode - 65);
- }
-
- lastNameTextInput.text = lastName;
- lastNameTextInput.width = 160;
- }
- private function setFieldError() : void
- {
- lastNameValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required');
- firstNameValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required');
- dateOfBirthValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required');
- dateOfBirthValidator.formatError = ResourceManager.getInstance().getString('labels', 'errorField');
- dateOfBirthValidator.invalidCharError = ResourceManager.getInstance().getString('labels', 'errorField');
- dateOfBirthValidator.invalidCharError = ResourceManager.getInstance().getString('labels', 'errorField');
- dateOfBirthValidator.wrongDayError = ResourceManager.getInstance().getString('labels', 'errorField');
- dateOfBirthValidator.wrongLengthError = ResourceManager.getInstance().getString('labels', 'errorField');
- dateOfBirthValidator.wrongMonthError = ResourceManager.getInstance().getString('labels', 'errorField');
- dateOfBirthValidator.wrongYearError = ResourceManager.getInstance().getString('labels', 'errorField');
- }
- private function initListeners() : void
- {
- setFieldError();
-
- lastNameValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler);
- firstNameValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler);
- dateOfBirthValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler);
- }
- public function updateErrorStrings() : void
- {
- setFieldError();
-
- if (lastNameTextInput.errorString)
- lastNameTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField');
-
- if (firstNameTextInput.errorString)
- firstNameTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField');
-
- if (dateOfBirthDateField.errorString)
- dateOfBirthDateField.errorString = ResourceManager.getInstance().getString('labels', 'errorField');
- }
- private function stringValidatorHandler(event : ValidationResultEvent) : void
- {
- if (event.target.errorString)
- event.target.errorString = null;
- }
- private function isDateOfBirthValid() : Boolean
- {
- var date : Date = new Date();
-
- if (ObjectUtil.compare(date, dateOfBirthDateField.selectedDate) < 0
- || dateOfBirthDateField.selectedDate.getFullYear() < _minYearOfBirth
- || dateOfBirthDateField.selectedDate.getFullYear() > _maxYearOfBirth)
- {
- var toastMessage : ImtToaster = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'warning.use');
- if (dateOfBirthDateField.selectedDate.getFullYear() < _minYearOfBirth)
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'tooEarlyDate', [_minYearOfBirth]);
- else if (dateOfBirthDateField.selectedDate.getFullYear() > _maxYearOfBirth)
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'tooLateDate', [_maxYearOfBirth]);
- else
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'dateError');
- toastMessage.timeToLive = 7;
- toastMessage.level = ImtToaster.WARNING;
- ApplicationModelLocator.getInstance().toaster.toast( toastMessage );
-
- dateOfBirthDateField.text = "";
- dateOfBirthDateField.errorString = ResourceManager.getInstance().getString('labels', 'errorField');
- dateOfBirthDateField.selectedDate = null;
-
- return false;
- }
-
- return true;
- }
- // to do later, to highlight current patient
- /*public function updatePatientDatagrid() : void
- {
- if (_patientSelectedIndex != -1)
- {
- dg.invalidateDisplayList();
- dg.selectedIndex = _patientSelectedIndex;
- dg.selectedIndices = [_patientSelectedIndex];
- dg.validateNow();
- dg.scrollToIndex(_patientSelectedIndex);
- }
- comboBoxAppointmentSelected.selectedIndex = _appointmentSelectedIndex;
- }*/
|