maintenance: title: Document Surgical Case Fields;; mlmname: DOC_SCH_SMP_SURGICAL_CASE;; arden: version 2.5;; version: 16.3 ;; institution: St Claire ;; author: Allscripts;; specialist: Gail G. ;; date: 2017-04-05;; validation: testing;; library: purpose: Demonstrates the ability to pull surgical case info into the structured note when the document is opened and when it is saved. ;; explanation: Demonstrates the ability to pull surgical case info. //// Change History for SHC ///////////////////////////////////////////// 10/14/16 - Allscripts - updated fetch and display for insertion of Implant Tissue section into the new_case_info_value for writing to case_info_parameter_name 02/07/17 - update for Reload Surgery observation from Gail G. 04/05/17 - initial update to SHC configuration for init deploy- and update Tissue- Implant fetch/display 04/07/17 - details reload observation 04/13/17 Add call to Meds MLM for load 08/16/17 Add call to "DOC_CALL_SPECIMEN_PATHOLOGY" 12/08/17 - updated for Rita J. to fetch /display for Procedure Dxs 12/15/17 - now for Post Op and Pre Op - and into PRocedures grids 01/03/18 - update to adjust for width of paper on preview - and the extra column for Pre Post Dx 01/22/18 - updated Dispostion for SCH config 01/23/18 - update to put Level infront of the number 02/05/18 - addition for displaying the edited Name from the Supplemental FORm 02/23/18 - update to pull only Active case Items ci.Active = 1 04/19/18 - update to put ASA infront of the number for the ASA into the Grid 04/23/18 - change back to Read disposition from config of order for Dispo of Implant 07/24/19 - STH - CSR#: 37676 - Add new "Physical Status" value that is now used for ASA score to the Surgical Case information section. ***08/01/16 - Allscripts - try fix for Participants to use external_participant_name if no Staff/CV3User configuration /////////////////////////////////////////////////////////////////////////////// To use this mlm the following needs to be done: 1) Create two Observation Items. For example, name them "Surgical Case Number" and "Surgical Case Info". Name - "Surgical Case Number" Data Definition - Data Type: Free text; Maximum Input Length: 500; Maximum Number of Lines: 1; Field Height: 1; Field Width: 200; (or it could be anything you want)1 Enable Formatting Text: Unchecked Row Label Definition - Left Justified: Surgical Case Number; Modify Parameter/Filter: Surgical Case Number; Security - No Editing: true; Add some rights Name - "Surgical Case Info" Data Definition - Data Type: Free text; Maximum Input Length: 50000; Maximum Number of Lines: 9999; Field Height: 100; Field Width: 100; (or it could be anything you want) Enable Formatting Text: Checked Row Label Definition - Left Justified: Surgical Case Info; Modify Parameter/Filter: Surgical Case Info; Security - No Editing: true; Add some rights 2) Create one Observation Set. For example, name it "Surgical Case Details Set". Set Type: Unbordered Add Set Items and add the two Observation Items from above. 3) Create one Observation Group. For example, name it "Surgical Case Details Group". Add Items and add the Unbordered Observation Set, "Surgical Case Details Set". Positioning - Set the row numbers and column numbers. 4) Create a Structured Note. For example, name it "Surgical Case Structured Note". Add Attributes: Select the Observation Group: "Surgical Case Details Group". Click on the Surgical Case Number and in Called MLM, select Click on the Surgical Case Info and in Called MLM, select 5) Create a Document. For example, name it "Surgical Case Document". Opening MLM and Closing MLM: DOC_SMP_SURGICAL_CASE Data Collection: Structured Note Search and select "Surgical Case Structured Note". Security - Add some rights 6) Set the variables, case_number_parameter_name and case_info_parameter, on this MLM with the Observation Items names created on Step 1 above. For example, case_number_parameter_name := "Surgical Case Number"; case_info_parameter_name := "Surgical Case Info"; 7) Set the variable, is_display_message, on this MLM if a message should display when opening the document. For example, is_display_message := true; 8) Ensure that the user has the right "Can Add Document Topic to SN". 9) Set the Environment Profile - Documents > Structured Notes > DocumentTopic to TRUE. When viewing the document, the Document Topic will contain the Case Number. Also, the document name will be appended with the Case Number. 10) From Gateway, select a Surgical Case. From the Document Entry Worksheet, enter "Surgical Case Document". The document should display with the case number and case details of the case in context. User can edit the Surgical Case from the Case Details tab/window. On saving the document, the latest case details will be saved on the document. ;; keywords: RTF, Document Called MLM , Surgical Case ;; knowledge: type: data-driven;; data: (this_documentCommunication) := argument; /*******************Make Changes To Spelling And Flags In This Section******************/ // References the LOCAL SESSION object /// 01/12/17 - for Medication section local_session := cds_session.local; /* Set to true if a decision.log is needed.*/ log_execution_info := false; /* Set to parameter name of the free text observation item representing the case number. */ case_number_parameter_name := "Surgical Case Number"; //"OR Surgical Case Number FT"; /* Set to parameter name of the free text observation item representing the case info. */ case_info_parameter_name := "Surgical Case Info"; // FT"; //"OR Surgical Case Info FT"; /* Set to true if displaying a message when opening the document. */ is_display_message := false; // 02/07/17 - med reload observation med_load:= "Reload surg details" ; //////////////////////////////////////////////////////// /***************************************************************************************/ /*** Variable and Constant Declaration ***/ (this_structuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj; (this_parameters) := this_structuredNoteDoc.ParametersList; (this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList; (this_eventType) :=this_documentCommunication.EventType; (this_currentObj) := this_documentCommunication.CurrentObservationObj; (this_DocumentName) := this_documentCommunication.DocumentName; current_parameter := FIRST OF (this_Parameters WHERE this_parameters.ParameterGUID = this_CurrentObj.ParameterGUID); current_parameter_name := current_parameter.name ; cur_obs:= FIRST OF (this_parameters WHERE this_parameters.name = current_parameter_name) ; cur_obj:= FIRST OF (this_Parameters WHERE this_parameters.ParameterGUID = cur_obs.ParameterGUID); cur_val_obj := cur_obj.valueobj; cur_val_text := this_currentObj.ValueObj.Value; //cur_val_obj.value; get_vals:= this_currentObj.ValueObj.Records__ ; get_val_list:= get_vals.ListItemsList.IsSelected; //Value; //Records__; //this_currentObj.ValueObj.ListValue ; ct_lst:= count get_val_list; //break; if called_by_editor then client_guid := read last {ClientInfo: GUID}; client_visit_guid := read last {ClientVisit: GUID}; chart_guid := read last{ClientVisit: ChartGUID}; ///testin /// CONVERT(varchar, CONVERT(datetime, cpt.InDateTimeUTC)), case_id:= 569; //492; // 569; //356; (it_ItemID, it_Item, it_catno, it_desc, it_supNotes, it_Dispodtm, it_Manu, it_Charge, it_serial, it_lot, it_site, it_quant, it_ExpMM, it_expDD, it_expYYYY, it_DispoID, it_Intact, it_Stored, it_Follow, it_PrepStart , it_PrepStop, it_user, it_tnotes ):= read // it_xml, {" select sdi.ItemID, sdi.ItemName,csi.CatalogNumber, csi.ItemMasterDescription, csi.Notes, " || " CONVERT(varchar, CONVERT(datetime, csi.DispositionDateUTC)), inv.SourceName, cc.Code, " ||" csid.SerialNumber, csid.LotNumber, csid.SiteName, csid.Quantity, csid.ExpirationMonth, csid.ExpirationDay, csid.ExpirationYear, " ||" csid.DispositionID," ||" csit.IsIntact, csit.CorrectTemperatureStoredType, csit.ManufacturerInstructFollowType, " ||" CONVERT(varchar, CONVERT(datetime, csit.PreparationStartedDateTimeUTC)), CONVERT (varchar, CONVERT(datetime, csit.PreparationEndedDateTimeUTC)), " || " u.DisplayName, csit.Notes " // csit.DetailXML, ||" from sxasrgcase c " ||" left join SXASRGCaseItem ci on ci.CaseID = c.CaseID " ||" inner join sxasrgdepartmentsurgicalitem sdi on sdi.ItemID = ci.ItemID " ||" left join SXASRGCaseItemSupplementalInfo csi on csi.CaseItemID = ci.CaseItemID " ||" left outer join SXASRGCaseItemSupplementalInfoDtl csid on csid.CaseItemSupplementalInfoID = csi.CaseItemSupplementalInfoID " ||" left join SXASRGInvSource inv on inv.SourceID = csi.SourceID " ||" left join SXASRGChargeCode cc on cc.ChargeCodeID = csi.ChargeCodeID " ||" left outer join SXASRGCaseItemTissue csit on (csit.CaseItemSupplementalInfoDtlID = csid.CaseItemSupplementalInfoDtlID and csit.Active = 1 ) " ||" left outer join SXASRGCaseItemTissueSurgeryStaffXRef itst on itst.CaseItemTissueID = csit.CaseItemTissueID " ||" left outer join SXASRGSurgeryStaff sss on sss.SurgeryStaffID = itst.SurgeryStaffID " ||" left outer join cv3user u on u.guid = sss.userguid " ||" where c.CaseID = " || SQL(case_id) }; // || " and csit.Active = 1 " } ;// ct_item_check:= count it_item where it_intact <> "null" ; //it_user; ct_item:= count it_item ; //break; /////////////////////////////////////////////// endif; /*** RTF Formatting variables ***/ HEADER1_ON:="\f1\fs28 \b1"; HEADER1_OFF:="\b0 \fs0"; HEADER2_ON:="\f1\fs24 \b1"; HEADER2_OFF:="\b0 \fs0"; BODY_TAG:="\fs20"; BOLD_ON:="\b1"; BOLD_OFF:="\b0"; ITALIC_ON:="\i"; ITALIC_OFF:="\i0"; TAB:="\tab"; /// 03/23/17 - addition for formatting SP:= 32 formatted with "%c"; SP2:= SP||SP; //||SP||SP||SP; SP3:= SP||SP||SP; SP5:= SP2||SP3; /*** RTF Grid Formatting variables ***/ GRID_START:="\par"; ROW_START := "\trowd\trgaph144"; CELL_BORDER := "\clbrdrt\brdrs\clbrdrl\brdrs\clbrdrb\brdrs\clbrdrr\brdrs"; CELL_START := "\cellx"; CELL_END := "\intbl\cell"; ROW_END := "\row"; GRID_END:="\pard"; called_dom_mlm := MLM {{{SINGLE-QUOTE}}}CALLED_RPM_DOM_MLM{{{SINGLE-QUOTE}}} ; ///12/27/16 - for inital section of charting Specimen and fetching PreOp Dx // Get the case id of the case in context case_id := this_documentCommunication.CaseId ; /// 12/08/17 - change for Rita J - to get into grid IF this_eventType = "DocumentOpening" ///01/03/18 - addition for closing // this_eventType = "ChartObservation" or this_eventType = "DocumentClosing" //AND // (current_parameter_name IN specimen_param or current_parameter_name IN frozen_param) //AND exists cur_val_text then if exists case_id then (case_number, anesthesia_type, case_status):= read last{"SELECT c.CaseIdentifier FROM SXASRGCase c " // LEFT JOIN SXASRGAnesthesiaType at ON c.AnesthesiaTypeID = at.AnesthesiaTypeID // INNER JOIN SXASRGCaseStatus cs ON c.CaseStatusID = cs.CaseStatusID ||" WHERE c.CaseID = " || SQL(case_id)}; /// 01/19/17 - updated SQL to get only the PreOp (planned procedure) diagnosis // with this: // || " where ((cai.HasBeenPerformed = 1 and cai.AssociatedCaseProcedureID is not null) " // ||" OR cai.HasBeenPerformed = 0 )and cai.Active = 1 and cai.IsPrimary = 1 " /* (dx_scheme_0,dx_code_0, dx_desc_0, ca_desc, ca_pre, ca_post) := read { "select cad. codingscheme, cad.Code, cad.Description, cai.HealthIssueCodeDescription, pre.CasePreOpInfoID, post.CasePostOpInfoID " || " from SXASRGCase ca " || " Join SXASRGCaseProcedure cai on cai.CaseID = ca.CaseID " || " left outer join SXASRGCaseProcedureDiagnosis cad on cad.CaseProcedureID = cai.CaseProcedureID " ||" left outer join SXASRGCasePreOpInfo pre on pre.caseID = ca.CaseID " ||" left outer join SXASRGCasePostOpInfo post on post.caseID = ca.CaseID " || " where ((cai.HasBeenPerformed = 1 and cai.AssociatedCaseProcedureID is not null) " ||" OR cai.HasBeenPerformed = 0 )and " || " cai.Active = 1 and cai.IsPrimary = 1 AND cad.Active = 1 " || " AND ca.CaseIDentifier = " || SQL(case_number)}; */ /// 12/15/17 - replace above with SQL for each pre/post // pre op diagnosis for planned procedures (dx_scheme_0,dx_code_0, dx_desc_0, ca_desc ) := read last { " select cpd.codingscheme, cpd.Code, cpd.Description, cp.HealthIssueCodeDescription " ||" from SXASRGCase c " ||" inner join SXASRGCaseProcedure cp on cp.CaseID = c.CaseID " ||" left join SXASRGCaseProcedureDiagnosis cpd on cpd.CaseProcedureID = cp.CaseProcedureID " ||" where (cp.HasBeenPerformed = 0 or (cp.HasBeenPerformed = 1 and cp.AssociatedCaseProcedureID is not null))" ||" and cp.Active = 1 " ||" and cpd.Active = 1 " ||" and c.CaseIdentifier = " || SQL(case_number) }; // post op diagnosis for performed procedures (dx_scheme_1,dx_code_1, dx_desc_1, ca_desc1) := read last { "select cpd.codingscheme, cpd.Code, cpd.Description, cp.HealthIssueCodeDescription " ||" from SXASRGCase c " ||" inner join SXASRGCaseProcedure cp on cp.CaseID = c.CaseID " ||" left join SXASRGCaseProcedureDiagnosis cpd on cpd.CaseProcedureID = cp.CaseProcedureID " ||" where cp.HasBeenPerformed = 1 " ||" and cp.AssociatedCaseProcedureID is null " ||" and cp.Active = 1 " ||" and cpd.Active = 1" ||" and c.CaseIdentifier = " || SQL(case_number) }; dx_code:= //first of dx_code_0; //dx_desc::= ""; //=// first of //dx_desc_0; ct_dxd:= count dx_desc_0; ct_dxd1:= count dx_desc_1; /// PRE process if ct_dxd > 0 then hold_cd:= ""; for i in 1 seqto count dx_desc_0 DO dxcs:= dx_scheme_0[i]; dxc:= dx_code_0[i]; dxd:= dx_desc_0[i]; dx_comb:= dxcs||" "||dxc||" "||dxd; if dxc in hold_cd then stop:=1; elseif /// 01/18/17 - to not value nulls int he string dx_comb matches pattern "null%" then stop :=1; else hold_cd:= hold_cd, dxc; if i=1 then dx_desc:= dx_comb; //dxc||" "||dxd; else dx_desc:= dx_desc||";\n"|| dx_comb; //dxc||" "||dxd; endif; endif; enddo; endif; /// POST process if ct_dxd1 > 0 then hold_cd1:= ""; for i in 1 seqto count dx_desc_1 DO dxcs1:= dx_scheme_1[i]; dxc1:= dx_code_1[i]; dxd1:= dx_desc_1[i]; dx_comb1:= dxcs1||" "||dxc1||" "||dxd1; if dxc1 in hold_cd1 then stop:=1; elseif /// 01/18/17 - to not value nulls int he string dx_comb1 matches pattern "null%" then stop :=2; else hold_cd1:= hold_cd1, dxc1; if i=1 then dx_desc1:= dx_comb1; //dxc||" "||dxd; else dx_desc1:= dx_desc1||";\n"|| dx_comb1; //dxc||" "||dxd; endif; endif; enddo; endif; endif; // exists caseid /// 01/05/17 - now here do loop if current_parameter_name IN specimen_param then get_chart:= specimen_param; get_write:= spec_dx; elseif current_parameter_name IN frozen_param then get_chart:= frozen_param; get_write:= froz_dx; endif; FOR i in 1 seqto count get_chart DO ch_param:= get_chart[i]; wr_param:= get_write[i]; if current_parameter_name = ch_param then /// 02/21/17 - here for Order logic? target_param:= wr_param; //else //target_param:= froz_dx; endif; ENDDO; //break; /// // break; ENDIF; // then if cur_parameter name n... //////////// and of charting specimens///////////////////////// /// add "ELSE" to the orignal "IF" below /// 01/17/17 - update for Reload medications // Chart the case number and case info observation items when opening and closing the document // ELSE if this_eventType = "DocumentOpening" or this_eventType = "DocumentClosing" //then OR (this_eventType = "ChartObservation" AND (current_parameter_name IN med_load) ) then stop_it:= 0; /// 02/07/17 - n0w null out Re-load observation if this_eventType = "ChartObservation" AND (current_parameter_name IN med_load) then this_documentCommunication := call called_dom_mlm with (this_documentCommunication, current_parameter_name, null, sugg_txt_value, update_type); endif; /// 04/13/17 Add call to Meds MLM for load /// - here for call Med MLM to load any meds get_med_sed:= MLM {{{SINGLE-QUOTE}}}DOC_SCH_SMP_MEDS_SURGICAL_CASE{{{SINGLE-QUOTE}}} ; retn_val := call get_med_sed with this_documentCommunication ; /////////////////////////////////////////////////////////////////////// //ENDIF; /// chart observation or DOc Open and chart observation /////////////////////////////////////////////////// /// 01/16/17 - re-arrange for opening again - after work above with re-load //IF this_eventType = "DocumentOpening" or this_eventType = "DocumentClosing" then case_number_parameter:= first of (this_parameters WHERE this_parameters.Name = case_number_parameter_name); case_info_parameter:= first of (this_parameters WHERE this_parameters.Name = case_info_parameter_name); // Ensure that the case number and case info observation items are on the structured note if exists case_number_parameter and exists case_info_parameter then // Get the case id of the case in context case_id := this_documentCommunication.CaseId ; if exists case_id then ////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get the case ////////////////////////////////////////////////////////////////////////////////////////////////////////// (case_number, anesthesia_type, case_status, asa_physical_status):= read last{"SELECT top 1 c.CaseIdentifier, at.Code, cs.Code, PhysicalStatus FROM SXASRGCase c LEFT JOIN SXASRGAnesthesiaType at ON c.AnesthesiaTypeID = at.AnesthesiaTypeID INNER JOIN SXASRGCaseStatus cs ON c.CaseStatusID = cs.CaseStatusID WHERE c.CaseID = " || SQL(case_id)}; // Add the case number observation item value new_case_number_value := "Case Number: " || case_number; // Create the title and grid to contain the case info observation item value for the case status and anesthesia type new_case_info_value := "\n" || HEADER1_ON || "Surgical Case Information:" || HEADER1_OFF || "\n" || BODY_TAG; new_case_info_value := new_case_info_value || GRID_START || ROW_START; new_case_info_value := new_case_info_value || CELL_BORDER || CELL_START || 2500 || BOLD_ON || "Case Status" || BOLD_OFF || CELL_END; new_case_info_value := new_case_info_value || CELL_BORDER || CELL_START || 4500 || case_status|| CELL_END; new_case_info_value := new_case_info_value || ROW_END; new_case_info_value := new_case_info_value || CELL_BORDER || CELL_START || 2500 || BOLD_ON || "Anesthesia Type" || BOLD_OFF || CELL_END; if anesthesia_type is null then anesthesia_type := ""; endif; new_case_info_value := new_case_info_value || CELL_BORDER || CELL_START || 4500 || anesthesia_type || CELL_END; new_case_info_value := new_case_info_value || ROW_END; /// 12/08/17 - for Rita J. to fetch /display for Procedure Dxs /* If exists dx_desc and not(dx_desc matches pattern "null%" ) then new_case_info_value := new_case_info_value || ROW_END; new_case_info_value := new_case_info_value || CELL_BORDER || CELL_START || 2000 || BOLD_ON || "Pre-OP Diagnoses" || BOLD_OFF || CELL_END; new_case_info_value := new_case_info_value || CELL_BORDER || CELL_START || 4000 || dx_desc || CELL_END; endif; /// 12/15/17 - now for Post Op If exists dx_desc1 and not(dx_desc1 matches pattern "null%" ) then new_case_info_value := new_case_info_value || ROW_END; new_case_info_value := new_case_info_value || CELL_BORDER || CELL_START || 2000 || BOLD_ON || "Post-OP Diagnoses" || BOLD_OFF || CELL_END; new_case_info_value := new_case_info_value || CELL_BORDER || CELL_START || 4000 || dx_desc1 || CELL_END; endif; */ //////////////////////////////////////////////////////////////////// //new_case_info_value := new_case_info_value || ROW_END || GRID_END; if(asa_physical_status is null OR asa_physical_status = "") then asa_physical_status := ""; endif; //new_case_info_value := new_case_info_value || GRID_START || ROW_START; new_case_info_value := new_case_info_value || CELL_BORDER || CELL_START || 2500 || BOLD_ON || "Physical Status(ASA)" || BOLD_OFF || CELL_END; new_case_info_value := new_case_info_value || CELL_BORDER || CELL_START || 4500 || asa_physical_status || CELL_END; new_case_info_value := new_case_info_value || ROW_END; new_case_info_value := new_case_info_value || GRID_END; ////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get the case planned procedures ////////////////////////////////////////////////////////////////////////////////////////////////////////// planned_procedures := GRID_START || BOLD_ON || "Planned Procedures: " || "\n" || BOLD_OFF; (procedure_name_list, surgery_staff_name_list, preference_card_name_list, procedure_description_list, is_primary_procedure_list ):= read {"SELECT p.Name as ProcedureName, u.DisplayName as SurgeryStaffFullName, pc.Name as PreferenceCardName, cp.Description, cp.IsPrimary FROM SXASRGCaseProcedure cp LEFT JOIN SXASRGCasePreferenceCard cpc ON (cp.CaseProcedureId = cpc.CaseProcedureId AND cp.CaseId = cpc.CaseId AND ( cpc.Active IS NULL OR cpc.Active = 1 )) LEFT JOIN SXASRGPreferenceCard pc ON cpc.PreferenceCardId = pc.PreferenceCardId INNER JOIN SXASRGSurgeryStaff staff ON (cp.SurgeryStaffID = staff.SurgeryStaffID) INNER JOIN CV3User u ON staff.UserGUID = u.GUID INNER JOIN SXASRGProcedure p ON (cp.ProcedureID = p.ProcedureID) WHERE cp.CaseID = " || SQL(case_id) || "AND cp.Active = 1 AND ((cp.HasBeenPerformed = 0) OR (cp.HasBeenPerformed = 1 AND cp.AssociatedCaseProcedureID > 0)) ORDER BY cp.SequenceNumber " }; ii := 0; /// 12/15/17 column_count := 6; column_index := 1; column_header_list := ("Name", "Provider", "Preference Card", "Description", "Primary", "Pre-Op Dx" ); // add grid header planned_procedures := planned_procedures || ROW_START; while (column_index <= column_count) do column_width:= column_index * 2000; /// 01/03/18 - to adjust for width of paper on preview if column_index = 5 then column_width:= 9100 ; elseif column_index = 6 then column_width:= 10600 ; endif; ////////////////////////////////////////////////////// planned_procedures := planned_procedures || CELL_BORDER || CELL_START || column_width || BOLD_ON || column_header_list[column_index] || BOLD_OFF || CELL_END; column_index := column_index + 1; enddo; planned_procedures := planned_procedures || ROW_END; // add grid content for procedure_name in procedure_name_list do ii := ii + 1; surgery_staff_name := last(first ii from surgery_staff_name_list); preference_card_name := last(first ii from preference_card_name_list); procedure_description := last(first ii from procedure_description_list); is_primary_procedure := last(first ii from is_primary_procedure_list); /// 12/15/17 If exists dx_desc and not(dx_desc matches pattern "null%" ) then is_pre_dx:= dx_desc; else is_pre_dx:= ""; endif; ///////////////////// if preference_card_name is null then preference_card_name := ""; endif; if procedure_description is null then procedure_description := ""; endif; column_index := 1; /// 12/15/17 column_content_list := (procedure_name, surgery_staff_name, preference_card_name, procedure_description, is_primary_procedure, is_pre_dx); planned_procedures := planned_procedures || ROW_START; // fill each cell while (column_index <= column_count) do column_width:= column_index * 2000; /// 01/03/18 - to adjust for width of paper on preview if column_index = 5 then column_width:= 9100 ; elseif column_index = 6 then column_width:= 10600 ; endif; ////////////////////////////////////////////////////// planned_procedures := planned_procedures || CELL_BORDER || CELL_START || column_width || column_content_list[column_index] || CELL_END; column_index := column_index + 1; enddo; planned_procedures := planned_procedures || ROW_END; enddo; new_case_info_value := new_case_info_value || planned_procedures || GRID_END || "\n"; ////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get the case performed procedures ////////////////////////////////////////////////////////////////////////////////////////////////////////// performed_procedures := GRID_START || BOLD_ON || "Performed Procedures: \n" || BOLD_OFF; (procedure_name_list, surgery_staff_name_list, preference_card_name_list, procedure_description_list, is_primary_procedure_list ):= read {"SELECT p.Name as ProcedureName, u.DisplayName as SurgeryStaffFullName, pc.Name as PreferenceCardName, cp.Description, cp.IsPrimary FROM SXASRGCaseProcedure cp LEFT JOIN SXASRGCasePreferenceCard cpc ON (cp.CaseProcedureId = cpc.CaseProcedureId AND cp.CaseId = cpc.CaseId AND ( cpc.Active IS NULL OR cpc.Active = 1 )) LEFT JOIN SXASRGPreferenceCard pc ON cpc.PreferenceCardId = pc.PreferenceCardId INNER JOIN SXASRGSurgeryStaff staff ON (cp.SurgeryStaffID = staff.SurgeryStaffID) INNER JOIN CV3User u ON staff.UserGUID = u.GUID INNER JOIN SXASRGProcedure p ON (cp.ProcedureID = p.ProcedureID) WHERE cp.CaseID = " || SQL(case_id) || "AND cp.Active = 1 AND cp.HasBeenPerformed = 1 AND (cp.AssociatedCaseProcedureID = 0 OR cp.AssociatedCaseProcedureID IS NULL) ORDER BY cp.SequenceNumber " }; ii := 0; /// 12/15/17 column_count := 6; column_index := 1; column_header_list := ("Name", "Provider", "Preference Card", "Description", "Primary", "Post-Op Dx" ); // add grid header performed_procedures := performed_procedures || ROW_START; while (column_index <= column_count) do column_width:= column_index * 2000; /// 01/03/18 - to adjust for width of paper on preview if column_index = 5 then column_width:= 9100 ; elseif column_index = 6 then column_width:= 10600 ; endif; ////////////////////////////////////////////////////// performed_procedures := performed_procedures || CELL_BORDER || CELL_START || column_width || BOLD_ON || column_header_list[column_index] || BOLD_OFF || CELL_END; column_index := column_index + 1; enddo; performed_procedures := performed_procedures || ROW_END; // add grid content for procedure_name in procedure_name_list do ii := ii + 1; surgery_staff_name := last(first ii from surgery_staff_name_list); preference_card_name := last(first ii from preference_card_name_list); procedure_description := last(first ii from procedure_description_list); is_primary_procedure := last(first ii from is_primary_procedure_list); /// 12/15/17 If exists dx_desc1 and not(dx_desc1 matches pattern "null%" ) then is_pre_dx1:= dx_desc1; else is_pre_dx1:= ""; endif; ///////////////////// if preference_card_name is null then preference_card_name := ""; endif; if procedure_description is null then procedure_description := ""; endif; column_index := 1; /// 12/15/17 column_content_list := (procedure_name, surgery_staff_name, preference_card_name, procedure_description, is_primary_procedure, is_pre_dx1); performed_procedures := performed_procedures || ROW_START; // fill each cell while (column_index <= column_count) do column_width:= column_index * 2000; /// 01/03/18 - to adjust for width of paper on preview if column_index = 5 then column_width:= 9100 ; elseif column_index = 6 then column_width:= 10600 ; endif; ////////////////////////////////////////////////////// performed_procedures := performed_procedures || CELL_BORDER || CELL_START || column_width || column_content_list[column_index] || CELL_END; column_index := column_index + 1; enddo; performed_procedures := performed_procedures || ROW_END; enddo; new_case_info_value := new_case_info_value || performed_procedures || GRID_END || "\n"; ////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get the case participants ////////////////////////////////////////////////////////////////////////////////////////////////////////// participants := GRID_START || BOLD_ON || "Participants: \n" || BOLD_OFF; (participant_id_list, external_participant_name_list, role_list, comments_list, surgery_staff_name_list ):= read { "SELECT cp.CaseParticipantID, cp.ExternalParticipantName, role.Code, cp.Comments, u.DisplayName AS SurgeryStaffFullName FROM SXASRGCaseParticipant cp LEFT JOIN SXASRGSurgeryRole role ON cp.SurgeryRoleID = role.SurgeryRoleID LEFT JOIN SXASRGSurgeryStaff staff ON (cp.SurgeryStaffID = staff.SurgeryStaffID) LEFT JOIN CV3User u ON staff.UserGUID = u.GUID WHERE cp.CaseID = " || SQL(case_id) || "AND cp.Active = 1 ORDER BY cp.SortSequenceNum " }; (participant_time_id_list, participant_time_participant_id_list, time_in_list, time_out_list ):= read { "SELECT cpt.CaseParticipantTimeID, cpt.CaseParticipantID, CONVERT(varchar, CONVERT(datetime, cpt.InDateTimeUTC)), CONVERT(varchar, CONVERT(datetime, cpt.OutDateTimeUTC)) FROM SXASRGCaseParticipantTime cpt INNER JOIN SXASRGCaseParticipant cp ON (cpt.CaseParticipantID = cp.CaseParticipantID) WHERE cp.CaseID = " || SQL(case_id) || "AND cp.Active = 1 AND cpt.Active = 1 ORDER BY cpt.CaseParticipantID, cpt.InDateTimeUTC " }; tstcaseid := case_id; ii := 0; column_count := 5; column_index := 1; column_header_list := ("Role", "Name", "Comments", "Time In", "Time Out"); // add grid header participants := participants || ROW_START; while (column_index <= column_count) do column_width:= column_index * 2000; participants := participants || CELL_BORDER || CELL_START || column_width || BOLD_ON || column_header_list[column_index] || BOLD_OFF || CELL_END; column_index := column_index + 1; enddo; participants := participants || ROW_END; for participant_id in participant_id_list do ii := ii + 1; external_participant_name := last(first ii from external_participant_name_list); role := last(first ii from role_list); comments := last(first ii from comments_list); surgery_staff_name := last(first ii from surgery_staff_name_list); /// 08/1/16 - use external_participant_name if no Staff CV3User configuration if not exists surgery_staff_name AND (exists external_participant_name) then //and external_participant_name <> "") then surgery_staff_name := trim (string external_participant_name) ; /// 01/23/18 - update to put Level infront of the number if role = "Level" then surgery_staff_name := string ("Level "||surgery_staff_name); endif; /// 04/19/18 - update to put ASA infront of the number for the ASA into the Grid if role = "ASA" then surgery_staff_name := trim (string ("ASA: "||surgery_staff_name)) ; endif; endif; //////////////////////////////////////// if external_participant_name is null then external_participant_name := ""; endif; if role is null then role := ""; endif; if comments is null then comments := ""; endif; if surgery_staff_name is null then surgery_staff_name := ""; endif; if not exists surgery_staff_name then surgery_staff_name := trim (string external_participant_name) ; endif; column_index := 1; column_content_list := (role, surgery_staff_name, comments ); participants := participants || ROW_START; // fill each cell column_count := 3; while (column_index <= column_count) do column_width:= column_index * 2000; participants := participants || CELL_BORDER || CELL_START || column_width || column_content_list[column_index] || CELL_END; column_index := column_index + 1; enddo; // add time for participant, same participant could have multiple times jj := 0; is_same_participant := false; for participant_time_id in participant_time_id_list do jj := jj + 1; participant_time_participant_id := last(first jj from participant_time_participant_id_list); if(participant_time_participant_id = participant_id) then time_in := last(first jj from time_in_list); time_out := last(first jj from time_out_list); if time_in is null then time_in := "."; endif; if time_out is null then time_out := "."; endif; column_content_time_list := (" " || time_in, " " || time_out); // add new row with empty cells for role, staff and comments if the time is for the same participant if is_same_participant = true then column_count := 3; column_index := 1; participants := participants || ROW_END || ROW_START; while (column_index <= column_count) do column_width:= column_index * 2000; participants := participants || CELL_BORDER || CELL_START || column_width || " " || CELL_END; column_index := column_index + 1; enddo; endif; // fill the time in and time out cells column_count := 5; while (column_index <= column_count) do column_width:= column_index * 2000; participants := participants || CELL_BORDER || CELL_START || column_width || column_content_time_list[column_index - 3] || CELL_END; column_index := column_index + 1; enddo; is_same_participant := true; else is_same_participant := false; endif; enddo; participants := participants || ROW_END; enddo; new_case_info_value := new_case_info_value || participants || GRID_END || "\n"; ////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get the case event times ////////////////////////////////////////////////////////////////////////////////////////////////////////// case_events := GRID_START || BOLD_ON || "Times: \n" || BOLD_OFF; (event_id_list, event_date_time_list, event_time_label_list ):= read { "SELECT e.CaseEventID, CONVERT(varchar, CONVERT(datetime, et.EventDateTimeUTC)), et.EventTimeLabel FROM SXASRGCaseEvent e INNER JOIN SXASRGCaseEventTime et ON e.CaseEventID = et.CaseEventID WHERE e.CaseID = " || SQL(case_id) || "AND e.Active = 1 ORDER BY et.SortSequenceNum " }; ii := 0; column_count := 2; column_index := 1; column_header_list := ("Type", "Time"); // add grid header case_events := case_events || ROW_START; while (column_index <= column_count) do column_width:= column_index * 3500; case_events := case_events || CELL_BORDER || CELL_START || column_width || BOLD_ON || column_header_list[column_index] || BOLD_OFF || CELL_END; column_index := column_index + 1; enddo; case_events := case_events || ROW_END; // add grid content for event_id in event_id_list do ii := ii + 1; event_date_time := last(first ii from event_date_time_list); event_time_label := last(first ii from event_time_label_list); if event_date_time is null then event_date_time := ""; endif; column_index := 1; column_content_list := (event_time_label, " " || event_date_time); case_events := case_events || ROW_START; // fill each cell while (column_index <= column_count) do column_width:= column_index * 3500; case_events := case_events || CELL_BORDER || CELL_START || column_width || column_content_list[column_index] || CELL_END; column_index := column_index + 1; enddo; case_events := case_events || ROW_END; enddo; new_case_info_value := new_case_info_value || case_events || GRID_END || "\n"; /// 07/13/16 - for insertion of Implant Tissue section into the new_case_info_value //////////////////////// standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; IT_Header:= ""; rtn_str:= ""; hold_it:= ""; /// 02/23/18 - update to pull only Active case Items ci.Active = 1 (it_ItemID, it_Item, it_catno, it_desc, it_supNotes, it_itemname, it_Dispodtm, it_Manu, it_Charge, it_serial, it_lot, it_site, it_siteg, it_quant, it_ExpMM, it_expDD, it_expYYYY, it_DispoID, it_DtlID, ti_DtlID, it_Intact, it_Stored, it_Follow, it_PrepStart , it_PrepStop, it_user, it_tnotes ):= read // it_xml, {" select sdi.ItemID, sdi.ItemName,csi.CatalogNumber, csi.ItemMasterDescription, csi.Notes, csi.ItemName, " || " CONVERT(varchar, CONVERT(datetime, csi.DispositionDateUTC)), inv.SourceName, cc.Code, " ||" csid.SerialNumber, csid.LotNumber, csid.SiteName, csid.SiteGUID, csid.Quantity, csid.ExpirationMonth, csid.ExpirationDay, csid.ExpirationYear, " ||" csid.DispositionID, csid.CaseItemSupplementalInfoDtlID, csit.CaseItemSupplementalInfoDtlID, " ||" csit.IsIntact, csit.CorrectTemperatureStoredType, csit.ManufacturerInstructFollowType, " ||" CONVERT(varchar, CONVERT(datetime, csit.PreparationStartedDateTimeUTC)), CONVERT(varchar, CONVERT(datetime, csit.PreparationEndedDateTimeUTC)), " || " u.DisplayName, csit.Notes " // csit.DetailXML, ||" from sxasrgcase c " ||" left join SXASRGCaseItem ci on ci.CaseID = c.CaseID " ||" inner join sxasrgdepartmentsurgicalitem sdi on sdi.ItemID = ci.ItemID " ||" left join SXASRGCaseItemSupplementalInfo csi on csi.CaseItemID = ci.CaseItemID " ||" left outer join SXASRGCaseItemSupplementalInfoDtl csid on csid.CaseItemSupplementalInfoID = csi.CaseItemSupplementalInfoID " ||" left join SXASRGInvSource inv on inv.SourceID = csi.SourceID " ||" left join SXASRGChargeCode cc on cc.ChargeCodeID = csi.ChargeCodeID " ||" left outer join SXASRGCaseItemTissue csit on (csit.CaseItemSupplementalInfoDtlID = csid.CaseItemSupplementalInfoDtlID and csit.Active = 1 ) " ||" left outer join SXASRGCaseItemTissueSurgeryStaffXRef itst on itst.CaseItemTissueID = csit.CaseItemTissueID " ||" left outer join SXASRGSurgeryStaff sss on sss.SurgeryStaffID = itst.SurgeryStaffID " ||" left outer join cv3user u on u.guid = sss.userguid " ||" where c.CaseID = " || SQL(case_id) || " and ci.Active = 1 " } ;// // ||" and c.ClientVisitGUID = {{{SINGLE-QUOTE}}}1052700270{{{SINGLE-QUOTE}}} " // ||" where c.CaseID = 356 " ct_item_check:= count it_item where it_dispoID is not null ; //<> "null" ; //it_user; ct_item:= count it_item ; if ct_item > 0 then //exists it_user then IT_Header := " Implant-Tissue: " ; IT_Head:= HEADER2_ON||IT_Header||HEADER2_OFF||"\n"||Body_tag; //:="\b0 \fs0"; //rtn_str:= IT_Head; not_in:= "<","/",">" ; FOR i in 1 seqto ct_item DO /// format certain data /* if it_dispoID[i] = 1 then it_dispoID[i] := "Explanted"; endif; if it_dispoID[i] = 2 then it_dispoID[i] := "Implanted"; endif; if it_dispoID[i] = 3 then it_dispoID[i] := "Implanted and Removed"; endif; if it_dispoID[i] = 6 then it_dispoID[i] := "Wasted"; endif; if it_intact[i] then it_intact[i] := "Intact"; elseif not( it_intact[i]) then it_intact[i] := "Not Intact"; endif; if it_stored[i] = 1 then it_stored[i] := "Yes"; elseif it_stored[i] = 2 then it_stored[i] := "No"; else it_stored[i] := "N/A"; endif; if it_follow[i] = 1 then it_follow[i] := "Yes"; elseif it_follow[i] = 2 then it_follow[i] := "No"; else it_follow[i] := "N/A"; endif; */ /// 12/02/16 - change the display of notes_comments /* if exists it_tnotes[i] then note_comment := it_tnotes[i]; else note_comment := ""; endif; */ //:= tab||"\b1 Notes/Comments: \b0 "||it_tnotes[i]||"\n" ; else note_comment:= "\n"; endif; crtab:= "\n"||tab||tab||" "; /// 02/02/18 - addition for displaying the edited Name from the Supplemental FORm IF it_item[i] matches pattern "Generic%" then if exists it_itemname[i] then it_item[i] := it_itemname[i] ; endif; ENDIF; /////////////////////////////////////////////////////////////////// if exists it_xml[i] then it_xml[i] := string (it_xml[i]); it_xml0:= call (it_xml[i] as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with "", "" as string; it_xml1:= call (it_xml0 as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with "", " = " as string; it_xml3:= call (it_xml2 as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with "", crtab as string; //"\n" it_xml4:= call (it_xml3 as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with "", "\n" as string; endif; if it_dispoId[i] is not null then // <> "null" then // it_dispoId if not (it_itemID[i] in hold_it) then /// 03/07/17 - for it_serial, it_lot, it_site, it_quant, it_ExpMM, it_expDD, it_expYYYY, it_DispoID, get_ser_0:= it_serial where it_itemID = it_itemID[i]; get_lot_0:= it_lot where it_itemID = it_itemID[i]; get_site_0:= it_site where it_itemID = it_itemID[i]; get_siteg_0:= it_siteg where it_itemID = it_itemID[i]; get_quant_0:= it_quant where it_itemID = it_itemID[i]; get_dispo_0:= it_DispoID where it_itemID = it_itemID[i]; get_expMM_0:= it_ExpMM where it_itemID = it_itemID[i]; get_expDD_0:= it_ExpDD where it_itemID = it_itemID[i]; get_expYYYY_0:= it_ExpYYYY where it_itemID = it_itemID[i]; get_it_dtl:= it_DtlID where it_itemID = it_itemID[i]; get_ti_dtl:= ti_DtlID where it_itemID = it_itemID[i]; /// supp details get_user0:= it_user where it_itemID = it_itemID[i]; get_PrepStart0:= it_PrepStart where it_itemID = it_itemID[i]; get_PrepStop0:= it_PrepStop where it_itemID = it_itemID[i]; get_Intact0:= it_Intact where it_itemID = it_itemID[i]; get_stored0:= it_stored where it_itemID = it_itemID[i]; get_follow0:= it_follow where it_itemID = it_itemID[i]; get_notes0:= it_tnotes where it_itemID = it_itemID[i]; //// 03/08/17 for tissue details ////////////////////////// /// 04/23/18 - for duplicates hld_det:= ""; hld_dtl:= ""; //""; for m in 1 seqto count get_lot_0 DO //////////////////////////////////////////// /// 01/22/18 - updated for SCH config /// 04/23/18 - change back to Explanted second - Implanted first and others in order for Dispo of Implant // update to read from SXASRGDispistion if exists get_dispo_0[m] then s_dispo:= get_dispo_0[m]; get_dispo_m:= read last { " select Code from SXASRGDisposition where Active = 1 and DispositionID = " || sql (s_dispo) }; /* if get_dispo_0[m] = 1 then get_dispo_0[m] := "Implanted"; endif; // "Explanted"; endif; if get_dispo_0[m] = 9 then get_dispo_0[m] := "Explanted"; endif; // "Implanted"; endif; if get_dispo_0[m] = 6 then get_dispo_0[m] := "Implanted and Removed"; endif; if get_dispo_0[m] = 8 then get_dispo_0[m] := "Wasted"; endif; */ else get_dispo_m := ""; endif; ///////////////////////////////////////// /// 03/13/17 - for site from Dictionary if not free text IF get_site_0[m] is null and exists get_siteg_0[m] then get_dict_g:= get_siteg_0[m] ; get_val:= read last { " select value from CV3UserDictionaryValue uv " ||" where uv.guid = " || sql (get_dict_g) }; if exists get_val then get_site_0d := get_val; endif; else get_site_0d:= get_site_0[m]; ENDIF; ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// /// 04/23/18- fix dupl details if get_ser_0[m] not in hold_det /// 09/06/17 - to pick up "null " serial numbers OR (get_ser_0[m] is null OR get_ser_0[m] = "null") then if hld_dtl = "" then hld_dtl:= "\b1 Serial #: \b0 "||get_ser_0[m]||" "||"\b1 Lot #: \b0 "||get_lot_0[m]||" "||"\b1 Qty: \b0 "||get_quant_0[m] // ||" "||"\b1 Site: \b0 "||get_site_0d ||" "||"\b1 Dispo: \b0 "||get_dispo_0[m]||" "|| ||" "||"\b1 Site: \b0 "||get_site_0d ||"\n"||tab||"\b1 Disposition: \b0 "||get_dispo_m||" "|| "\b1 Expiry Dt: \b0 "||get_expMM_0[m]||"/"||get_expDD_0[m]||"/"||get_expyyyy_0[m]||"\n"; //||tab ; else hld_dtl:= hld_dtl||"\b1 Serial #: \b0 "||get_ser_0[m]||" "||"\b1 Lot #: \b0 "||get_lot_0[m]||" "||"\b1 Qty: \b0 "||get_quant_0[m] // ||" "||"\b1 Site: \b0 "||get_site_0d ||" "||"\b1 Dispo: \b0 "||get_dispo_0[m]||" "|| ||" "||"\b1 Site: \b0 "||get_site_0d ||"\n"||tab||"\b1 Disposition: \b0 "||get_dispo_m||" "|| "\b1 Expiry Dt: \b0 "||get_expMM_0[m]||"/"||get_expDD_0[m]||"/"||get_expyyyy_0[m]||"\n"; //||tab ; endif; hold_det:= hold_det, get_ser_0[m] ; ENDIF; /* original SCH pre 04/23/18 hld_dtl:= hld_dtl||"\b1 Serial #: \b0 "||get_ser_0[m]||" "||"\b1 Lot #: \b0 "||get_lot_0[m]||" "||"\b1 Qty: \b0 "||get_quant_0[m] // ||" "||"\b1 Site: \b0 "||get_site_0d ||" "||"\b1 Dispo: \b0 "||get_dispo_0[m]||" "|| ||" "||"\b1 Site: \b0 "||get_site_0d ||"\n"||tab||"\b1 Disposition: \b0 "|| get_dispo_0[m]||" "|| "\b1 Expiry Dt: \b0 "||get_expMM_0[m]||"/"||get_expDD_0[m]||"/"||get_expyyyy_0[m]||"\n"; //||tab ; */ ////////////////////////////////// /// for tissue details for each supp details get_user:= null; get_PrepStart:= null; get_PrepStop:= null; get_Intact:= null; get_stored:= null; get_follow:= null; get_notes:= null; get_sup_d:= null; if get_ti_dtl[m] = get_it_dtl[m] then get_Intact:=get_Intact0[m]; // first of (get_Intact0 where get_ti_dtl[m] = get_it_dtl[m] ); // it_itemID = it_itemID[i] AND if get_Intact then get_Intact := "Intact"; elseif not( get_Intact ) then get_Intact := "Not Intact"; endif; get_Stored:= get_Stored0[m]; //first of (get_Stored0 where get_ti_dtl[m] = get_it_dtl[m] ); if get_Stored = 1 then get_Stored := "Yes"; elseif get_Stored = 2 then get_Stored := "No"; else get_Stored := "N/A"; endif; get_follow:= get_follow0[m];//first of (get_follow0 where get_ti_dtl[m] = get_it_dtl[m] ); if get_follow = 1 then get_follow := "Yes"; elseif get_follow = 2 then get_follow := "No"; else get_follow := "N/A"; endif; get_PrepStart := get_PrepStart0[m]; //first of (get_PrepStart0 where get_ti_dtl[m] = get_it_dtl [m] ); get_PrepStop := get_PrepStop0[m];//first of (get_PrepStop0 where get_ti_dtl[m] = get_it_dtl[m] ); // it_user get_user := get_user0[m]; //first of (get_user0 where get_ti_dtl[m] = get_it_dtl[m] ); get_notes := get_notes0[m];// first of (get_notes0 where get_ti_dtl[m] = get_it_dtl[m] ); if exists get_user or exists get_PrepStart or exists get_Intact // or get_stored or exists get_follow then /// tab||" get_sup_d:= tab||" \b1 State of package: \b0 "||get_Intact ||"\n"||tab||"\b1 Stored at Temp: \b0 "||get_Stored ||"\n" ||tab||"\b1 Manufacturer Instructions followed: \b0 "||get_follow ||"\n" //||tab||"\b1 Tissue Reconstitution/Note: \b0 "||"\n"||tab||tab||" "||it_xml4[i]||"\n"||note_comment //||"\n" ||tab||"\b1 Tissue Reconstitution/Note: \b0 "||"\n"||tab||tab||" "||get_notes ||"\n" ||tab||"\b1 Prepared By: \b0 "||get_user ||"\n" ||tab||"\b1 Prep Start: \b0 "||get_PrepStart ||" "||"\b1 Prep Stop: \b0 "||get_PrepStop ||"\n\n"; else get_sup_d := "\n"; //||tab||"\n"; endif; else get_sup_d := "\n"; //||tab||"\n"; endif; /////////////////////////////// if exists get_sup_d then hld_dtl:= hld_dtl||get_sup_d; endif; enddo; /////////////////////////////////////////////////////////////////////// //get_item:= "\b1 Item: \b0 "||it_item[i]||tab||"\b1 Catalog #: \b0 "||it_catno[i]||" "||"\b1 Charge Code: \b0 "||it_charge[i]||"\n\n"; get_item:= "\b1 Item: \b0 "||it_item[i]||tab||"\b1 Cat #: \b0 "||it_catno[i]||" "||"\b1 Chrg Code: \b0 "||it_charge[i]||"\n\n"; get_sup:= tab||"\b1 Item ID: \b0 "||it_itemID[i]||tab||tab||"\b1 Description: \b0 "||it_desc [i]||"\n" ||tab||"\b1 Notes: \b0 "||it_supNotes[i]||"\n" ||tab||"\b1 Manufacturer: \b0 "||it_manu[i]||"\n" ||tab||"\b1 Disposition Dt: \b0 "||it_dispodtm[i]||"\n\n"//tab||tab||"\b1 Expiration: \b0 "||it_expMM[i]||"/"||it_expDD[i]||"/"||it_expyyyy[i]||"\n" || hld_dtl||"\n\n" ; /// 03/07/17 - Update for building multi details on Supplemental Item details hold_it:= hold_it, it_itemID[i]; rtn_str:= rtn_str||get_item||get_sup ; //||get_sup_d ; endif;/// not item in hold_it endif; // if It_dispoID ENDDO; if rtn_str <> "" then rtn_str:= IT_Head||rtn_str; endif; /// for testing user_guid:= this_documentCommunication.UserGuid; userid:= read last {" select IDCode from cv3user where guid = "|| sql (user_guid) }; if userid matches pattern "service%" then ray:=1; //break; endif; //////////////// new_case_info_value := new_case_info_value || rtn_str; //IT_Head; Endif; /// exists it user /// /// 03/17/17 - for insertion of Chargeable Item section into the new_case_info_value //////////////////////// /// 07/12/17 - Place for Items - removed out per meeting //////////////////////////////// end of items ////////////////////////////////////////////////////// /// for testing user_guid:= this_documentCommunication.UserGuid; userid:= read last {" select IDCode from cv3user where guid = "|| sql (user_guid) }; if userid matches pattern "service%" then ray:=1; endif; //////////////// ////////////////////////////////////////////////////////////////////////////////////// // Set the Document Topic with the Case Number so that the Case Number appears beside the Document Name on the structured note this_structuredNoteDoc.DocumentTopic := case_number; // Chart the free text observation items for case number and case info on the structured note this_documentCommunication := call called_dom_mlm with (this_documentCommunication, case_number_parameter_name, new_case_number_value, sugg_txt_value, update_type); this_documentCommunication := call called_dom_mlm with (this_documentCommunication, case_info_parameter_name, new_case_info_value, sugg_txt_value, update_type); endif; //exists case_id then endif; // exists target_parameter endif; // this_eventType = "DocumentOpening" /// for testing user_guid:= this_documentCommunication.UserGuid; userid:= read last {" select IDCode from cv3user where guid = "|| sql (user_guid) }; if userid matches pattern "rlatimer%" then ray:=1; break; endif; //////////////// Debug := is_display_message; // Set Debug := TRUE to see Message in document document_communication_message := "Parameter Name " || case_number_parameter_name || " Event " || this_eventType || " Case Number " || case_number; this_documentCommunication.DisplayMessage := is_display_message; this_documentCommunication.Message := document_communication_message ; /* if(this_eventType = "DocumentClosing" and this_DocumentName = "Endo Intraoperative Nursing") then DOC_CALL_SPECIMEN_PATHOLOGY := MLM {{{SINGLE-QUOTE}}}DOC_CALL_SPECIMEN_PATHOLOGY{{{SINGLE-QUOTE}}}; (this_documentCommunication) := CALL DOC_CALL_SPECIMEN_PATHOLOGY with this_documentCommunication; break; endif; break; */ ;; evoke: ;; logic: conclude true; ;; action: return this_documentCommunication; ;; Urgency: 50;; end: