patientView.as 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. import com.imt.intimamedia.events.patient.SearchPatientEvent;
  2. import com.imt.intimamedia.events.patient.UpdateAppointmentEvent;
  3. import com.imt.intimamedia.model.ApplicationModelLocator;
  4. import com.imt.intimamedia.views.common.ImtToaster;
  5. import com.imt.intimamedia.views.physician.patient.AtherosclerosisRiskFactors;
  6. import com.imt.intimamedia.views.physician.patient.FamilyHistory;
  7. import com.imt.intimamedia.views.physician.patient.PatientFile;
  8. import com.imt.intimamedia.vo.AtsVo;
  9. import com.imt.intimamedia.vo.CvExaminatorVo;
  10. import com.imt.intimamedia.vo.FamilyHistoryVo;
  11. import com.imt.intimamedia.vo.PersonalHistoryVo;
  12. import com.imt.intimamedia.vo.TobaccoVo;
  13. import mx.containers.Box;
  14. import mx.controls.Alert;
  15. import mx.controls.Image;
  16. import mx.controls.LinkButton;
  17. import mx.events.ItemClickEvent;
  18. import mx.resources.ResourceManager;
  19. [Embed(source="images/patient/startArrowRedTimeLine.png")]
  20. [Bindable]
  21. public var startArrowRedTimeLine : Class;
  22. [Embed(source="images/patient/endArrowRedTimeLine.png")]
  23. [Bindable]
  24. public var endArrowRedTimeLine : Class;
  25. [Embed(source="images/patient/startArrowGreyTimeLine.png")]
  26. [Bindable]
  27. public var startArrowGreyTimeLine : Class;
  28. [Embed(source="images/patient/endArrowGreyTimeLine.png")]
  29. [Bindable]
  30. public var endArrowGreyTimeLine : Class;
  31. private var _currentStartArrow : Image;
  32. private var _currentEndArrow : Image;
  33. private var _currentBox : Box;
  34. private var _currentLinkButton : LinkButton;
  35. [Bindable]
  36. private var _model : ApplicationModelLocator = ApplicationModelLocator.getInstance();
  37. import mx.events.BrowserChangeEvent;
  38. import mx.managers.BrowserManager;
  39. import mx.managers.IBrowserManager;
  40. import mx.utils.URLUtil;
  41. import com.imt.intimamedia.vo.AppointmentVo;
  42. import mx.core.Application;
  43. import com.imt.intimamedia.helpers.HelpUtils;
  44. private var browserManager:IBrowserManager;
  45. private function showView() : void
  46. {
  47. displayPatientList();
  48. // load help if needed
  49. if (ApplicationModelLocator.getInstance().connectedUser.help)
  50. {
  51. HelpUtils.loadHelp(HelpUtils.buildPatientHelpPages(), 0);
  52. }
  53. }
  54. private function creationCompleteHandler() : void
  55. {
  56. //loadBrowserManager();
  57. }
  58. private function loadBrowserManager() : void
  59. {
  60. /*browserManager = BrowserManager.getInstance();
  61. browserManager.addEventListener(
  62. BrowserChangeEvent.BROWSER_URL_CHANGE,
  63. parseUrl
  64. )*/
  65. }
  66. private function parseUrl(e:BrowserChangeEvent = null):void
  67. {
  68. /* var o:Object = URLUtil.stringToObject(browserManager.fragment);
  69. if (!o.b)
  70. {
  71. ApplicationModelLocator.getInstance().application.menuPhysician.selectedIndex = o.p;
  72. patientView.selectedIndex = 0;
  73. browserManager.setFragment("p=" + o.p);
  74. }
  75. else
  76. patientView.selectedIndex = o.b;
  77. */
  78. }
  79. private function updateUrl():void
  80. {
  81. //browserManager.setFragment("b=" + patientView.selectedIndex);
  82. }
  83. private function displayPatientList() : void
  84. {
  85. selectView(patientStart, patientEnd, patientBox, patientLinkButton, 0);
  86. //patientFile.dg.enabled = false;
  87. new SearchPatientEvent( "", this ).dispatch();
  88. }
  89. public function setSearchPatientText() : void
  90. {
  91. /* nothing to do */
  92. return;
  93. }
  94. public function selectView( start : Image, end : Image, box : Box, linkButton : LinkButton, index : int ) : void
  95. {
  96. var toastMessage : ImtToaster;
  97. // no patient selected or created
  98. if (index && (_model.patientSelected.uid == "" || !_model.patientActive))
  99. {
  100. toastMessage = new ImtToaster();
  101. toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'warning.use');
  102. toastMessage.message = ResourceManager.getInstance().getString('labels', 'warning.choosePatient');
  103. toastMessage.timeToLive = 6;
  104. toastMessage.level = ImtToaster.WARNING;
  105. ApplicationModelLocator.getInstance().toaster.toast( toastMessage );
  106. return;
  107. }
  108. // patient selected but not appointment
  109. if (index && _model.noAppointmentSelected)
  110. {
  111. toastMessage = new ImtToaster();
  112. toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'warning.use');
  113. toastMessage.message = ResourceManager.getInstance().getString('labels', 'warning.chooseAppointment');
  114. toastMessage.timeToLive = 6;
  115. toastMessage.level = ImtToaster.WARNING;
  116. _model.toaster.toast( toastMessage );
  117. return;
  118. }
  119. if ( _currentStartArrow == null )
  120. {
  121. _currentStartArrow = patientStart;
  122. _currentEndArrow = patientEnd;
  123. _currentBox = patientBox;
  124. _currentLinkButton = patientLinkButton;
  125. }
  126. _currentStartArrow.source = startArrowGreyTimeLine;
  127. _currentEndArrow.source = endArrowGreyTimeLine;
  128. _currentBox.setStyle( "styleName", "backgroundGreyTimeLine" );
  129. _currentLinkButton.setStyle( "styleName", "linkButtonGreyTimeLine" );
  130. start.source = startArrowRedTimeLine;
  131. end.source = endArrowRedTimeLine;
  132. box.setStyle( "styleName", "backgroundRedTimeLine" );
  133. linkButton.setStyle( "styleName", "linkButtonRedTimeLine" );
  134. patientView.selectedIndex = index;
  135. _currentStartArrow = start;
  136. _currentEndArrow = end;
  137. _currentBox = box;
  138. _currentLinkButton = linkButton;
  139. if (!_model.viewPatient)
  140. {
  141. switch (index)
  142. {
  143. case 2:
  144. updateAts();
  145. break;
  146. case 3:
  147. updatePersonalHistory();
  148. break;
  149. case 4:
  150. updateFamilyHistory();
  151. break;
  152. case 5:
  153. updateCve();
  154. break;
  155. default:
  156. break;
  157. }
  158. }
  159. //if (index == 0)
  160. //this.patientFile.updatePatientDatagrid();
  161. }
  162. private function showHelp() : void
  163. {
  164. patientFile.showHelp(patientFile.patientTabHelp);
  165. }
  166. public function updateAts() : void
  167. {
  168. var atsVo : AtsVo = new AtsVo();
  169. atsVo.hta = ats.htaButtonGroup.selectedValue;
  170. atsVo.htaDuration = parseInt(ats.htaDurationTextInput.text);
  171. atsVo.htg = ats.htgButtonGroup.selectedValue;
  172. atsVo.htgDuration = parseInt(ats.htgDurationTextInput.text);
  173. atsVo.hct = ats.hctButtonGroup.selectedValue;
  174. atsVo.hctDuration = parseInt(ats.hctDurationTextInput.text);
  175. atsVo.diabete = ats.diabeteButtonGroup.selectedValue;
  176. atsVo.diabeteDuration = parseInt(ats.diabeteDurationTextInput.text);
  177. var tobaccoVo : TobaccoVo = new TobaccoVo();
  178. tobaccoVo.smoke = ats.smokeButtonGroup.selectedValue;
  179. tobaccoVo.age = ats.smokeDurationNumericStepper.value;
  180. tobaccoVo.cigarettesPerDay = ats.cbdNumericStepper.value;
  181. tobaccoVo.ageStopSmoking = ats.stopSmokingDurationNumericStepper.value;
  182. tobaccoVo.paquetYear = ats.pbyNumericStepper.value;
  183. _model.appointmentSelected.ats = atsVo;
  184. _model.appointmentSelected.tobacco = tobaccoVo;
  185. }
  186. public function updatePersonalHistory() : void
  187. {
  188. var personalHistoryVo : PersonalHistoryVo = new PersonalHistoryVo();
  189. personalHistoryVo.coronaryDisease = personalHistory.coronaryButtonGroup.selectedValue;
  190. if( personalHistory.coronaryDiseaseTypeComboBox.selectedItem != null )
  191. personalHistoryVo.typeCoronaryDisease = personalHistory.coronaryDiseaseTypeComboBox.selectedItem.code;
  192. personalHistoryVo.aic = personalHistory.aicButtonGroup.selectedValue;
  193. personalHistoryVo.numberAic = personalHistory.numberAicNumericStepper.value;
  194. personalHistoryVo.lastCoronaryDiseaseAge = personalHistory.lastCoronaryDiseaseAgeTextInput.text;
  195. personalHistoryVo.lastAicAge = personalHistory.lastAicAgeTextInput.text;
  196. if( personalHistory.aicTypeComboBox.selectedItem != null )
  197. personalHistoryVo.typeAic = personalHistory.aicTypeComboBox.selectedItem.code;
  198. if( personalHistory.ethiologyTypeComboBox.selectedItem != null )
  199. personalHistoryVo.ethiologyAic = personalHistory.ethiologyTypeComboBox.selectedItem.code;
  200. _model.appointmentSelected.personalHistory = personalHistoryVo;
  201. }
  202. public function updateFamilyHistory() : void
  203. {
  204. var familyHistoryVo : FamilyHistoryVo = new FamilyHistoryVo();
  205. familyHistoryVo.fatherCoronaryPathology = familyHistory.fatherCoronaryButtonGroup.selectedValue;
  206. familyHistoryVo.fatherCoronaryPathologyAge = parseInt(familyHistory.fatherCoronaryAgeTextInput.text);
  207. familyHistoryVo.fatherVascularPathology = familyHistory.fatherVascularButtonGroup.selectedValue;
  208. familyHistoryVo.fatherVascularPathologyAge = parseInt(familyHistory.fatherVascularAgeTextInput.text);
  209. familyHistoryVo.motherCoronaryPathology = familyHistory.motherCoronaryButtonGroup.selectedValue;
  210. familyHistoryVo.motherCoronaryPathologyAge = parseInt(familyHistory.motherCoronaryAgeTextInput.text);
  211. familyHistoryVo.motherVascularPathology = familyHistory.motherVascularButtonGroup.selectedValue;
  212. familyHistoryVo.motherVascularPathologyAge = parseInt(familyHistory.motherVascularAgeTextInput.text);
  213. familyHistoryVo.bsCoronaryPathology = familyHistory.bsCoronaryButtonGroup.selectedValue;
  214. familyHistoryVo.bsCoronaryPathologyAge = parseInt(familyHistory.bsCoronaryAgeTextInput.text);
  215. familyHistoryVo.bsVascularPathology = familyHistory.bsVascularButtonGroup.selectedValue;
  216. familyHistoryVo.bsVascularPathologyAge = parseInt(familyHistory.bsVascularAgeTextInput.text);
  217. _model.appointmentSelected.familyHistory = familyHistoryVo;
  218. }
  219. public function updateCve() : void
  220. {
  221. var cvExaminatorVo : CvExaminatorVo = new CvExaminatorVo();
  222. cvExaminatorVo.frequency = parseInt(cve.heartFrequencyTextInput.text);
  223. cvExaminatorVo.arythmia = cve.arythmiaButtonGroup.selectedValue;
  224. cvExaminatorVo.pressureLeftMaxArm = parseInt(cve.leftMaxArmTextInput.text);
  225. cvExaminatorVo.pressureRightMaxArm = parseInt(cve.rightMaxArmTextInput.text);
  226. cvExaminatorVo.pressureLeftMaxLeg = parseInt(cve.leftMaxLegTextInput.text);
  227. cvExaminatorVo.pressureRightMaxLeg = parseInt(cve.rightMaxLegTextInput.text);
  228. cvExaminatorVo.pressureLeftMinArm = parseInt(cve.leftMinArmTextInput.text);
  229. cvExaminatorVo.pressureRightMinArm = parseInt(cve.rightMinArmTextInput.text);
  230. cvExaminatorVo.pressureLeftMinLeg = parseInt(cve.leftMinLegTextInput.text);
  231. cvExaminatorVo.pressureRightMinLeg = parseInt(cve.rightMinLegTextInput.text);
  232. _model.appointmentSelected.cvExaminator = cvExaminatorVo;
  233. }
  234. public function loadAppointmentData(appointmentVo : AppointmentVo, newAppointment : Boolean) : void
  235. {
  236. ats.loadAppointmentData(appointmentVo.ats, appointmentVo.tobacco);
  237. personalHistory.loadAppointmentData(appointmentVo.personalHistory);
  238. familyHistory.loadAppointmentData(appointmentVo.familyHistory);
  239. if (!newAppointment)
  240. cve.loadAppointmentData(appointmentVo.cvExaminator);
  241. treatments.loadAppointmentData(appointmentVo.treatmentCollection);
  242. }
  243. public function updateErrorStrings() : void
  244. {
  245. patientFile.updateErrorStrings();
  246. treatments.updateErrorStrings();
  247. }
  248. public function resetPatientData() : void
  249. {
  250. ats.reset();
  251. personalHistory.reset();
  252. familyHistory.reset();
  253. cve.reset();
  254. treatments.reset();
  255. }