[1240] | 1 | <?xml version="1.0"?>
|
---|
| 2 | <widget:GapAccordion
|
---|
| 3 | xmlns:mx="http://www.adobe.com/2006/mxml"
|
---|
| 4 | xmlns:widget="gov.va.med.edp.widget.*"
|
---|
| 5 | xmlns:accessibility="flash.accessibility.*"
|
---|
| 6 | xmlns:pt-cntrl="gov.va.med.edp.pt.demog.control.*"
|
---|
| 7 | accessibilityProperties="{accAccordian}"
|
---|
| 8 | width="100%" height="100%"
|
---|
| 9 | paddingLeft="1"
|
---|
| 10 | paddingTop="1"
|
---|
| 11 | borderStyle="none"
|
---|
| 12 | verticalGap="12"
|
---|
| 13 | tabEnabled="false"
|
---|
| 14 | creationPolicy="all"
|
---|
| 15 | creationComplete="init()"
|
---|
| 16 | change="updateSelectedPatient()">
|
---|
| 17 | <mx:Metadata>
|
---|
| 18 | [Event(name="selectPatient", type="gov.va.med.edp.pt.demog.view.SelectPatientEvent")]
|
---|
| 19 | </mx:Metadata>
|
---|
| 20 | <mx:Script><![CDATA[
|
---|
| 21 | import mx.events.ValidationResultEvent;
|
---|
| 22 | import gov.va.med.edp.pt.demog.model.PatientSelectVO;
|
---|
| 23 | import gov.va.med.edp.pt.demog.model.MatchingPatientsModel;
|
---|
| 24 |
|
---|
| 25 |
|
---|
| 26 | private static const NAME_AMBULANCE: String = "(ambulance en route)";
|
---|
| 27 | private static const AMBULANCE_MSG: String =
|
---|
| 28 | "<p>Patient name will display as: " + NAME_AMBULANCE + "</p>" +
|
---|
| 29 | "<p>Use <b>Identify Patient</b> button when patient is known. </p>";
|
---|
| 30 |
|
---|
| 31 | private static const MARGIN_RADIO_LEFT: int = 14;
|
---|
| 32 | private static const MARGIN_RADIO_TOP: int = 12;
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | [Bindable]
|
---|
| 36 | private var matchingPatientsModel:MatchingPatientsModel = new MatchingPatientsModel();
|
---|
| 37 |
|
---|
| 38 | [Bindable]
|
---|
| 39 | public var baseTabIndex:int;
|
---|
| 40 |
|
---|
| 41 | private var _initialPatient: PatientSelectVO;
|
---|
| 42 |
|
---|
| 43 | [Bindable]
|
---|
| 44 | public function get initialPatient():PatientSelectVO {
|
---|
| 45 | return _initialPatient;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | public function set initialPatient(pt:PatientSelectVO):void {
|
---|
| 49 | _initialPatient = pt;
|
---|
| 50 | if (_initialPatient != null)
|
---|
| 51 | currentState = "noAmbulance";
|
---|
| 52 | else
|
---|
| 53 | currentState = ""
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | private function init():void {
|
---|
| 57 | matchPatientsController.resetMatchingPatients();
|
---|
| 58 | callLater(partialNameInput.setFocus);
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | private function matchPatients():void {
|
---|
| 62 | matchPatientsController.matchPatients(partialNameInput.text);
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | private function updateSelectedPatient(selectAndContinue:Boolean = false):void
|
---|
| 66 | {
|
---|
| 67 | var patient: PatientSelectVO = new PatientSelectVO();
|
---|
| 68 | if (this.selectedChild == vistaPt) {
|
---|
| 69 | patient = patientList.selectedItem as PatientSelectVO;
|
---|
| 70 | if (patient != null && patient.dfn == "0") patient = null;
|
---|
| 71 | } else if (this.selectedChild == nonVistaPt) {
|
---|
| 72 | var result:ValidationResultEvent = nonVistaNameValidator.validate();
|
---|
| 73 | if (result.type == ValidationResultEvent.INVALID) {
|
---|
| 74 | patient = null;
|
---|
| 75 | } else {
|
---|
| 76 | patient.name = nonVistaName.text;
|
---|
| 77 | }
|
---|
| 78 | } else if (this.selectedChild == ambulancePt) {
|
---|
| 79 | patient.name = NAME_AMBULANCE;
|
---|
| 80 | }
|
---|
| 81 | dispatchEvent(new SelectPatientEvent(SelectPatientEvent.EVENT_SELECT_PATIENT, patient, selectAndContinue));
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | private function set matchesLoaded(loaded:Boolean):void
|
---|
| 85 | {
|
---|
| 86 | if (loaded) {
|
---|
| 87 | if (matchingPatientsModel.matchingPatients.length > 0) {
|
---|
| 88 | callLater(selectFirstMatch);
|
---|
| 89 | }
|
---|
| 90 | }
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | private function selectFirstMatch():void {
|
---|
| 94 | if (matchingPatientsModel.matchingPatients.length > 0) {
|
---|
| 95 | patientList.selectedIndex = 0;
|
---|
| 96 | updateSelectedPatient();
|
---|
| 97 | patientList.setFocus();
|
---|
| 98 | }
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | private function patientListKeyHandler(event:KeyboardEvent):void {
|
---|
| 102 | if (event.keyCode == Keyboard.ENTER) {
|
---|
| 103 | updateSelectedPatient(true);
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | ]]></mx:Script>
|
---|
| 108 |
|
---|
| 109 | <pt-cntrl:MatchPatientsController id="matchPatientsController" model="{matchingPatientsModel}"/>
|
---|
| 110 |
|
---|
| 111 | <widget:headerRenderer>
|
---|
| 112 | <mx:Component>
|
---|
| 113 | <mx:RadioButton/>
|
---|
| 114 | </mx:Component>
|
---|
| 115 | </widget:headerRenderer>
|
---|
| 116 | <widget:states>
|
---|
| 117 | <mx:State name="noAmbulance">
|
---|
| 118 | <mx:RemoveChild target="{ambulancePt}"/>
|
---|
| 119 | </mx:State>
|
---|
| 120 | </widget:states>
|
---|
| 121 |
|
---|
| 122 | <mx:VBox
|
---|
| 123 | id="vistaPt"
|
---|
| 124 | label="Search for Patient in VistA"
|
---|
| 125 | paddingBottom="6">
|
---|
| 126 | <mx:HBox
|
---|
| 127 | width="100%"
|
---|
| 128 | paddingLeft="{MARGIN_RADIO_LEFT}" paddingTop="{MARGIN_RADIO_TOP}" defaultButton="{search}">
|
---|
| 129 | <mx:Label
|
---|
| 130 | text="Find Patient"/>
|
---|
| 131 | <mx:TextInput
|
---|
| 132 | id="partialNameInput"
|
---|
| 133 | width="100%"
|
---|
| 134 | accessibilityProperties="{accPartial}"
|
---|
| 135 | tabIndex="{baseTabIndex + 1}"
|
---|
| 136 | enter="matchPatients()"/>
|
---|
| 137 | <mx:Button
|
---|
| 138 | id="search"
|
---|
| 139 | label="Search"
|
---|
| 140 | click="matchPatients()"
|
---|
| 141 | focusEnabled="false"/>
|
---|
| 142 | </mx:HBox>
|
---|
| 143 | <mx:DataGrid
|
---|
| 144 | id="patientList"
|
---|
| 145 | useRollOver="false"
|
---|
| 146 | dataProvider="{matchingPatientsModel.matchingPatients}"
|
---|
| 147 | accessibilityProperties="{accMatches}"
|
---|
| 148 | change="updateSelectedPatient()"
|
---|
| 149 | doubleClickEnabled="true"
|
---|
| 150 | doubleClick="updateSelectedPatient(true)"
|
---|
| 151 | tabIndex="{baseTabIndex + 2}"
|
---|
| 152 | keyDown="patientListKeyHandler(event)">
|
---|
| 153 | <mx:columns>
|
---|
| 154 | <mx:DataGridColumn headerText="Name" dataField="name" width="210"/>
|
---|
| 155 | <mx:DataGridColumn headerText="SSN" dataField="ssn" width="80"/>
|
---|
| 156 | <mx:DataGridColumn headerText="DOB" dataField="dob" width="80"/>
|
---|
| 157 | </mx:columns>
|
---|
| 158 | </mx:DataGrid>
|
---|
| 159 | </mx:VBox>
|
---|
| 160 |
|
---|
| 161 | <mx:VBox
|
---|
| 162 | id="nonVistaPt"
|
---|
| 163 | label="Enter Name, Patient Is Not in VistA">
|
---|
| 164 | <mx:HBox
|
---|
| 165 | paddingLeft="{MARGIN_RADIO_LEFT}" paddingTop="{MARGIN_RADIO_TOP}">
|
---|
| 166 | <mx:Label
|
---|
| 167 | text="Patient Name"/>
|
---|
| 168 | <mx:TextInput
|
---|
| 169 | id="nonVistaName"
|
---|
| 170 | accessibilityProperties="{accPartial}"
|
---|
| 171 | text="{partialNameInput.text}"
|
---|
| 172 | change="updateSelectedPatient()"
|
---|
| 173 | tabIndex="{baseTabIndex + 3}"/>
|
---|
| 174 | </mx:HBox>
|
---|
| 175 | </mx:VBox>
|
---|
| 176 |
|
---|
| 177 | <mx:VBox
|
---|
| 178 | id="ambulancePt"
|
---|
| 179 | label="Ambulance Is Arriving, Patient Name Is Unknown">
|
---|
| 180 | <mx:Text
|
---|
| 181 | width="100%" height="100%"
|
---|
| 182 | paddingLeft="{MARGIN_RADIO_LEFT}" paddingTop="{MARGIN_RADIO_TOP}"
|
---|
| 183 | htmlText="{AMBULANCE_MSG}"
|
---|
| 184 | tabIndex="{baseTabIndex + 4}"/>
|
---|
| 185 | </mx:VBox>
|
---|
| 186 |
|
---|
| 187 | <mx:StringValidator id="nonVistaNameValidator" source="{nonVistaName}" property="text" required="true"
|
---|
| 188 | requiredFieldError="A patient name must be entered." maxLength="40"
|
---|
| 189 | tooLongError="Patient name is too long (> 40 characters)."/>
|
---|
| 190 |
|
---|
| 191 | <accessibility:AccessibilityProperties id="accPartial" name="Patient Name"/>
|
---|
| 192 | <accessibility:AccessibilityProperties id="accMatches" name="Matching Patients"/>
|
---|
| 193 | <accessibility:AccessibilityProperties id="accAccordian" name="Accordion Control"/>
|
---|
| 194 |
|
---|
| 195 | <mx:Binding source="matchingPatientsModel.matchingPatientsLoaded" destination="matchesLoaded"/>
|
---|
| 196 | </widget:GapAccordion> |
---|