126 lines
4.6 KiB
Plaintext
126 lines
4.6 KiB
Plaintext
maintenance:
|
|
|
|
title: DOC_FUNC_DEFAULT_OBS_VALUES;;
|
|
mlmname: DOC_FUNC_DEFAULT_OBS_VALUES;;
|
|
arden: version 2.5;;
|
|
version: 1.00;;
|
|
institution: St. Clair Hospital;;
|
|
author: Shawn Head x7468 - Allscripts/St. Clair Hospital;;
|
|
specialist: Courtney Carr - Allscripts/St. Clair Hospital;;
|
|
date: 2017-06-20;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose:
|
|
;;
|
|
explanation:
|
|
06-20-2017 STH CSR#: 35320 - This MLM is called to parse through the configuration on structured notes to default the observation values to user configurable values.
|
|
|
|
;;
|
|
keywords:
|
|
;;
|
|
citations:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
std_write_obs_MLM := mlm {{{SINGLE-QUOTE}}}STD_FUNC_DOC_WRITE_TO_DOCUMENT{{{SINGLE-QUOTE}}};
|
|
string_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
CR := 13 formatted with "%c";
|
|
LF := 10 formatted with "%c";
|
|
CRLF:= CR||LF;
|
|
|
|
// 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;
|
|
DocGuid := thisStructuredNoteDoc.ClientDocumentGUID ;
|
|
allrulesprocessed := false;
|
|
Generic_SN_Parameter := first of (thisParameters where thisParameters.Name = "GenericSetObsDefaults");
|
|
Generic_SN_Obs := first of (thisObservations where thisObservations.ParameterGUID = Generic_SN_Parameter.ParameterGUID);
|
|
Generic_SN_Rules := Generic_SN_Obs.ValueObj.Value;
|
|
fidcrlf := find CRLF in string Generic_SN_Rules;
|
|
ctlen := length of Generic_SN_Rules;
|
|
|
|
ReplaceCRLF := "";
|
|
for x in (fidcrlf seqto(ctlen)) do
|
|
|
|
ReplaceCRLF := read {" select replace("|| sql(Generic_SN_Rules) || ",char(13)+char(10),{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) "};
|
|
fidcrlf := find CRLF in string ReplaceCRLF;
|
|
if fidcrlf = 0 then
|
|
fidcrlf := ctlen + 1;
|
|
endif;
|
|
|
|
|
|
enddo;
|
|
|
|
if not (ReplaceCRLF[1] matches pattern "%|") then
|
|
ReplaceCRLF[1] := ReplaceCRLF[1] || "|";
|
|
endif;
|
|
Rules_List := ();
|
|
Rules_Obs_Values := ();
|
|
SplitRulesFromValues := ();
|
|
SplitValuesFromSuggestedText := ();
|
|
|
|
Rules_List := call string_parse with (ReplaceCRLF[1],"|");
|
|
|
|
for x in 1 seqto(count(Rules_List)) do
|
|
test2 := Rules_List[x];
|
|
tstfind := find CRLF in string Rules_List[x];
|
|
(SplitRulesFromValues) := call string_parse with (Rules_List[x],"~");
|
|
Rules_Obs_Parameter := SplitRulesFromValues[1];
|
|
testsplit := (SplitRulesFromValues[2] matches pattern "%{%");
|
|
if(SplitRulesFromValues[2] matches pattern "%{%") then
|
|
SplitValuesFromSuggestedText := call string_parse with (SplitRulesFromValues[2],"{");
|
|
(Rules_Obs_Values) := call string_parse with (SplitValuesFromSuggestedText[1],"^");
|
|
Rules_Obs_SuggestedText := SplitValuesFromSuggestedText[2];
|
|
else
|
|
(Rules_Obs_Values) := call string_parse with (SplitRulesFromValues[2],"^");
|
|
Rules_Obs_SuggestedText := "";//SplitValuesFromSuggestedText[2];
|
|
endif;
|
|
|
|
IF(count(Rules_Obs_Values)>1) then
|
|
(thisDocumentCommunication) := CALL std_write_obs_MLM with (thisDocumentCommunication,Rules_Obs_Parameter,Rules_Obs_Values,Rules_Obs_SuggestedText,"Replace");
|
|
else
|
|
(thisDocumentCommunication) := CALL std_write_obs_MLM with (thisDocumentCommunication,Rules_Obs_Parameter,Rules_Obs_Values[1],Rules_Obs_SuggestedText,"Replace");
|
|
endif;
|
|
|
|
enddo;
|
|
|
|
if((Generic_SN_Rules <> "") and (allrulesprocessed)) then
|
|
(thisDocumentCommunication) := CALL std_write_obs_MLM with (thisDocumentCommunication,Generic_SN_Parameter.Name,"","","Replace");
|
|
endif;
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic: conclude true;
|
|
;;
|
|
action: return thisDocumentCommunication;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|