[1227] | 1 | package gov.va.med.edp.pt.demog.model {
|
---|
| 2 | import gov.va.med.edp.pt.demog.model.PatientCheckVO;
|
---|
| 3 | [Bindable]
|
---|
| 4 | public class PatientChecksModel {
|
---|
| 5 | public static const STATE_NONE: int = 0;
|
---|
| 6 | public static const STATE_LOADING: int = 1;
|
---|
| 7 | public static const STATE_LOADED: int = 2;
|
---|
| 8 |
|
---|
| 9 | public static const STATE_ONBOARD: int = 10;
|
---|
| 10 | public static const STATE_SIMILAR: int = 11;
|
---|
| 11 | public static const STATE_SENSITIVE: int = 12;
|
---|
| 12 | public static const STATE_DECEASED: int = 13;
|
---|
| 13 | public static const STATE_FLAGS: int = 14;
|
---|
| 14 |
|
---|
| 15 | public static const STATE_ALLOW: int = 22;
|
---|
| 16 |
|
---|
| 17 | public var checkState: int = STATE_NONE;
|
---|
| 18 |
|
---|
| 19 | public var patientChecks: PatientCheckVO;
|
---|
| 20 |
|
---|
| 21 | public var checksForPt:PatientSelectVO;
|
---|
| 22 |
|
---|
| 23 | public var backEnabled:Boolean = false;
|
---|
| 24 |
|
---|
| 25 | public var continueEnabled:Boolean = false;
|
---|
| 26 |
|
---|
| 27 | private var _patientChecksReady: Boolean = false;
|
---|
| 28 |
|
---|
| 29 | public function get patientChecksReady():Boolean {
|
---|
| 30 | return _patientChecksReady;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | public function set patientChecksReady(b:Boolean):void {
|
---|
| 34 | this._patientChecksReady = b;
|
---|
| 35 | if (b && checkState == STATE_LOADING) {
|
---|
| 36 | checkState = STATE_LOADED;
|
---|
| 37 | continueEnabled = true;
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | public function reset():void {
|
---|
| 42 | patientChecks = null;
|
---|
| 43 | checksForPt = null;
|
---|
| 44 | checkState = STATE_NONE;
|
---|
| 45 | patientChecksReady = false;
|
---|
| 46 | continueEnabled = false;
|
---|
| 47 | backEnabled = false;
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | public function back():void {
|
---|
| 51 | if (!backEnabled) return;
|
---|
| 52 |
|
---|
| 53 | if (!continueEnabled) continueEnabled = true;
|
---|
| 54 |
|
---|
| 55 | if (checkState > STATE_DECEASED && patientChecks.isDeceased()) {
|
---|
| 56 | checkState = STATE_DECEASED;
|
---|
| 57 | } else if (checkState > STATE_SENSITIVE && patientChecks.sensitive) {
|
---|
| 58 | checkState = STATE_SENSITIVE;
|
---|
| 59 | } else if (checkState > STATE_SIMILAR && patientChecks.hasSimilarNames()) {
|
---|
| 60 | checkState = STATE_SIMILAR;
|
---|
| 61 | } else if (checkState > STATE_LOADED) {
|
---|
| 62 | checkState = STATE_LOADED;
|
---|
| 63 | backEnabled = false;
|
---|
| 64 | }
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | public function forward():void {
|
---|
| 68 | if (!continueEnabled) return;
|
---|
| 69 |
|
---|
| 70 | if (!backEnabled) backEnabled = true;
|
---|
| 71 |
|
---|
| 72 | if (checkState < STATE_ONBOARD && patientChecks.isOnBoard()) {
|
---|
| 73 | checkState = STATE_ONBOARD;
|
---|
| 74 | continueEnabled = false;
|
---|
| 75 | } else if (checkState < STATE_SIMILAR &&
|
---|
| 76 | patientChecks.hasSimilarNames()) {
|
---|
| 77 | checkState = STATE_SIMILAR;
|
---|
| 78 | } else if (checkState < STATE_SENSITIVE && patientChecks.sensitive) {
|
---|
| 79 | checkState = STATE_SENSITIVE;
|
---|
| 80 | if (!patientChecks.mayAccess) continueEnabled = false;
|
---|
| 81 | } else if (checkState < STATE_DECEASED && patientChecks.isDeceased()) {
|
---|
| 82 | checkState = STATE_DECEASED;
|
---|
| 83 | } else if (checkState < STATE_FLAGS && patientChecks.hasFlags()) {
|
---|
| 84 | checkState = STATE_FLAGS;
|
---|
| 85 | } else {
|
---|
| 86 | checkState = STATE_ALLOW;
|
---|
| 87 | backEnabled = false;
|
---|
| 88 | continueEnabled = false;
|
---|
| 89 | }
|
---|
| 90 | }
|
---|
| 91 | }
|
---|
| 92 | }
|
---|