maintenance: title: Form_Stress_test_close;; mlmname: Form_Stress_test_close;; arden: version 2.5;; version: 6.10;; institution: SCH ;; author: Deepty Singh/ Shivprasad Jadhav;; specialist: Shubha Rai;; date: 2015-11-18;; validation: testing;; library: purpose: When user orders Stress test item for today and the time for breakfast has passed then the OS should auto uncheck Stress Thallium Diet for breakfast so that it doesnot give warning at the end of order submission ;; explanation: Change History ----------------------------------- 18.11.2015 GOS CSR-32398 : MLM Created ;; keywords: ;; citations: ;; knowledge: type: data-driven;; data: (this_communication, // Communication object this_form, // Form object client_info_obj //Arden ClientInfo object ) := argument; field_list:= this_form.Fields; // find pt{{{SINGLE-QUOTE}}}s details Client_GUID := this_communication.ClientGUID; ClientVisit_GUID := this_communication.ClientVisitGUID; Chart_GUID := this_communication.ChartGUID; form_name := this_form.Name; if form_name = "NUR_MINucleMedPrepN7" AND this_communication.FormType = "OrderSet" THEN mlmImaging := MLM {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING{{{SINGLE-QUOTE}}}; this_communication := CALL mlmImaging WITH this_communication; ENDIF; if form_name = "MI Nuc Med Prep Card" AND this_communication.FormType = "OrderSet" THEN mlmImaging := MLM {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING{{{SINGLE-QUOTE}}}; this_communication := CALL mlmImaging WITH this_communication; ENDIF; If this_communication.CallingFieldName matches Pattern "MultiOrderGrid%" THEN // this_communication.CallingFieldLabel = "Dietary" AND If form_name = "NUR_MINucleMedPrepN7" then MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" ); Grid_list := MulitOrderGrid_field2.Value; Found_Diet:= Grid_list[2];// breakfast Order Found_lunch:= Grid_list[3]; // lunch order ELSE MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Dietary"); Grid_list := MulitOrderGrid_field2.Value; Found_Diet:= Grid_list[1];// breakfast Order Found_lunch:= Grid_list[2]; // lunch order ENDIF; IF Found_Diet.IsSelected = True THEN Found_lunch.IsSelected := False ; Found_lunch.IsReadOnly := True ; ELSEIF Found_lunch.IsSelected = True THEN Found_Diet.IsSelected := False ; Found_Diet.IsReadOnly := True ; ELSE Found_Diet.IsReadOnly := False ; Found_lunch.IsReadOnly := False ; ENDIF; ELSEif this_communication.CallingEvent = "FormClose" THEN if form_name = "NUR_MINucleMedPrepN7" then MulitOrderGrid_field := first of (field_list where field_list.DataItemName = "MultiOrderGrid" ); Grid_list := MulitOrderGrid_field.Value; Found_Ord3:= first of (Grid_list where Grid_list.Name = "Nursing Instructions - Place an Order for a Stress Test");// continue sepsis orders //Found_Diet:= first of (Grid_list where Grid_list.Name = "Stress Thallium Diet");// continue sepsis orders Found_Diet:= Grid_list[2];// breakfast Order Found_lunch:= Grid_list[3]; // lunch order ENDIF; if form_name = "MI Nuc Med Prep Card" THEN MulitOrderGrid_field := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Medical Imaging Order"); MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Dietary"); // MulitOrderGrid_field3 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Nursing - Test Prep"); If exists MulitOrderGrid_field then Grid_list := MulitOrderGrid_field.Value; Grid_list2 := MulitOrderGrid_field2.Value; // Grid_list3 := MulitOrderGrid_field3.Value; Found_Diet:= Grid_list2[1];// breakfast Order Found_lunch:= Grid_list2[2]; // lunch order Found_Ord1:= first of (Grid_list where Grid_list.Name = "Exercise Radionuclide Stress");// continue sepsis orders Found_Ord2:= first of (Grid_list where Grid_list.Name = "RSTED- Radionuc. Stress Exercise Data");// continue sepsis orders Found_Ord4:= first of (Grid_list where Grid_list.Name = "Outpt Exercise Radionuclide Stress");// continue sepsis orders ENDIF; ENDIF; if form_name = "MI Nuc Med Pre N8/12" THEN MulitOrderGrid_field := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Medical Imaging Order"); MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label matches pattern "Dietary%"); If exists MulitOrderGrid_field then Grid_list := MulitOrderGrid_field.Value; Grid_list2 := MulitOrderGrid_field2.Value; Found_Diet:= Grid_list2[1];// breakfast Order Found_lunch:= Grid_list2[2]; // lunch order Found_Ord5:= first of (Grid_list where Grid_list.Name = "Outpt Pharmaceutical Radionuc Stress");// continue sepsis orders Found_Ord2:= first of (Grid_list where Grid_list.Name = "RSTED- Radionuc. Stress Exercise Data");// continue sepsis orders Found_Ord6:= first of (Grid_list where Grid_list.Name = "Pharmaceutical Radionuc Stress");// continue sepsis orders ENDIF; ENDIF; if (form_name = "Cardiolo Str Test 2" or form_name = "Cardiolo Stress Test" ) THEN // added New form Name By Shivprasad MulitOrderGrid_field := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Cardiology"); MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Dietary"); If exists MulitOrderGrid_field then Grid_list := MulitOrderGrid_field.Value; Grid_list2 := MulitOrderGrid_field2.Value; //Found_Diet:= first of (Grid_list2 where Grid_list2.Name = "Stress Thallium Diet");// continue sepsis orders Found_Diet:= Grid_list2[1];// breakfast Order Found_lunch:= Grid_list2[2]; // lunch order Found_Ord7:= first of (Grid_list where Grid_list.Name = "Stress Echo");// continue sepsis orders ENDIF; ENDIF; if form_name = "Card Stress Test 2" THEN MulitOrderGrid_field := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Cardiology"); MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Dietary"); If exists MulitOrderGrid_field then Grid_list := MulitOrderGrid_field.Value; Grid_list2 := MulitOrderGrid_field2.Value; //Found_Diet:= first of (Grid_list2 where Grid_list2.Name = "Stress Thallium Diet");// continue sepsis orders Found_Diet:= Grid_list2[1];// breakfast Order Found_lunch:= Grid_list2[2]; // lunch order Found_Ord8:= first of (Grid_list where Grid_list.Name = "Treadmill Stress Test");// continue sepsis orders ENDIF; ENDIF; Ord_dt := first of (field_list where field_list.DataItemName = "RequestedDate"); ord_dt_val := Ord_dt.value; dt := day of ord_dt_val; dt1 := day of now; mt := month of ord_dt_val; mt1 := month of now; yr := year of ord_dt_val; yr1 := year of now; if dt = dt1 AND mt = mt1 AND yr = yr1 THEN hh, mins := Read Last{"select datepart(hh,getdate()), datepart(minute,getdate())"}; hh := hh as number; mins := mins as number; //hh:= 15; //mins:= 32; IF (Found_Ord1.IsSelected = TRUE OR Found_Ord2.IsSelected = TRUE OR Found_Ord3.IsSelected = TRUE OR Found_Ord4.IsSelected = TRUE OR Found_Ord5.IsSelected = TRUE OR Found_Ord6.IsSelected = TRUE OR Found_Ord7.IsSelected = TRUE OR Found_Ord8.IsSelected = TRUE ) AND (Found_Diet.IsSelected = TRUE) AND (Found_lunch.IsSelected = False) THEN IF ((hh >= 7 AND mins >= 31) OR (hh > 7)OR (hh = 7 AND mins >= 31)) AND ((hh <= 13 AND mins <= 45) OR (hh < 13)OR (hh = 13 AND mins <= 45)) THEN standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Breakfast Time has passed for today. Do you want to proceed with the Stress Test today? Yes, will schedule the Stress Test With Lunch Diet Order. No, will schedule the Stress Test for tomorrow", "Stress Test Alert", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; dialogResult := dialogResult As string; IF dialogResult = "Yes" Then Found_lunch.IsSelected := True; Found_Diet.IsSelected := False; ELSE Ord_dt.value := now + 1 day; ENDIF; ENDIF; IF ((hh >= 13 AND mins >= 45) OR (hh > 13)OR (hh = 13 AND mins >= 45)) And ((hh <= 15 AND mins <= 30) OR (hh < 15)OR (hh = 15 AND mins <= 30)) // Condition Added By Shivprasad As per Rob{{{SINGLE-QUOTE}}}s Request THEN standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Lunch Time has passed for today. Do you want to proceed with the Stress Test today? No, will schedule the Stress Test with Breakfast Diet Order tomorrow", "Stress Test Alert", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; dialogResult := dialogResult As string; IF dialogResult = "Yes" Then Found_lunch.IsSelected := False; Found_Diet.IsSelected := False; ELSE Ord_dt.value := now + 1 day; Found_lunch.IsSelected := False; Found_Diet.IsSelected := True; ENDIF; ElseIf ((hh >= 15 AND mins >= 30) OR (hh > 15)OR (hh = 15 AND mins >= 30)) // And ((hh <= 7 AND mins <= 30) OR (hh < 7) OR (hh = 7 AND mins <= 30)) Then // {{{SINGLE-QUOTE}}}ElseIf{{{SINGLE-QUOTE}}} Condition Added By Shivprasad As per Rob{{{SINGLE-QUOTE}}}s Request Ord_dt.value := now + 1 day; Found_lunch.IsSelected := False; Found_Diet.IsSelected := True; ENDIF; ENDIF; IF (Found_Ord1.IsSelected = TRUE OR Found_Ord2.IsSelected = TRUE OR Found_Ord3.IsSelected = TRUE OR Found_Ord4.IsSelected = TRUE OR Found_Ord5.IsSelected = TRUE OR Found_Ord6.IsSelected = TRUE OR Found_Ord7.IsSelected = TRUE OR Found_Ord8.IsSelected = TRUE ) AND (Found_Diet.IsSelected = FALSE) AND(Found_lunch.IsSelected = TRUE) THEN IF ((hh >= 13 AND mins >= 45) OR (hh > 13)OR (hh = 13 AND mins >= 45)) And ((hh <= 15 AND mins <= 30) OR (hh < 15)OR (hh = 15 AND mins <= 30)) // Condition Added By Shivprasad As per Rob{{{SINGLE-QUOTE}}}s Request THEN standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Lunch Time has passed for today. Do you want to proceed with the Stress Test today? No, will schedule the Stress Test with Breakfast Diet Order tomorrow", "Stress Test Alert", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; dialogResult := dialogResult As string; IF dialogResult = "Yes" Then Found_lunch.IsSelected := False; ELSE Ord_dt.value := now + 1 day; Found_lunch.IsSelected := False; Found_Diet.IsSelected := True; ENDIF; ElseIf ((hh >= 15 AND mins >= 30) OR (hh > 15)OR (hh = 15 AND mins >= 30)) // And ((hh <= 7 AND mins <= 30) OR (hh < 7) OR (hh = 7 AND mins <= 30)) Then // {{{SINGLE-QUOTE}}}ElseIf{{{SINGLE-QUOTE}}} Condition Added By Shivprasad As per Rob{{{SINGLE-QUOTE}}}s Request Ord_dt.value := now + 1 day; Found_lunch.IsSelected := False; Found_Diet.IsSelected := True; ENDIF; ENDIF; /* IF (Found_Ord1.IsSelected = TRUE OR Found_Ord2.IsSelected = TRUE OR Found_Ord3.IsSelected = TRUE OR Found_Ord4.IsSelected = TRUE OR Found_Ord5.IsSelected = TRUE OR Found_Ord6.IsSelected = TRUE OR Found_Ord7.IsSelected = TRUE OR Found_Ord8.IsSelected = TRUE ) AND (Found_Diet.IsSelected = TRUE) AND(Found_lunch.IsSelected = TRUE) THEN IF ((hh >= 7 AND mins >= 31) OR (hh > 7)OR (hh = 7 AND mins >= 31)) AND ((hh <= 9 AND mins >= 16) OR (hh < 9)OR (hh = 9 AND mins <= 16)) THEN standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Breakfast Time has passed for today. Do you want to proceed with the Stress Test today? Yes, will schedule the Stress Test With Lunch Diet Order. No, will schedule the Stress Test for tomorrow", "Stress Test Alert", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; dialogResult := dialogResult As string; IF dialogResult = "Yes" Then Found_lunch.IsSelected := True; Found_Diet.IsSelected := False; ELSE Ord_dt.value := now + 1 day; ENDIF; ENDIF; IF ((hh >= 9 AND mins >= 16) OR (hh > 9)OR (hh = 9 AND mins >= 16)) THEN standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Lunch Time has passed for today. Do you want to proceed with the Stress Test today? No, will schedule the Stress Test with Breakfast Diet Order tomorrow", "Stress Test Alert", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; dialogResult := dialogResult As string; IF dialogResult = "Yes" Then Found_lunch.IsSelected := False; Found_Diet.IsSelected := False; ELSE Ord_dt.value := now + 1 day; Found_lunch.IsSelected := False; Found_Diet.IsSelected := True; ENDIF; ENDIF; ENDIF;*/ ENDIF; ENDIF; //break; ;; priority: 50 ;; evoke: ;; logic: conclude true; ;; action: return this_communication, this_form; ;; Urgency: 50;; end: