1411 lines
74 KiB
Plaintext
1411 lines
74 KiB
Plaintext
maintenance:
|
|
|
|
title: Influenza Logic;;
|
|
mlmname: DOC_FUNC_INFLUENZA;;
|
|
arden: version 5.0;;
|
|
version: 2.00;;
|
|
institution: St.Clair Hospital;;
|
|
author: Teresa Spicuzza;;
|
|
specialist: ;;
|
|
date: 2010-09-01;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose:
|
|
;;
|
|
explanation:
|
|
Change history
|
|
|
|
******* Remember to change SCH_INFLUENZA_ORDER_CHECK_HEALTH_ISSUES
|
|
|
|
09.01.2010 TS Created from copy of DOC_FUNC_PNEUMOVAX
|
|
10.26.2010 TS Added logic remove date from structured note if it is from a prior flu season;
|
|
Added logic to make new questions for "Is Patient Pregnant" and "Is Patient a Caregiver"
|
|
be included in decision to give vaccine.
|
|
08.25.2011 DW Major rewrite CSR#26486 - qualifying rules had changed & the form was streamlined ("SCM Retieve Ifo" & "Reassess" buttons removed)
|
|
11.10.2011 DW Help Desk issue - archive date fomratted as CCYY, original date formatted as YY caused problem with document charting date routine
|
|
08.14.2012 TS Update protocol dates for new flu season
|
|
11.28.2012 DW CSR# 31009 Influenza and Pneumovax prevent overide
|
|
01.28.2013 DW CSR# 31247 Altered to order vaccine for everyone over 6 months who are not contraindicated
|
|
11.12.2013 DW 6.1 Upgrade - A new "code" column was added to cv3healthissuedeclaration making this field ambiguous in the Chronic Condidtion SQL
|
|
09.16.2014 TMS CSR# 32748 - Àdded new Catalog Name for Influenza and CSR #32700 Update protocol dates for new flu season.
|
|
05.05.2015 GOS CSR 33143 : Change in Doses 6m to 8yr 11Mo Age and 9 yrs and Above
|
|
08.31.2015 DW CSR# 23359 - ICD10
|
|
09.14.2016 DW CSR# 34972 - Update the dates for the new flu season
|
|
09.27.2017 DW CSR# 35845 - Update the dates for the new flu season
|
|
09.05.2018 SZ CSR# 37150 - Update the dates for the new flu season
|
|
08.27.2019 SZ CSR# 37633 - Update the dates for the new flu season and addition of 0.5 mL high dose for 65 years and older
|
|
|
|
******* REMEMBER to CHANGE THE END DATE MONTH BACK TO 03
|
|
|
|
|
|
;;
|
|
keywords:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
|
|
// RS ADD Message box
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
|
|
|
|
// Recieve arguments from the structured note
|
|
(thisDocumentCommunication) := argument;
|
|
|
|
// Extract interesting parts of the object model
|
|
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
|
|
(thisParameters) := thisStructuredNoteDoc.ParametersList;
|
|
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
|
|
|
|
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
|
|
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
|
|
FreeTextValueType := OBJECT [Value];
|
|
DateValueType := OBJECT [Value];
|
|
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
|
|
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
|
|
|
|
// Get the client and visit GUIDs
|
|
clientGuid := thisDocumentCommunication.ClientGUID;
|
|
visitGuid := thisDocumentCommunication.ClientVisitGUID;
|
|
chartGuid := thisDocumentCommunication.ChartGUID;
|
|
userGuid := thisDocumentCommunication.UserGUID;
|
|
|
|
// Also adjust SCH_INFLUENZA_ORDER_CHECK_HEALTH_ISSUES
|
|
|
|
|
|
|
|
flu_season_start :=2019-07-31T00:00:00;
|
|
protocol_start :=2019-07-26T00:00:00; //yyyy-mm-dd allow order on this date
|
|
protocol_end :=2020-03-31T00:00:00; //yyyy-mm-dd allow order for 3-30 for 3-31
|
|
todays_date := now;
|
|
|
|
agerange3_lowerlimit := 3;
|
|
agerange4_lowerlimit := 9;
|
|
agerange5_lowerlimit := 19;
|
|
agerange6_lowerlimit := 50;
|
|
agerange7_lowerlimit := 65; //added as part of CSR 37633 - SZ
|
|
|
|
// For HIS diagnostic box only
|
|
|
|
agerange1note := "under 6m";
|
|
agerange2note := "6m to 3";
|
|
agerange3note := "3 to 9";
|
|
agerange4note := "9 to 18";
|
|
agerange5note := "19 to 50";
|
|
agerange6note := "50 to 65";
|
|
agerange7note := "65 and older"; //added as part of CSR 37633 - SZ
|
|
|
|
pregnant := "unknown";
|
|
|
|
|
|
formattedTextReason := "N-0. Influenza risk was not determined. ";
|
|
ordervaccine := "no";
|
|
|
|
|
|
|
|
// CHART OBSERVATION SECTION
|
|
|
|
|
|
IF thisdocumentCommunication.EventType = "ChartObservation" then
|
|
|
|
|
|
|
|
// Attain user{{{SINGLE-QUOTE}}}s ID (for use in override message)
|
|
|
|
userId := read last {" SELECT IDCode FROM CV3User with (nolock) WHERE GUID = " || Sql(userGuid) || " AND Active = 1 "};
|
|
|
|
|
|
|
|
// CONTRAINDICATION BUTTON CHANGE SECTION
|
|
|
|
|
|
// Using the prior value of the None box, determine if this is the first time a contraindication section box was clicked
|
|
|
|
theParameter := first of (thisParameters where thisParameters.Name = "SCHCK_Influ Details");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
SavedNoneContraValue := theObservation.ValueObj.Value;
|
|
If SavedNoneContraValue is null
|
|
then FirstTime := "true"; else FirstTime := "false";
|
|
endif;
|
|
|
|
|
|
// Proceed if a Contraindication section box was clicked
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_influ vac contra 2");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
|
|
then
|
|
trigger := "A Contraindications Box was selected or deselected";
|
|
|
|
|
|
// If this is first contraindication section box clicked, assess what had been selected (NONE VS a Contraindication)
|
|
|
|
if FirstTime = "true" then
|
|
If true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "none")
|
|
then contraboxchecked := "false"; MLMAction := "Retrieve and Reassess";
|
|
|
|
elseif true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value <> "none")
|
|
then contraboxchecked := "true"; MLMAction := "No Assessment Required";
|
|
endif;
|
|
endif;
|
|
|
|
|
|
// Compare the prior value of the None box to the current value, to determine what was selected (NONE VS a Contraindication)
|
|
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "none")
|
|
then NewNoneContraValue := "true"; else NewNoneContraValue := "false";
|
|
endif;
|
|
|
|
If FirstTime = "false"
|
|
then
|
|
if NewNoneContraValue = SavedNoneContraValue
|
|
then WhatWasClicked := "Other Button Was Clicked";
|
|
else WhatWasClicked := "None Button Was Clicked"; SavedNoneContraValue := NewNoneContraValue;
|
|
endif;
|
|
else // FirstTime = "true"
|
|
SavedNoneContraValue := NewNoneContraValue;
|
|
endif;
|
|
|
|
|
|
// Determine if all boxes in the section are deselected (nonthing is selected)
|
|
|
|
if true not in (theObservation.ValueObj.ListItemsList.IsSelected)
|
|
then contraboxchecked := "unknown"; MLMAction := "No Assessment Required";
|
|
endif;
|
|
|
|
|
|
// If this is not the first click and something is selected, reset the mutually exclusive contraindication boxes (None VS a Contraindiation)
|
|
|
|
If (contraboxchecked = "unknown" or FirstTime = "true")
|
|
then ResetOtherBoxes := "false"; else ResetOtherBoxes := "true";
|
|
endif;
|
|
|
|
If ResetOtherBoxes = "true"
|
|
then
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := theParameter.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= theParameter.ConfigurationObj.ListGUID;
|
|
listItems := ();
|
|
FOR item IN theParameter.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
|
|
if WhatWasClicked = "Other Button Was Clicked" // One of the Containdications was selected
|
|
then
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = selectedItem.Value)
|
|
then selectedItem.IsSelected := true;
|
|
else selectedItem.IsSelected := false;
|
|
endif;
|
|
if selectedItem.Value = "none"
|
|
then selectedItem.IsSelected := false;
|
|
endif;
|
|
NewNoneContraValue := "false";
|
|
endif;
|
|
|
|
if WhatWasClicked = "None Button Was Clicked" // The None box was selected
|
|
then
|
|
if selectedItem.Value = "none"
|
|
then selectedItem.IsSelected := true;
|
|
else selectedItem.IsSelected := false;
|
|
endif;
|
|
endif;
|
|
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
|
|
// After the boxes have been reset, assess what is now selected
|
|
|
|
If WhatWasClicked = "None Button Was Clicked" and
|
|
true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "none")
|
|
then contraboxchecked := "false"; MLMAction := "Retrieve and Reassess";
|
|
|
|
elseif WhatWasClicked = "Other Button Was Clicked" and
|
|
true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value <> "none")
|
|
then contraboxchecked := "true"; MLMAction := "No Assessment Required";
|
|
endif;
|
|
|
|
endif; // End of Reset mutually exclusive Contra section
|
|
|
|
|
|
|
|
// If None is selcted , Unhide the Chronic Illness and Immunocompromised fields and buttons
|
|
|
|
If contraboxchecked = "false" then
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influ Unhide");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
listItems := ();
|
|
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
selectedItem.IsSelected := true;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
endif;
|
|
|
|
|
|
// Populate the "None" Contraindiated Selected Value Box
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influ Details");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "FreeTextValue";
|
|
this_currentObj.ValueObj := New FreeTextValueType;
|
|
this_currentObj.ValueObj.Value := NewNoneContraValue;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
|
|
endif; // End of Contraindication section
|
|
|
|
|
|
|
|
|
|
// OTHER BUTTON CHANGE SECTION
|
|
|
|
|
|
// Place Order button change to NO (affix ovverride message to assesement)
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza vac order");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
|
|
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
|
|
and
|
|
true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
|
|
|
|
then MLMAction := "Reassess Only";
|
|
trigger:= "Order Button NO was selected";
|
|
endif;
|
|
|
|
|
|
// Place Order button change to YES (send message to user and reset to original assessment)
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza vac order");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
|
|
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
|
|
and
|
|
true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
|
|
|
|
then MLMAction := "Reassess Only";
|
|
trigger:= "Order Button YES was selected";
|
|
endif;
|
|
|
|
|
|
// Imnnoucompromized button change
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza Immuno Comp y/n");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
|
|
then trigger := "Immunocompromised Button was changed";
|
|
If SavedNoneContraValue = "true"
|
|
then MLMAction := "Reassess Only"; // No Contraindications were identified
|
|
else MLMAction := "No Assessment Required"; // Patient has contraindications
|
|
endif;
|
|
endif;
|
|
|
|
|
|
// Chronic Condition button change
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza has Chronic Illness y/n");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
|
|
then trigger := "Chronic Illness Button was changed";
|
|
If SavedNoneContraValue = "true"
|
|
then MLMAction := "Reassess Only"; // No Contraindications were identified
|
|
else MLMAction := "No Assessment Required"; // Patient has contraindications
|
|
endif;
|
|
endif;
|
|
|
|
|
|
|
|
// Date has Changed
|
|
|
|
theParameter := first of (thisParameters where thisParameters.Name = "SCHCK_vaccine received date");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
|
|
then trigger := "Date was changed";
|
|
If SavedNoneContraValue = "true"
|
|
then MLMAction := "Reassess Only"; // No Contraindications were identified
|
|
else MLMAction := "No Assessment Required"; // Patient has contraindications
|
|
endif;
|
|
endif;
|
|
|
|
|
|
|
|
// Pregnancy button change
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza is Preg y/n");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
|
|
then trigger := "Prenancy Button was changed";
|
|
If SavedNoneContraValue = "true"
|
|
then MLMAction := "Reassess Only"; // No Contraindications were identified
|
|
else MLMAction := "No Assessment Required"; // Patient has contraindications
|
|
endif;
|
|
endif;
|
|
|
|
|
|
// Doses This Season button change
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza number inject THIS YR");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
|
|
then trigger := "Doses This Season Button was changed";
|
|
If SavedNoneContraValue = "true"
|
|
then MLMAction := "Reassess Only"; // No Contraindications were identified
|
|
else MLMAction := "No Assessment Required"; // Patient has contraindications
|
|
endif;
|
|
endif;
|
|
|
|
|
|
|
|
// Doses Last Season button change
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza number inject PRIOR SEASONS");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
|
|
then trigger := "Doses Prior Seasons Button was changed";
|
|
If SavedNoneContraValue = "true"
|
|
then MLMAction := "Reassess Only"; // No Contraindications were identified
|
|
else MLMAction := "No Assessment Required"; // Patient has contraindications
|
|
endif;
|
|
endif;
|
|
|
|
|
|
|
|
// RETRIEVE AND REASSESS (or REASSESS ONLY) SECTION
|
|
|
|
|
|
if MLMAction = "Retrieve and Reassess" or MLMAction = "Reassess Only" then
|
|
|
|
|
|
|
|
|
|
// RETRIEVE AND REASSESS SECTION
|
|
|
|
|
|
If MLMAction = "Retrieve and Reassess" then
|
|
|
|
|
|
|
|
// Date vaccine was charted in the patient profile
|
|
|
|
|
|
(vaccinecharteddate) := read last
|
|
{
|
|
" select "
|
|
||" case when LEN(o.valuetext) = 8 then "
|
|
||" case when (substring(o.valuetext, 7, 1)) in ({{{SINGLE-QUOTE}}}7{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}8{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}9{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}19{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}20{{{SINGLE-QUOTE}}} end "
|
|
|| " + (substring(o.valuetext, 7, 2)) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
|
|
|| "(substring(o.valuetext, 1, 2)) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + (substring(o.valuetext, 4, 2)) +{{{SINGLE-QUOTE}}} 00:00:00.000{{{SINGLE-QUOTE}}} "
|
|
|| "else "
|
|
|| "(substring(o.valuetext, 7, 4)) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + (substring(o.valuetext, 1, 2)) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + (substring(o.valuetext, 4, 2)) +{{{SINGLE-QUOTE}}} 00:00:00.000{{{SINGLE-QUOTE}}} "
|
|
|| " end "
|
|
|| " from CV3ClientDocument cd with (nolock) "
|
|
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || ClientGuid || " and cdd.active = 1) "
|
|
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|
|
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|
|
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID and ocmi.name = {{{SINGLE-QUOTE}}}SCHCK_vaccine received date{{{SINGLE-QUOTE}}} "
|
|
|| " where cd.clientguid = " || ClientGuid || " and cd.iscanceled = 0 and cd.documentname like {{{SINGLE-QUOTE}}}%patient profile%{{{SINGLE-QUOTE}}} "
|
|
|| " order by (substring(o.valuetext, 7, 2)), (substring(o.valuetext, 1, 2)) , (substring(o.valuetext, 4, 2)) "
|
|
};
|
|
|
|
vaccinechartedwhen := (vaccinecharteddate as time);
|
|
|
|
|
|
// Date vaccine was charted as given in the EMAR
|
|
|
|
(vaccinegivenwhen) := read last
|
|
{
|
|
" select oto.performedfromdtm "
|
|
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
|
|| " and o.ClientGUID = " || ClientGuid || " "
|
|
|| " and o.name in ({{{SINGLE-QUOTE}}}Influenza Virus Trivalent Vaccine Inj{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Influenza Virus Vaccine Pediatric Inj{{{SINGLE-QUOTE}}}, "
|
|
|| " {{{SINGLE-QUOTE}}}Influenza Virus Trivalent Vaccine Pediatric Inj{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Influenza Virus Vaccine Inj{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Influenza Virus Vaccine High Dose Inj{{{SINGLE-QUOTE}}} ) "
|
|
|| " join cv3ordertask as ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid "
|
|
|| " join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid "
|
|
|| " and oto.ordertaskguid = ot.guid and oto.taskstatuscode ={{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
|
|
};
|
|
|
|
|
|
// Date vaccine was last charted as an active health issue
|
|
|
|
|
|
(vaccinehealthissuedate) := read last
|
|
{
|
|
" select "
|
|
|| " case when onsetyearnum = 0 "
|
|
|| " then createdwhen "
|
|
|| " else "
|
|
|| " case when (onsetmonthnum >0 and onsetmonthnum <10) then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} + cast (onsetmonthnum as varchar) "
|
|
|| " when onsetmonthnum = 0 then {{{SINGLE-QUOTE}}}01{{{SINGLE-QUOTE}}} else cast (onsetmonthnum as varchar) end + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
|
|
|| " case when (onsetdaynum >0 and onsetdaynum <10) then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} + cast (onsetdaynum as varchar) "
|
|
|| " when onsetdaynum = 0 then {{{SINGLE-QUOTE}}}01{{{SINGLE-QUOTE}}} else cast (onsetdaynum as varchar) end "
|
|
|| " + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + cast (onsetyearnum as varchar) +{{{SINGLE-QUOTE}}} 00:00:00.000{{{SINGLE-QUOTE}}} "
|
|
|| " end {{{SINGLE-QUOTE}}}date returned to mlm{{{SINGLE-QUOTE}}} "
|
|
|| " from cv3healthissuedeclaration with (nolock) "
|
|
|| " where clientguid = " || ClientGuid || " and active = 1 and status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}}"
|
|
|| " and (text like {{{SINGLE-QUOTE}}}%Influenza Vaccine%{{{SINGLE-QUOTE}}} or shortname like {{{SINGLE-QUOTE}}}%Influenza Vaccine%{{{SINGLE-QUOTE}}} or description like {{{SINGLE-QUOTE}}}%Influenza Vaccine%{{{SINGLE-QUOTE}}} "
|
|
|| " or ShortName like {{{SINGLE-QUOTE}}}%influenza%pediatric%{{{SINGLE-QUOTE}}} or ShortName like {{{SINGLE-QUOTE}}}%influenza%quadrivalent%{{{SINGLE-QUOTE}}} or ShortName like {{{SINGLE-QUOTE}}}%influenza%high%{{{SINGLE-QUOTE}}} or ShortName like {{{SINGLE-QUOTE}}}%influenza%trivalent%{{{SINGLE-QUOTE}}})"
|
|
|| " order by createdwhen "
|
|
};
|
|
vaccinehealthissue_found := count(vaccinehealthissue) As Number;
|
|
|
|
|
|
|
|
// Chronic Illness health issues
|
|
|
|
/* 08.31.2015 DW ICD10
|
|
|
|
(chronicillness) := read
|
|
{
|
|
" select distinct hi.shortname "
|
|
|| "from cv3healthissuedeclaration hi with (nolock) "
|
|
|| "join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
|
|
|| "where hi.clientguid = " || ClientGuid || " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|
|
|| "and hi.typecode not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}) "
|
|
|| " and ( "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Renal%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Renal%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Cardiomyopathy%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Cardiomyopathy%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%CardioVascular Disease%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%CardioVascular Disease%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Coronary Artery Disease%{{{SINGLE-QUOTE}}}or hi.shortname like {{{SINGLE-QUOTE}}}%Coronary Artery Disease%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Congestive Heart Failure%{{{SINGLE-QUOTE}}}or hi.shortname like {{{SINGLE-QUOTE}}}Congestive Heart Failure{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Abuse, Alcohol%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Abuse, Alcohol%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Tobacco%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Tobacco%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Liver Disease%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Liver Disease%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Asthma%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Asthma%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Splenectomy%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Splenectomy%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Heart Disease%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Heart Disease%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%bronchitis,chronic%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%chronic bronchitis%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%copd%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%copd%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Anemia, Sickle Cell%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Anemia, Sickle Cell%{{{SINGLE-QUOTE}}} or "
|
|
|| "(case when chi.typecode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} then substring(chi.code, 5, 20) when chi.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}305.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V15.82{{{SINGLE-QUOTE}}}) "
|
|
|| " ) "
|
|
|| " and (hi.text not like {{{SINGLE-QUOTE}}}Adrenal%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}%adrenal%{{{SINGLE-QUOTE}}}) "
|
|
|| " and (hi.description not like {{{SINGLE-QUOTE}}}Cyst, Renal%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}Cyst, Renal%{{{SINGLE-QUOTE}}}) "
|
|
|| " and (hi.description not like {{{SINGLE-QUOTE}}}Renal Calculi%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}Kidney Stones%{{{SINGLE-QUOTE}}}) "
|
|
|| " and (hi.description not like {{{SINGLE-QUOTE}}}Renal Stone%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}Renal Stone%{{{SINGLE-QUOTE}}}) "
|
|
|| " and (hi.description not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}}) "
|
|
};
|
|
*/
|
|
|
|
(chronicillness) := read
|
|
{
|
|
" select distinct hi.shortname "
|
|
|| "from cv3healthissuedeclaration hi with (nolock) "
|
|
|| "join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
|
|
|| "where hi.clientguid = " || ClientGuid || " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|
|
|| "and hi.typecode not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}) "
|
|
|| " and ( "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Renal%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Renal%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Cardiomyopathy%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Cardiomyopathy%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%CardioVascular Disease%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%CardioVascular Disease%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Coronary Artery Disease%{{{SINGLE-QUOTE}}}or hi.shortname like {{{SINGLE-QUOTE}}}%Coronary Artery Disease%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Congestive Heart Failure%{{{SINGLE-QUOTE}}}or hi.shortname like {{{SINGLE-QUOTE}}}Congestive Heart Failure{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Abuse, Alcohol%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Abuse, Alcohol%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Tobacco%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Tobacco%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Liver Disease%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Liver Disease%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Asthma%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Asthma%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Splenectomy%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Splenectomy%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Heart Disease%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Heart Disease%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%bronchitis,chronic%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%chronic bronchitis%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%copd%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%copd%{{{SINGLE-QUOTE}}} or "
|
|
|| "hi.text like {{{SINGLE-QUOTE}}}%Anemia, Sickle Cell%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Anemia, Sickle Cell%{{{SINGLE-QUOTE}}} or "
|
|
|| " ( "
|
|
|| " (hi.ICD9Code is null and chi.code in ({{{SINGLE-QUOTE}}}305.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V15.82{{{SINGLE-QUOTE}}}) ) "
|
|
|| " or "
|
|
|| " (hi.ICD9Code is not null and hi.ICD9Code in ({{{SINGLE-QUOTE}}}305.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V15.82{{{SINGLE-QUOTE}}}) ) "
|
|
|| " ) "
|
|
|| " ) "
|
|
|| " and (hi.text not like {{{SINGLE-QUOTE}}}Adrenal%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}%adrenal%{{{SINGLE-QUOTE}}}) "
|
|
|| " and (hi.description not like {{{SINGLE-QUOTE}}}Cyst, Renal%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}Cyst, Renal%{{{SINGLE-QUOTE}}}) "
|
|
|| " and (hi.description not like {{{SINGLE-QUOTE}}}Renal Calculi%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}Kidney Stones%{{{SINGLE-QUOTE}}}) "
|
|
|| " and (hi.description not like {{{SINGLE-QUOTE}}}Renal Stone%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}Renal Stone%{{{SINGLE-QUOTE}}}) "
|
|
|| " and (hi.description not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}}) "
|
|
};
|
|
|
|
|
|
|
|
chronicillness_found := count(chronicillness) As Number;
|
|
|
|
if chronicillness_found > 0
|
|
then chronic := "something found";
|
|
else chronic := "unknown";
|
|
endif;
|
|
|
|
// Immunocompromised health issues
|
|
|
|
|
|
(immunocompromised) := read
|
|
{
|
|
"select distinct shortname "
|
|
|| "from cv3healthissuedeclaration with (nolock) "
|
|
|| "where clientguid = " || ClientGuid || " and active = 1 and status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|
|
|| "and typecode not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}) and ( "
|
|
|| " text like {{{SINGLE-QUOTE}}}%Splenectomy%{{{SINGLE-QUOTE}}} or shortname like {{{SINGLE-QUOTE}}}%Splenectomy%{{{SINGLE-QUOTE}}} or "
|
|
|| " text like {{{SINGLE-QUOTE}}}%Transplant%{{{SINGLE-QUOTE}}} or shortname like {{{SINGLE-QUOTE}}}%Transplant%{{{SINGLE-QUOTE}}} or "
|
|
|| " text like {{{SINGLE-QUOTE}}}%Anemia, Sickle Cell%{{{SINGLE-QUOTE}}} or shortname like {{{SINGLE-QUOTE}}}%Anemia, Sickle Cell%{{{SINGLE-QUOTE}}} or "
|
|
|| " text like {{{SINGLE-QUOTE}}}%Chemotherapy%{{{SINGLE-QUOTE}}} or shortname like {{{SINGLE-QUOTE}}}%Chemotherapy%{{{SINGLE-QUOTE}}} or "
|
|
|| " text like {{{SINGLE-QUOTE}}}%Cardiomyopathy%{{{SINGLE-QUOTE}}} or shortname like {{{SINGLE-QUOTE}}}%Cardiomyopathy%{{{SINGLE-QUOTE}}} or "
|
|
|| " text like {{{SINGLE-QUOTE}}}%HIV%{{{SINGLE-QUOTE}}} or shortname like {{{SINGLE-QUOTE}}}%HIV%{{{SINGLE-QUOTE}}} or "
|
|
|| " text like {{{SINGLE-QUOTE}}}%Radiation%{{{SINGLE-QUOTE}}} or shortname like {{{SINGLE-QUOTE}}}%Radiation%{{{SINGLE-QUOTE}}} or "
|
|
|| " text like {{{SINGLE-QUOTE}}}%Radiation Therapy%{{{SINGLE-QUOTE}}} or shortname like {{{SINGLE-QUOTE}}}%Radiation Therapy%{{{SINGLE-QUOTE}}} or "
|
|
|| " text like {{{SINGLE-QUOTE}}}%Cancer%{{{SINGLE-QUOTE}}} or shortname like {{{SINGLE-QUOTE}}}%Cancer%{{{SINGLE-QUOTE}}} ) "
|
|
};
|
|
immunocompromised_found := count(immunocompromised) As Number;
|
|
|
|
if immunocompromised_found > 0
|
|
then immuno := "something found";
|
|
else immuno := "unknown";
|
|
endif;
|
|
|
|
|
|
|
|
// Populate Fields and Boxes
|
|
|
|
|
|
|
|
// Chronic Illness
|
|
|
|
|
|
// First determine if a button has previously been selected by the nurse and do not override it
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza has Chronic Illness y/n");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
If true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
|
|
then chronic := "true";
|
|
endif;
|
|
If true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
|
|
then chronic := "false";
|
|
endif;
|
|
|
|
// Select the Chronic Illness YES radio button if one is found (only if no button has been peviously selected)
|
|
|
|
If chronic = "something found" then
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influenza has Chronic Illness y/n");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
listItems := ();
|
|
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
if selectedItem.Value = "yes" and chronicillness_found > 0
|
|
then selectedItem.IsSelected := true; chronic := "true";
|
|
endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
endif;
|
|
|
|
|
|
// Populate the Chronic Illnesses Information box
|
|
|
|
holdchron:="";
|
|
if chronicillness_found > 0 then
|
|
for k in (1 seqto (chronicillness_found )) do
|
|
if chronicillness[k] is not null then
|
|
holdchron := holdchron || chronicillness[k] ;
|
|
if k <> chronicillness_found then // not the last in the list
|
|
holdchron := holdchron || ", ";
|
|
endif;
|
|
endif;
|
|
enddo;
|
|
endif;
|
|
if holdchron = "" then formattedTextChron := " Nothing found. Does the patient have an illness that can be considered a chronic illness as defined by protocol? ";
|
|
else formattedtextChron := holdchron;
|
|
endif;
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influenza Chronic Ill FT");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "FreeTextValue";
|
|
this_currentObj.ValueObj := New FreeTextValueType;
|
|
this_currentObj.ValueObj.Value := formattedTextChron;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
|
|
|
|
|
|
// Immunocompromised
|
|
|
|
|
|
// First determine if a button has previously been selected by the nurse and do not override it
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza immuno Comp y/n");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
If true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
|
|
then immuno := "true";
|
|
endif;
|
|
If true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
|
|
then immuno := "false";
|
|
endif;
|
|
|
|
// Select the Immunocompromised YES radio button if one is found (only if no button has been peviously selected)
|
|
|
|
If immuno = "something found" then
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influenza immuno Comp y/n");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
listItems := ();
|
|
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
if selectedItem.Value = "yes" and immunocompromised_found > 0 then selectedItem.IsSelected := true; immuno := "true"; endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
endif;
|
|
|
|
// Populate the Immunocompromised Information box
|
|
|
|
holdchron:="";
|
|
if immunocompromised_found > 0 then
|
|
for k in (1 seqto (immunocompromised_found )) do
|
|
if immunocompromised[k] is not null then
|
|
holdchron := holdchron || immunocompromised[k] ;
|
|
if k <> immunocompromised_found then // not the last in the list
|
|
holdchron := holdchron || ", ";
|
|
endif;
|
|
endif;
|
|
enddo;
|
|
endif;
|
|
if holdchron = "" then formattedTextImmune := " Nothing found. Does the patient have any reason to be immunocompromised as defined by protocol? ";
|
|
else formattedTextImmune := holdchron;
|
|
endif;
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influenza Immuno FT");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "FreeTextValue";
|
|
this_currentObj.ValueObj := New FreeTextValueType;
|
|
this_currentObj.ValueObj.Value := formattedTextImmune;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
|
|
|
|
|
|
// Date
|
|
|
|
|
|
// First determine which of the 3 dates is latest (Pneumococcal given, charted, or health issue)
|
|
|
|
match1 := false;
|
|
match2 := false;
|
|
match3 := false;
|
|
nodates:= false;
|
|
|
|
If vaccinegivenwhen is null and vaccinehealthissuedate is null and vaccinechartedwhen is null
|
|
then nodates := true; endif;
|
|
|
|
If vaccinegivenwhen is null then vaccinegivenwhen := 1800-01-01T00:00:00; endif;
|
|
If vaccinehealthissuedate is null then vaccinehealthissuedate := 1800-01-01T00:00:00; endif;
|
|
If vaccinechartedwhen is null then vaccinechartedwhen := 1800-01-01T00:00:00; endif;
|
|
|
|
match1 := vaccinegivenwhen IS AFTER vaccinehealthissuedate;
|
|
|
|
If match1 = true
|
|
then match2 := vaccinegivenwhen IS AFTER vaccinechartedwhen;
|
|
else match3 := vaccinehealthissuedate IS AFTER vaccinechartedwhen;
|
|
endif;
|
|
|
|
If match2 = true then givenwins := true; endif;
|
|
If match3 = true then healthissuewins := true; endif;
|
|
If (match2 = false) and (match3 = false) then chartedwins := true; endif;
|
|
|
|
|
|
if nodates = false then
|
|
If givenwins = true then latestdate := vaccinegivenwhen; endif;
|
|
If healthissuewins = true then latestdate := vaccinehealthissuedate; endif;
|
|
If chartedwins = true then latestdate := vaccinechartedwhen; endif;
|
|
endif;
|
|
|
|
// If the latest date is not within this flu season, blank it out (only show dates in this flu season)
|
|
|
|
if (latestdate as time) < (flu_season_start as time) then latestdate := null; endif;
|
|
|
|
// Populate Date field
|
|
|
|
|
|
// First determine if the field has been manually updated by the nurse (not empty)
|
|
|
|
theParameter := first of (thisParameters where thisParameters.Name = "SCHCK_vaccine received date");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
datefieldcontents := theObservation.ValueObj.Value;
|
|
|
|
if datefieldcontents is null
|
|
then datefield := latestdate;
|
|
else datefield := datefieldcontents;
|
|
endif;
|
|
|
|
// Populate the field if history is found in SCM and the field hasn{{{SINGLE-QUOTE}}}t been overriden by the nurse (not empty)
|
|
|
|
If latestdate is not null and datefieldcontents is null
|
|
then
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_vaccine received date");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "DateValue";
|
|
this_currentObj.ValueObj := New DateValueType;
|
|
this_currentObj.ValueObj.Value := latestdate;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
endif;
|
|
|
|
|
|
|
|
// REASSESS ONLY SECTION
|
|
|
|
|
|
elseIf MLMAction = "Reassess Only" then
|
|
|
|
|
|
|
|
// Determine which of the chronic illness buttons is selected
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza has Chronic Illness y/n");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
If true not in (theObservation.ValueObj.ListItemsList.IsSelected)
|
|
then chronic := "unknown";
|
|
elseif true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
|
|
then chronic := "true";
|
|
else chronic := "false";
|
|
endif;
|
|
|
|
|
|
// Determine which of the immunocompromised buttons is selected
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza immuno Comp y/n");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
If true not in (theObservation.ValueObj.ListItemsList.IsSelected)
|
|
then immuno := "unknown";
|
|
elseif true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
|
|
then immuno := "true";
|
|
else immuno := "false";
|
|
endif;
|
|
|
|
|
|
// Determine if any of the Contraindications boxes are checked
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_influ vac contra 2");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
If true not in (theObservation.ValueObj.ListItemsList.IsSelected)
|
|
then contraboxchecked := "unknown";
|
|
elseif true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "none")
|
|
then contraboxchecked := "false";
|
|
else contraboxchecked := "true";
|
|
endif;
|
|
|
|
|
|
// Determine the value of the date given field
|
|
|
|
theParameter := first of (thisParameters where thisParameters.Name = "SCHCK_vaccine received date");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
datefield := theObservation.ValueObj.Value;
|
|
|
|
if datefield is null or (datefield as time) < (flu_season_start as time) then datefield := "unknown"; endif;
|
|
|
|
|
|
// Determine which Pregnancy button is selected
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza is Preg y/n");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
If true not in (theObservation.ValueObj.ListItemsList.IsSelected)
|
|
then pregnant := "unknown";
|
|
elseif true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
|
|
then pregnant := "true";
|
|
else pregnant := "false";
|
|
endif;
|
|
|
|
|
|
// Determine which of the Doses This Season buttons is selected
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza number inject THIS YR");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
If true not in (theObservation.ValueObj.ListItemsList.IsSelected)
|
|
then dosesthisseason := "unknown";
|
|
elseif true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "0")
|
|
then dosesthisseason := "0";
|
|
if datefield <> "unknown" then
|
|
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "There is conflicting information." || "\n\n There is a vaccine received date for this season and you have selected zero doses this season." || "\n\n Please resolve this inconsistency." ,"Action Required","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
|
endif;
|
|
elseif true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "1")
|
|
then dosesthisseason := "1";
|
|
if datefield = "unknown" then
|
|
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "A date from this flu season is required with this selection." || "\n\n If the date is not known please enter August 1 of this flu season." ,"Action Required","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
|
endif;
|
|
elseif true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "2")
|
|
then dosesthisseason := "2";
|
|
if datefield = "unknown" then
|
|
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "A date from this flu season is required with this selection." || "\n\n If the date is not known please enter August 1 of this flu season." ,"Action Required","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
|
endif;
|
|
elseif true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "unknown")
|
|
then dosesthisseason := "unknown";
|
|
endif;
|
|
|
|
|
|
// Determine which Double Doses in Prior Season buttons is selected
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza number inject PRIOR SEASONS");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
If true not in (theObservation.ValueObj.ListItemsList.IsSelected)
|
|
then doubledosepriorseason := "unknown";
|
|
elseif true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
|
|
then doubledosepriorseason := "true";
|
|
else doubledosepriorseason := "false";
|
|
endif;
|
|
|
|
|
|
endif; // End of "Reassess Only" Section
|
|
|
|
|
|
|
|
|
|
|
|
// ASSESS THE RISK SECTION ("Retrieve and Reassess" or "Reassess Only")
|
|
|
|
|
|
if MLMAction = "Retrieve and Reassess" or MLMAction = "Reassess Only" then
|
|
|
|
|
|
|
|
// Age
|
|
|
|
(dob,dob65,patientage) := read last
|
|
{
|
|
" select "
|
|
||" cast (birthyearnum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
|
|
||" case when birthmonthnum <10 then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}end + cast (birthmonthnum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
|
|
||" case when birthdaynum <10 then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}end + cast (birthdaynum as varchar) + {{{SINGLE-QUOTE}}}T00:00:00{{{SINGLE-QUOTE}}}, "
|
|
||" cast (birthyearnum + 65 as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
|
|
||" case when birthmonthnum <10 then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}end + cast (birthmonthnum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
|
|
||" case when birthdaynum <10 then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}end + cast (birthdaynum as varchar) + {{{SINGLE-QUOTE}}}T00:00:00{{{SINGLE-QUOTE}}}, "
|
|
||" case when "
|
|
||" right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (datepart (MM,getdate()) as varchar),2) + right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (datepart (DD,getdate()) as varchar),2) < "
|
|
||" right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (birthmonthnum as varchar),2) + right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (birthdaynum as varchar),2) "
|
|
||" then datediff (yy, cast (birthyearnum as varchar) ,getdate()) -1 "
|
|
||" else datediff (yy, cast (birthyearnum as varchar) ,getdate()) "
|
|
||" end "
|
|
||" from cv3client with (nolock) where guid = " || ClientGuid || " "
|
|
};
|
|
|
|
|
|
|
|
// Determine the age range of the patient
|
|
|
|
if ((NOW - (dob as time)) / (1 month)) < 6 then agerange := "1"; agerangenote := agerange1note; endif;
|
|
if ((NOW - (dob as time)) / (1 month)) >= 6 and (patientage as number) < agerange3_lowerlimit then agerange := "2"; agerangenote := agerange2note; endif;
|
|
if (patientage as number) >= agerange3_lowerlimit and (patientage as number) < agerange4_lowerlimit then agerange := "3"; agerangenote := agerange3note; endif;
|
|
if (patientage as number) >= agerange4_lowerlimit and (patientage as number) < agerange5_lowerlimit then agerange := "4"; agerangenote := agerange4note; endif;// Row for 9 and Older Age & agerange4note := "9 to 18";
|
|
if (patientage as number) >= agerange5_lowerlimit and (patientage as number) < agerange6_lowerlimit then agerange := "5"; agerangenote := agerange5note; endif;
|
|
if (patientage as number) >= agerange6_lowerlimit and (patientage as number) < agerange7_lowerlimit then agerange := "6"; agerangenote := agerange6note; endif;
|
|
if (patientage as number) >= agerange7_lowerlimit then agerange := "7"; agerangenote := agerange7note; highdose := "true"; endif; //added as part of CSR 37633 - SZ
|
|
|
|
// break;
|
|
// Determine how long ago the vaccine was given and the patients age at the time
|
|
|
|
if (datefield as time)is within the past 365 days then within365 := "true"; else within365 := "false"; endif;
|
|
if (datefield as time)is within the past 5 years then within5years:= "true"; else within5years:= "false"; endif;
|
|
if (datefield as time) > (dob65 as time) then vacover65 := "true"; else vacover65 := "false"; endif;
|
|
if (datefield as time)is within the past 30 days then within30 := "true"; else within30 := "false"; endif;
|
|
|
|
// set to unknown to satisfy conditions below
|
|
|
|
if datefield is null then datefield := "unknown"; endif;
|
|
|
|
|
|
// Risk Senarios
|
|
|
|
|
|
// Scenarios that will cause an order to be placed
|
|
|
|
/*
|
|
If agerange in ("4", "6") and datefield = "unknown" then ordervaccine := "yes";
|
|
formattedTextReason := "Y-1. Order is to be placed since patient is not 19-50 and has not received a vaccine within this flu season." ; endif;
|
|
|
|
If agerange in ("2", "3") and datefield = "unknown" and dosesthisseason = "0" then ordervaccine := "yes";
|
|
formattedTextReason := "Y-2. Order is to be placed since patient is 6 months to 8 years and has not received a vaccine within this flu season." ; endif;
|
|
|
|
If agerange in ("2", "3") and dosesthisseason = "1" and doubledosepriorseason = "false" then ordervaccine := "yes";
|
|
formattedTextReason := "Y-3. Order is to be placed since patient is 6 months to 8 years and has received less than 2 vaccine doses." ; endif;
|
|
|
|
If agerange in ("2", "3") and dosesthisseason = "unknown" then ordervaccine := "yes";
|
|
formattedTextReason := "Y-4. Order is to be placed since patient is 6 months to 8 years and it is unknown if they have received a vaccine within this flu season." ; endif;
|
|
|
|
If agerange = "5" and datefield = "unknown" and (chronic = "true" or immuno = "true") then ordervaccine := "yes";
|
|
formattedTextReason := "Y-5. Order is to be placed since patient is 19-50, has a chronic illness or is immunocompromised and has not received a vaccine within this flu season." ; endif;
|
|
|
|
If pregnant = "true" and datefield = "unknown" then ordervaccine := "yes";
|
|
formattedTextReason := "Y-6. Order is to be placed since patient is pregnant and has not received a vaccine within this flu season." ; endif;
|
|
*/
|
|
|
|
If agerange <> "1" and datefield = "unknown" then ordervaccine := "yes";
|
|
formattedTextReason := "Y-7. Order is to be placed since patient is over 6 months and has not received a vaccine within this flu season." ; endif;
|
|
|
|
//Break;
|
|
/**** CSR 33143 : Code added by Shivprasad */
|
|
//=======================================================================
|
|
If agerange In( "2","3") //and datefield = "unknown"
|
|
And dosesthisseason = "1" then
|
|
//Break;
|
|
If doubledosepriorseason= "True" Then
|
|
ordervaccine := "No";
|
|
formattedTextReason := "N-8. Order Cannot to be placed since patient is over 6 months to 9 Year and has received a 0 or 1 vaccine within this flu season." ;
|
|
|
|
Else
|
|
ordervaccine := "yes";
|
|
formattedTextReason := "Y-8. Order is to be placed since patient is over 6 months to 9 Year and has received a 0 or 1 vaccine within this flu season." ;
|
|
//Break;
|
|
Endif;
|
|
ElseIf agerange In( "2","3") And dosesthisseason = "2" Then
|
|
ordervaccine := "No";
|
|
|
|
endif;
|
|
|
|
|
|
//===============================================================================
|
|
/* End Code :Shivprasad */
|
|
|
|
// Scenarios that will NOT cause an order to be placed
|
|
/*
|
|
If datefield <> "unknown" and agerange not in ("2", "3") then ordervaccine := "no";
|
|
formattedTextReason := "N-1. Order is not to be placed since patient has had a vaccine for the current flu season. " ; endif;
|
|
*/
|
|
If agerange = "1" then ordervaccine := "no";
|
|
formattedTextReason := "N-2. Patient is under 6 months do not recieve the vaccine. " ; endif;
|
|
|
|
//Break;
|
|
/*
|
|
If agerange in ("2", "3") and dosesthisseason in ("1", "2") and doubledosepriorseason = "true" then ordervaccine := "no";
|
|
formattedTextReason := "N-3. Order is not to be placed since patient is 6 months to 8 years and has received a vaccine dose this season and 2 doses in a prior season." ; endif;
|
|
|
|
If agerange = "5" and immuno = "false" and chronic = "false" and pregnant in ("false","unknown") then ordervaccine := "no";
|
|
formattedTextReason := "N-4. Order is not to be placed since patient is 19-50 and does not meet criteria." ; endif;
|
|
*/
|
|
|
|
// Special Handling for Place Order Button Changes
|
|
|
|
|
|
/* 11/28/2012 DW stopped override entirely CSR# 6496 MLM
|
|
|
|
If trigger = "Order Button NO was selected" then ordervaccine := "no";
|
|
formattedTextReason := formattedTextReason || " ** OVERRIDDEN TO NO BY " || userId || " ** "; endif;
|
|
*/
|
|
If trigger = "Order Button NO was selected" and ordervaccine = "yes" then
|
|
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This patient meets the criteria for a vaccination order. \n\n Select ""Refuses Influenza Vaccine"" if an order is not to be entered. ", "Error","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
|
formattedTextReason := formattedTextReason || " ** OVERRIDDEN TO NO BY " || userId || " ** "; endif;
|
|
|
|
If trigger = "Order Button YES was selected" and ordervaccine = "no" then
|
|
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n You cannot place an order on this patient. ", "Error","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
|
formattedTextReason := formattedTextReason || " ** FAILED OVERRIDE TO YES BY " || userId || " ** "; endif;
|
|
|
|
|
|
|
|
endif; // end of section for assessing risk
|
|
|
|
|
|
|
|
endif; // End of Bypass Everything (If MLMAction <> "No Assessment Required")
|
|
|
|
|
|
|
|
|
|
// FOR ANY OBSERVATION CHANGE
|
|
|
|
|
|
// Select the appropriate Order Pneumococcal radio button determined by the assessment
|
|
|
|
|
|
If contraboxchecked = "true" then ordervaccine := "no";
|
|
formattedTextReason := "N-7. Order will not be placed since the vaccine is contraindicated."; endif;
|
|
|
|
If within30 = "true" then ordervaccine := "no";
|
|
formattedTextReason := "N-8. Order will not be placed since the vaccine has been given in the last 30 days."; endif;
|
|
|
|
If todays_date < protocol_start or todays_date > protocol_end then ordervaccine := "no";
|
|
formattedTextReason := "N-9. Physician order is required for Influenza vaccine to be administered before October 1st or after March 31st. " ; endif;
|
|
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influenza vac order");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
listItems := ();
|
|
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
if selectedItem.Value = "yes" and ordervaccine = "yes" then selectedItem.IsSelected := true; endif;
|
|
if selectedItem.Value = "no" and ordervaccine = "no" then selectedItem.IsSelected := true; endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
//Break;
|
|
|
|
// Appropriately set the hidden Chronic Illness Mandatory button
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influenza CI- unknown");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
listItems := ();
|
|
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
if chronic = "unknown" and contraboxchecked = "false"
|
|
then selectedItem.IsSelected := true;
|
|
else selectedItem.IsSelected := false;
|
|
endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
|
|
// Appropriately set the hidden Immunocompromised Mandatory button
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influenza IC- unknown");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
listItems := ();
|
|
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
if immuno = "unknown" and contraboxchecked = "false"
|
|
then selectedItem.IsSelected := true;
|
|
else selectedItem.IsSelected := false;
|
|
endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
|
|
// Appropriately set the hidden Pregnancy Mandatory button
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influenza Preg - unknown");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
listItems := ();
|
|
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
if pregnant = "unknown" and contraboxchecked = "false"
|
|
then selectedItem.IsSelected := true;
|
|
else selectedItem.IsSelected := false;
|
|
endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
|
|
// Appropriately set the Dosage button
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influenza inj dosage");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
listItems := ();
|
|
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
// if selectedItem.Value = "0.25 ml" and agerange = "2" then selectedItem.IsSelected := true; endif; //SZ - removed for changes in CSR
|
|
if selectedItem.Value = "0.25 mL (6 mo - 35 mo)" and agerange = "2" then selectedItem.IsSelected := true; endif;
|
|
// if selectedItem.Value = "0.5 ml" and agerange in ("3","4","5","6","7") then selectedItem.IsSelected := true; endif; // Set Dose ML for 9-18 Age Range
|
|
if selectedItem.Value = "0.5 mL (3-64 years)" and agerange in ("3","4","5","6","7") then selectedItem.IsSelected := true; endif; // Set Dose ML for 9-18 Age Range
|
|
if selectedItem.Value = "0.5 mL HD (65 years+)" and agerange in ("7") then selectedItem.IsSelected := true; endif; // Set Dose ML for 9-18 Age Range
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
|
|
endif; // End of Observation Event section
|
|
|
|
|
|
|
|
|
|
|
|
// DOCUMENT CLOSING SECTION
|
|
|
|
|
|
IF thisdocumentCommunication.EventType = "DocumentClosing" then
|
|
(cdob,cdob65,cpatientage) := read last
|
|
{
|
|
" select "
|
|
||" cast (birthyearnum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
|
|
||" case when birthmonthnum <10 then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}end + cast (birthmonthnum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
|
|
||" case when birthdaynum <10 then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}end + cast (birthdaynum as varchar) + {{{SINGLE-QUOTE}}}T00:00:00{{{SINGLE-QUOTE}}}, "
|
|
||" cast (birthyearnum + 65 as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
|
|
||" case when birthmonthnum <10 then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}end + cast (birthmonthnum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
|
|
||" case when birthdaynum <10 then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}end + cast (birthdaynum as varchar) + {{{SINGLE-QUOTE}}}T00:00:00{{{SINGLE-QUOTE}}}, "
|
|
||" case when "
|
|
||" right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (datepart (MM,getdate()) as varchar),2) + right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (datepart (DD,getdate()) as varchar),2) < "
|
|
||" right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (birthmonthnum as varchar),2) + right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (birthdaynum as varchar),2) "
|
|
||" then datediff (yy, cast (birthyearnum as varchar) ,getdate()) -1 "
|
|
||" else datediff (yy, cast (birthyearnum as varchar) ,getdate()) "
|
|
||" end "
|
|
||" from cv3client with (nolock) where guid = " || ClientGuid || " "
|
|
};
|
|
|
|
if (cpatientage as number) >= 65 then highdose := "true"; endif;
|
|
//break;
|
|
// Determine if Place Order button is set to "Yes"
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza vac order");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
|
|
then placeorder := "no"; endif;
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
|
|
then placeorder := "yes"; endif;
|
|
|
|
|
|
// Determine which Dosage Button is selected"
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Influenza inj dosage");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
// if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "0.25 ml")
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "0.25 mL (6 mo - 35 mo)")
|
|
then ordername := "Influenza Virus Vaccine Pediatric Inj"; dosage := "0.25ml, IM Once (6mos - 35 mos)"; endif;
|
|
|
|
|
|
// if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "0.5 ml")
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "0.5 mL (3-64 years)")
|
|
then ordername := "Influenza Virus Vaccine Inj"; dosage := "0.5ml IM Once (3 - 64 years)";
|
|
|
|
/*
|
|
then
|
|
if highdose = "true"
|
|
then ordername := "Influenza Virus Vaccine High Dose Inj"; dosage := "0.5ml, IM Once (65 years and older)";
|
|
else ordername := "Influenza Virus Vaccine Inj"; dosage := "0.5ml IM Once";
|
|
endif;
|
|
*/
|
|
|
|
endif;
|
|
|
|
|
|
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "0.5 mL HD (65 years+)")
|
|
then if highdose = "true"
|
|
then ordername := "Influenza Virus Vaccine High Dose Inj"; dosage := "0.5ml, IM Once (65 years and older)"; endif;
|
|
|
|
endif;
|
|
|
|
|
|
// Check for existing Influenza Order on the account
|
|
|
|
(orderpresent) := read
|
|
{
|
|
" select o.name "
|
|
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
|
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || VisitGuid || " "
|
|
|| " and o.name in ({{{SINGLE-QUOTE}}}Influenza Virus Trivalent Vaccine Inj{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Influenza Virus Trivalent Vaccine Pediatric Inj{{{SINGLE-QUOTE}}}, "
|
|
|| " {{{SINGLE-QUOTE}}}Influenza Virus Vaccine Inj{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Influenza Virus Vaccine Pediatric Inj{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Influenza Virus Vaccine High Dose Inj{{{SINGLE-QUOTE}}}) "
|
|
|| " and o.OrderStatusLevelNum > 15 "
|
|
};
|
|
orderpresent_found := count(orderpresent) As Number;
|
|
|
|
|
|
|
|
// If no existing order is found and Place Order button is "Yes" then create a new order
|
|
|
|
//break;
|
|
If placeorder = "yes" and orderpresent_found = 0 then
|
|
|
|
//break;
|
|
SessionType := "Standard";
|
|
SessionReason := "";
|
|
RequestingSource := "Standing Order";
|
|
user_IDType := "Edstan Number (physician)";
|
|
order_Creation_Reason := "From Test MLM";
|
|
|
|
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((thisdocumentCommunication.ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
|
user_IDCode := read last {"SELECT IDCode FROM CV3User " || " where GUID = " || thisdocumentCommunication.UserGUID};
|
|
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
|
|
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || thisdocumentCommunication.ClientGUID};
|
|
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
|
|
|
|
|
// Create a new MEDICATION order from a Pre-Filled item
|
|
try
|
|
// Catalog_Item_Name := "Influenza Virus Trivalent Vaccine Inj";
|
|
// Catalog_Item_Modifier := "0.5ml IM Once";
|
|
Catalog_Item_Name := ordername;
|
|
Catalog_Item_Modifier := dosage;
|
|
Catalog_Item_Version := "";
|
|
Medication_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
|
|
PreFilled_MedicationOrder_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
|
|
with
|
|
client_visit_obj, // ClientVisit ObjectsPlus object
|
|
Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
|
Catalog_Item_Modifier, // string ItemNameModifier
|
|
Catalog_Item_Version, // string ItemNameModifierVersion
|
|
order_Creation_Reason, // string CreateReason
|
|
RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
|
|
RequestingSource, // string RequestedBySource (must be in dictionary)
|
|
SessionType, // string SessionType
|
|
SessionReason, // string SessionReason
|
|
location_obj, // Location ReleaseLocGrpID
|
|
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
|
|
|
|
|
|
if ( Medication_catalog_item is NOT NULL ) then
|
|
void := call PreFilled_MedicationOrder_obj.Save;
|
|
void := call PreFilled_MedicationOrder_obj.Dispose;
|
|
void:= call Medication_catalog_item.Dispose;
|
|
Medication_catalog_item:= null;
|
|
endif;
|
|
|
|
|
|
endtry;
|
|
|
|
catch Exception ex error_occurred := true; error_message := "{{+R}}New prefilled medication order:{{-R}}\n" || ex.Message || "\n\n";
|
|
|
|
if ( Medication_catalog_item is NOT NULL ) then void:= call Medication_catalog_item.Dispose; Medication_catalog_item:= null; endif;
|
|
if ( PreFilled_MedicationOrder_obj is NOT NULL ) then void:= call PreFilled_MedicationOrder_obj.Dispose; PreFilled_MedicationOrder_obj:= null; endif;
|
|
|
|
Prefilled_MedicationOrder_dest := null;
|
|
|
|
endcatch;
|
|
|
|
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
|
if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
|
|
if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
|
|
|
|
|
|
endif; // End of Place Order = Yes section
|
|
|
|
endif; // End of Close Document
|
|
|
|
|
|
|
|
|
|
// Populate the HIS only Assessment Information box
|
|
|
|
|
|
// This secton as well as the FormattedText1 := below are for diagnostic purposes only
|
|
|
|
dateonly:= SUBSTRING 10 CHARACTERS FROM (datefield as string);
|
|
fludateonly:= SUBSTRING 10 CHARACTERS FROM (flu_season_start as string);
|
|
protstartdateonly:= SUBSTRING 10 CHARACTERS FROM (protocol_start as string);
|
|
protenddateonly:= SUBSTRING 10 CHARACTERS FROM (protocol_end as string);
|
|
nowdateonly:= SUBSTRING 10 CHARACTERS FROM (now as string);
|
|
|
|
Factor2 := "Chronic Condition - " || chronic;
|
|
Factor3 := "Immunocompromised - " || immuno || "";
|
|
Factor4 := "WasOver65 - " || vacover65;
|
|
Factor5 := "Contraindicated - "|| contraboxchecked;
|
|
Factor6 := "Within 365days - " || within365;
|
|
Factor7 := "Within 5yrs - " || within5years;
|
|
Factor8 := "Last Given This Season - " || dateonly;
|
|
Factor9 := "Last Trigger Event - " || nowdateonly || " " || trigger || " by " || userid || " (MLM reaction - " || MLMAction || ")";
|
|
Factor14:= "Age - " || patientage;
|
|
Factor17:= "Pregnant - " || pregnant;
|
|
Factor18:= "range " || agerange || " (" || agerangenote || ")";
|
|
Factor19:= "Within 30days - " || within30;
|
|
Factor20:= "Doses This Season - " || dosesthisseason;
|
|
Factor21:= "Double Dose Prior Season - " || doubledosepriorseason;
|
|
Factor23:= "Flu Season Start - " || fludateonly;
|
|
Factor24:= "Flu Protocol - " || protstartdateonly || " to " || protenddateonly ;
|
|
Factor25:= "Place Order - " || placeorder;
|
|
|
|
|
|
formattedText1 := "\n\n" || Factor9 || " " || Factor25||
|
|
"\n\n" || Factor14|| " " || Factor18|| " " || Factor17||
|
|
"\n" || Factor5 || " " || Factor2 || " " || Factor3 ||
|
|
"\n" || Factor8 || " " || Factor6 || " " || Factor19|| " " || Factor7 || " " || Factor4 || " " || Factor20 || " " || Factor21||
|
|
"\n" || Factor23|| " " || Factor24;
|
|
|
|
formattedTextReason := formattedTextReason || formattedText1;
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Influenza Risk Assess Details");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "FreeTextValue";
|
|
this_currentObj.ValueObj := New FreeTextValueType;
|
|
this_currentObj.ValueObj.Value := formattedTextReason;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
|
|
// break;
|
|
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic: conclude true;
|
|
;;
|
|
action: return thisDocumentCommunication;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|