[1227] | 1 | package gov.va.med.edp.factory
|
---|
| 2 | {
|
---|
| 3 | import gov.va.med.edp.pt.demog.dao.PatientXml;
|
---|
| 4 | import gov.va.med.edp.util.BoardTools;
|
---|
| 5 | import gov.va.med.edp.util.Vista;
|
---|
| 6 | import gov.va.med.edp.vo.CodeSelectionVO;
|
---|
| 7 | import gov.va.med.edp.vo.ColorMapVO;
|
---|
| 8 | import gov.va.med.edp.vo.ColorMatchVO;
|
---|
| 9 | import gov.va.med.edp.vo.ColorSelectionVO;
|
---|
| 10 | import gov.va.med.edp.vo.ColumnSpecVO;
|
---|
| 11 | import gov.va.med.edp.vo.DisplayBoardPropertiesVO;
|
---|
| 12 | import gov.va.med.edp.vo.DisplaySizeVO;
|
---|
| 13 | import gov.va.med.edp.vo.LogEditParamsVO;
|
---|
| 14 | import gov.va.med.edp.vo.LogEntryVO;
|
---|
| 15 | import gov.va.med.edp.vo.LogSelectorVO;
|
---|
| 16 | import gov.va.med.edp.vo.NoteVO;
|
---|
| 17 | import gov.va.med.edp.vo.PCECodedValueVO;
|
---|
| 18 | import gov.va.med.edp.pt.demog.model.PatientCheckVO;
|
---|
| 19 | import gov.va.med.edp.pt.demog.model.PatientRecordFlagVO;
|
---|
| 20 | import gov.va.med.edp.vo.RoomBedVO;
|
---|
| 21 | import gov.va.med.edp.vo.StaffMemberVO;
|
---|
| 22 | import gov.va.med.edp.vo.VisitVO;
|
---|
| 23 | import gov.va.med.edp.pt.demog.model.PatientSelectVO;
|
---|
| 24 |
|
---|
| 25 | import mx.collections.ArrayCollection;
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | public class TrackingFactory
|
---|
| 29 | {
|
---|
| 30 | public static function buildLogEditParamsFromXML(xml: XML): LogEditParamsVO
|
---|
| 31 | {
|
---|
| 32 | var logEditParamsVO: LogEditParamsVO = new LogEditParamsVO();
|
---|
| 33 | logEditParamsVO.requireDiagnosis = (xml.@reqDiag == "1");
|
---|
| 34 | logEditParamsVO.requireDisposition = (xml.@reqDisp == "1");
|
---|
| 35 | logEditParamsVO.requireDelay = (xml.@reqDelay == "1");
|
---|
| 36 | logEditParamsVO.delayMinutes = int(xml.@minDelay);
|
---|
| 37 | logEditParamsVO.codedDiagnosis = (xml.@codedDiag == "1");
|
---|
| 38 | logEditParamsVO.shiftStart = int(xml.@shiftOne);
|
---|
| 39 | logEditParamsVO.shiftDuration = int(xml.@shiftLen);
|
---|
| 40 | logEditParamsVO.promptResidents = (xml.@residents == "1");
|
---|
| 41 | logEditParamsVO.promptClinics = (xml.@clinics == "1");
|
---|
| 42 | logEditParamsVO.ambulanceArea = int(xml.@ambulance);
|
---|
| 43 | logEditParamsVO.defaultRoom = int(xml.@dfltroom);
|
---|
| 44 | logEditParamsVO.emptyValue = int(xml.@emptyIEN);
|
---|
| 45 | logEditParamsVO.errorIEN = int(xml.@errorIEN);
|
---|
| 46 | logEditParamsVO.nurseEvalIEN = int(xml.@evalIEN);
|
---|
| 47 | logEditParamsVO.leftIEN = int(xml.@leftIEN);
|
---|
| 48 | return logEditParamsVO;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | public static function buildDisplayBoardPropertiesFromXML(xmlList: XMLList): DisplayBoardPropertiesVO
|
---|
| 52 | {
|
---|
| 53 | var displayBoardPropertiesVO: DisplayBoardPropertiesVO = new DisplayBoardPropertiesVO();
|
---|
| 54 | for each (var xml: XML in xmlList) {
|
---|
| 55 | var displaySize:DisplaySizeVO = new DisplaySizeVO();
|
---|
| 56 | displaySize.width = xml.@displayWidth;
|
---|
| 57 | //This loop exists because M dosen't have defaults set.
|
---|
| 58 | //get these defaults set in M
|
---|
| 59 | var dispHt:int = xml.@displayHeight;
|
---|
| 60 | if (dispHt != 0){
|
---|
| 61 | displaySize.height = xml.@displayHeight;
|
---|
| 62 | } else {
|
---|
| 63 | //default it to 768
|
---|
| 64 | displaySize.height = 768;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | displaySize.label = xml.@displayLabel;
|
---|
| 68 | displaySize.data = xml.@displayLabel;
|
---|
| 69 | displayBoardPropertiesVO.displaySize = displaySize;
|
---|
| 70 | displayBoardPropertiesVO.fontSize = xml.@fontSize;
|
---|
| 71 | displayBoardPropertiesVO.squishFontSize = xml.@fontSize;
|
---|
| 72 | displayBoardPropertiesVO.scrollDelay = xml.@scrollDelay;
|
---|
| 73 | displayBoardPropertiesVO.squish = (xml.@squish == "true");
|
---|
| 74 | }
|
---|
| 75 | return displayBoardPropertiesVO;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | public static function buildScreenSizesFromXML(nodeList: XMLList): ArrayCollection
|
---|
| 79 | {
|
---|
| 80 | var screenSizes:ArrayCollection = new ArrayCollection();
|
---|
| 81 | for each (var item: XML in nodeList) {
|
---|
| 82 | var screenSize:DisplaySizeVO = new DisplaySizeVO();
|
---|
| 83 | screenSize.label = item.@label;
|
---|
| 84 | screenSize.data = item.@label;
|
---|
| 85 | screenSize.width = item.@width;
|
---|
| 86 | screenSize.height = item.@height;
|
---|
| 87 | screenSizes.addItem(screenSize);
|
---|
| 88 | }
|
---|
| 89 | return screenSizes;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | public static function buildLogEntryFromXML(xml:XML):LogEntryVO
|
---|
| 93 | {
|
---|
| 94 | var logEntryVO:LogEntryVO = new LogEntryVO();
|
---|
| 95 | logEntryVO.id = xml.id;
|
---|
| 96 | logEntryVO.site = xml.site;
|
---|
| 97 | logEntryVO.area = xml.area;
|
---|
| 98 | logEntryVO.dfn = xml.dfn;
|
---|
| 99 | logEntryVO.name = xml.name;
|
---|
| 100 | logEntryVO.ssn = xml.ssn;
|
---|
| 101 | logEntryVO.dob = xml.dob;
|
---|
| 102 | logEntryVO.arrival = int(xml.arrival);
|
---|
| 103 | logEntryVO.inTS = Vista.FMtoDate(xml.inTS);
|
---|
| 104 | logEntryVO.visit = int(xml.visit);
|
---|
| 105 | logEntryVO.closed = (xml.closed == "1");
|
---|
| 106 | logEntryVO.clinic = int(xml.clinic);
|
---|
| 107 | logEntryVO.complaint = xml.complaint;
|
---|
| 108 | logEntryVO.longComplaint = xml.compLong;
|
---|
| 109 | logEntryVO.status = int(xml.status);
|
---|
| 110 | logEntryVO.acuity = int(xml.acuity);
|
---|
| 111 | logEntryVO.bed = int(xml.bed);
|
---|
| 112 | logEntryVO.provider = xml.md;
|
---|
| 113 | logEntryVO.resident = xml.res;
|
---|
| 114 | logEntryVO.nurse = xml.nurse;
|
---|
| 115 | logEntryVO.comment = xml.comment;
|
---|
| 116 | logEntryVO.outTS = Vista.FMtoDate(xml.outTS);
|
---|
| 117 | logEntryVO.delay = int(xml.delay);
|
---|
| 118 | logEntryVO.disposition = int(xml.disposition);
|
---|
| 119 | logEntryVO.diagnoses = new ArrayCollection();
|
---|
| 120 | logEntryVO.patientFlags = PatientXml.buildPtRecordFlagsFromXML(xml.patientRecordFlags.flag);
|
---|
| 121 | logEntryVO.loadTS = xml.loadTS;
|
---|
| 122 |
|
---|
| 123 | for each (var item: Object in xml.diagnosis) {
|
---|
| 124 | var pceItem: PCECodedValueVO = new PCECodedValueVO;
|
---|
| 125 | pceItem.type = item.@type;
|
---|
| 126 | pceItem.ien = int(item.@ien);
|
---|
| 127 | pceItem.code = item.@code;
|
---|
| 128 | pceItem.label = item.@label;
|
---|
| 129 | pceItem.primary = (item.@primary == "1");
|
---|
| 130 | pceItem.quantity = int(item.@qty);
|
---|
| 131 | logEntryVO.diagnoses.addItem(pceItem);
|
---|
| 132 | }
|
---|
| 133 |
|
---|
| 134 | var required:String = xml.required;
|
---|
| 135 |
|
---|
| 136 | logEntryVO.required = required;
|
---|
| 137 | logEntryVO.removeReady = (logEntryVO.required.length == 0);
|
---|
| 138 |
|
---|
| 139 | if (required.indexOf("diag") != -1) logEntryVO.requireDiagnosis = true;
|
---|
| 140 | if (required.indexOf("disp") != -1) logEntryVO.requireDisposition = true;
|
---|
| 141 | if (required.indexOf("delay") != -1) logEntryVO.requireDelay = true;
|
---|
| 142 |
|
---|
| 143 | return logEntryVO;
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 | /* buildLogSelectorListFromXML expects:
|
---|
| 147 | <anyRoot>
|
---|
| 148 | <anyNode id="9999" dfn="99" ptNm="XXXX" ssn="999999999" last4="X9999"
|
---|
| 149 | dob="2380106" bed="XXX" same="1" />
|
---|
| 150 | ...
|
---|
| 151 | </anyRoot> */
|
---|
| 152 | public static function buildLogSelectorListFromXML(nodeList: XMLList): Array
|
---|
| 153 | {
|
---|
| 154 | var logSelectorVO: LogSelectorVO;
|
---|
| 155 | var logSelectorList: Array = [];
|
---|
| 156 | for each (var item: XML in nodeList) {
|
---|
| 157 | logSelectorVO = new LogSelectorVO();
|
---|
| 158 | logSelectorVO.id = Number(item.@id);
|
---|
| 159 | logSelectorVO.name = item.@name;
|
---|
| 160 | logSelectorVO.ssn = item.@ssn;
|
---|
| 161 | logSelectorVO.last4 = item.@last4;
|
---|
| 162 | logSelectorVO.bed = item.@bed;
|
---|
| 163 | logSelectorVO.similar = (item.@same == "1") ? true : false;
|
---|
| 164 | logSelectorList.push(logSelectorVO);
|
---|
| 165 | }
|
---|
| 166 | return logSelectorList;
|
---|
| 167 | }
|
---|
| 168 |
|
---|
| 169 | public static function buildLookupDiagnosesListFromXML(xml:XML): ArrayCollection
|
---|
| 170 | {
|
---|
| 171 | var codedValueVO: PCECodedValueVO;
|
---|
| 172 | var diagnosesSelectList: ArrayCollection = new ArrayCollection();
|
---|
| 173 |
|
---|
| 174 | //Add support for no matches found..
|
---|
| 175 | if (xml.children().children().length() == 0){
|
---|
| 176 | codedValueVO = new PCECodedValueVO;
|
---|
| 177 | codedValueVO.code = "";
|
---|
| 178 | codedValueVO.label = "No matches found.";
|
---|
| 179 | diagnosesSelectList.addItem(codedValueVO);
|
---|
| 180 | } else {
|
---|
| 181 | for each (var item:XML in xml.children().children()) {
|
---|
| 182 | codedValueVO = new PCECodedValueVO();
|
---|
| 183 | var code:String = item.@code;
|
---|
| 184 | if (code == null || code == "") code = item.@cpt;
|
---|
| 185 | codedValueVO.type = item.@type;
|
---|
| 186 | codedValueVO.ien = item.@ien;
|
---|
| 187 | codedValueVO.code = item.@code;
|
---|
| 188 | codedValueVO.label = item.@text;
|
---|
| 189 | diagnosesSelectList.addItem(codedValueVO);
|
---|
| 190 | }
|
---|
| 191 | }
|
---|
| 192 | return diagnosesSelectList;
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | /* buildColorMapListFromXML expects:
|
---|
| 196 | <colors id="stsAcuity" nm="Status / Acuity" type="val">
|
---|
| 197 | ...
|
---|
| 198 | </colors>
|
---|
| 199 | ... */
|
---|
| 200 | public static function buildColorMapListFromXML(nodeList: XMLList): ArrayCollection
|
---|
| 201 | {
|
---|
| 202 | var colorMap: ColorMapVO;
|
---|
| 203 | var list: ArrayCollection = new ArrayCollection();
|
---|
| 204 |
|
---|
| 205 | for each (var item: XML in nodeList) {
|
---|
| 206 | colorMap = new ColorMapVO();
|
---|
| 207 | colorMap.id = item.@id;
|
---|
| 208 | colorMap.name = item.@nm;
|
---|
| 209 | colorMap.type = item.@type;
|
---|
| 210 | colorMap.matches = buildColorMatchListFromXML(item.map);
|
---|
| 211 | list.addItem(colorMap);
|
---|
| 212 | }
|
---|
| 213 | return list;
|
---|
| 214 | }
|
---|
| 215 |
|
---|
| 216 | public static function buildColorSelection(c: String): ColorSelectionVO
|
---|
| 217 | {
|
---|
| 218 | var sel: ColorSelectionVO = new ColorSelectionVO();
|
---|
| 219 | var x: Array = c.split(",");
|
---|
| 220 | sel.ignore = (x[0] != "1"); // 1 means "use color"
|
---|
| 221 | if (!sel.ignore) {
|
---|
| 222 | sel.text = uint(x[1]);
|
---|
| 223 | sel.back = uint(x[2]);
|
---|
| 224 | }
|
---|
| 225 | return sel;
|
---|
| 226 | }
|
---|
| 227 |
|
---|
| 228 | /* buildColorMatchListFromXML expects:
|
---|
| 229 | <map att="@status" clr="1,0x00ff00,0xff0000" val="10" nm="ED Patient" />
|
---|
| 230 | ... */
|
---|
| 231 | public static function buildColorMatchListFromXML(nodeList: XMLList): ArrayCollection
|
---|
| 232 | {
|
---|
| 233 | var colorMatch: ColorMatchVO;
|
---|
| 234 | var list: ArrayCollection = new ArrayCollection();
|
---|
| 235 |
|
---|
| 236 | for each (var item: XML in nodeList) {
|
---|
| 237 | colorMatch = new ColorMatchVO;
|
---|
| 238 | colorMatch.attribute = item.@att;
|
---|
| 239 | colorMatch.name = item.@nm;
|
---|
| 240 | colorMatch.value = item.@val;
|
---|
| 241 | colorMatch.color = buildColorSelection(item.@clr);
|
---|
| 242 |
|
---|
| 243 | /* colorMatch.color = new ColorSelectionVO();
|
---|
| 244 | var c: String = item.@clr;
|
---|
| 245 | var x: Array = c.split(",");
|
---|
| 246 | colorMatch.color.ignore = (x[0] != "1"); // 1 means "use color"
|
---|
| 247 | if (!colorMatch.color.ignore) {
|
---|
| 248 | colorMatch.color.text = uint(x[1]);
|
---|
| 249 | colorMatch.color.back = uint(x[2]);
|
---|
| 250 | }
|
---|
| 251 | */
|
---|
| 252 | list.addItem(colorMatch);
|
---|
| 253 | }
|
---|
| 254 | return list;
|
---|
| 255 | }
|
---|
| 256 |
|
---|
| 257 | /* buildColumnSpecListFromXML expects:
|
---|
| 258 | <col att="bed" header="Bed" color="" width="6" />
|
---|
| 259 | ... */
|
---|
| 260 | public static function buildColumnSpecListFromXML(nodeList: XMLList,
|
---|
| 261 | colorMaps: ArrayCollection): ArrayCollection
|
---|
| 262 | {
|
---|
| 263 | var columnSpec: ColumnSpecVO;
|
---|
| 264 | var list: ArrayCollection = new ArrayCollection();
|
---|
| 265 | for each (var item:XML in nodeList) {
|
---|
| 266 | columnSpec = new ColumnSpecVO();
|
---|
| 267 | columnSpec.attribute = item.@att;
|
---|
| 268 | columnSpec.header = item.@header;
|
---|
| 269 | columnSpec.colorMap = BoardTools.locateColorMap(item.@color, colorMaps);
|
---|
| 270 | columnSpec.width = int(item.@width);
|
---|
| 271 | columnSpec.label = item.@label;
|
---|
| 272 | list.addItem(columnSpec);
|
---|
| 273 | }
|
---|
| 274 | return list;
|
---|
| 275 | }
|
---|
| 276 |
|
---|
| 277 | public static function buildRoomBedListFromXML(nodeList: XMLList): ArrayCollection
|
---|
| 278 | {
|
---|
| 279 | var list: ArrayCollection = new ArrayCollection();
|
---|
| 280 | for each (var item: XML in nodeList) {
|
---|
| 281 | var bed: RoomBedVO = new RoomBedVO();
|
---|
| 282 | bed.id = int(item.@id);
|
---|
| 283 | bed.area = int(item.@area);
|
---|
| 284 | bed.name = item.@name;
|
---|
| 285 | bed.inactive = (item.@inactive == "1");
|
---|
| 286 | bed.sequence = int(item.@seq);
|
---|
| 287 | bed.displayName = item.@display;
|
---|
| 288 | bed.displayWhen = item.@when;
|
---|
| 289 | bed.defaultStatus = item.@status;
|
---|
| 290 | bed.category = item.@category;
|
---|
| 291 | bed.sharedName = item.@shared;
|
---|
| 292 | bed.boardName = item.@board;
|
---|
| 293 | bed.color = buildColorSelection(item.@color);
|
---|
| 294 | list.addItem(bed);
|
---|
| 295 | }
|
---|
| 296 | return list;
|
---|
| 297 | }
|
---|
| 298 |
|
---|
| 299 | public static function buildCodeSelectionListFromXML(nodeList: XMLList): ArrayCollection
|
---|
| 300 | {
|
---|
| 301 | var list: ArrayCollection = new ArrayCollection();
|
---|
| 302 | for each (var item: XML in nodeList) {
|
---|
| 303 | var sel: CodeSelectionVO = new CodeSelectionVO();
|
---|
| 304 | sel.id = int(item.@id);
|
---|
| 305 | sel.name = item.@nm;
|
---|
| 306 | sel.displayName = item.@show;
|
---|
| 307 | sel.abbreviation = item.@abbr;
|
---|
| 308 | sel.flag = item.@flag;
|
---|
| 309 | sel.inactive = (item.@inact == "1") ? true : false;
|
---|
| 310 | sel.national = item.@natl;
|
---|
| 311 | list.addItem(sel);
|
---|
| 312 | }
|
---|
| 313 | return list;
|
---|
| 314 | }
|
---|
| 315 |
|
---|
| 316 | // <staff duz="123" nm="WELBY,MARCUS" itl="MW" role="P" clr="1,0x00ff00,0xff0000" />
|
---|
| 317 | public static function buildStaffListFromXML(nodeList: XMLList): ArrayCollection
|
---|
| 318 | {
|
---|
| 319 | var list: ArrayCollection = new ArrayCollection();
|
---|
| 320 | for each (var item: XML in nodeList) {
|
---|
| 321 | var person: StaffMemberVO = new StaffMemberVO();
|
---|
| 322 | person.duz = item.@duz;
|
---|
| 323 | person.name = item.@nm;
|
---|
| 324 | person.initials = item.@itl;
|
---|
| 325 | var title:String = item.@title;
|
---|
| 326 | person.role = item.@role;
|
---|
| 327 | if (title.length > 0){
|
---|
| 328 | person.displayName = item.@nm + " (" + title + ")";
|
---|
| 329 | } else {
|
---|
| 330 | person.displayName = item.@nm;
|
---|
| 331 | }
|
---|
| 332 | person.color = buildColorSelection(item.@clr);
|
---|
| 333 | list.addItem(person);
|
---|
| 334 | }
|
---|
| 335 | return list;
|
---|
| 336 | }
|
---|
| 337 |
|
---|
| 338 | public static function buildVisitListFromXML(nodeList: XMLList): ArrayCollection
|
---|
| 339 | {
|
---|
| 340 | var list: ArrayCollection = new ArrayCollection();
|
---|
| 341 | if (nodeList.length() == 0) {
|
---|
| 342 | var emptyVisit: VisitVO = new VisitVO();
|
---|
| 343 | emptyVisit.id = -1;
|
---|
| 344 | emptyVisit.name = "No matches found.";
|
---|
| 345 | list.addItem(emptyVisit);
|
---|
| 346 | return list;
|
---|
| 347 | } else {
|
---|
| 348 | for each (var item: XML in nodeList) {
|
---|
| 349 | var visit: VisitVO = new VisitVO();
|
---|
| 350 | visit.id = item.@id;
|
---|
| 351 | visit.name = item.@name;
|
---|
| 352 | visit.inTS = Vista.FMtoDate(item.@inTS);
|
---|
| 353 | list.addItem(visit);
|
---|
| 354 | }
|
---|
| 355 | return list;
|
---|
| 356 | }
|
---|
| 357 | }
|
---|
| 358 |
|
---|
| 359 | private static function buildNotesFromXML(nodeList: XMLList): ArrayCollection
|
---|
| 360 | {
|
---|
| 361 | var list: ArrayCollection = new ArrayCollection();
|
---|
| 362 | for each (var item: XML in nodeList) {
|
---|
| 363 | var note: NoteVO = new NoteVO();
|
---|
| 364 | note.action = item.@action;
|
---|
| 365 | note.author = item.@author;
|
---|
| 366 | note.id = item.@id;
|
---|
| 367 | note.noteDate = Vista.FMtoDate(item.@noteTS);
|
---|
| 368 | note.text = item.text;
|
---|
| 369 | list.addItem(note);
|
---|
| 370 | }
|
---|
| 371 | return list;
|
---|
| 372 | }
|
---|
| 373 |
|
---|
| 374 | }
|
---|
| 375 | }
|
---|