Initial Checking with all 820 MLMs

This commit is contained in:
2020-02-02 00:54:01 -05:00
parent c59dc6de2e
commit 840d0432f4
828 changed files with 239162 additions and 0 deletions

View File

@@ -0,0 +1,487 @@
maintenance:
title: Vital Signs - Highs and Lows;;
mlmname: DOC_FUNC_Last_24hrs;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Shivprasad Jadhav;;
specialist: ;;
date: 2014-12-16;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
20.12.2014 DW Created to show last 24 hours Vital Sign observations from Physician Progress Note.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// 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];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// OBSERVATION CHANGE
if thisDocumentCommunication.EventType = "ChartObservation"
then
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, o.ValueText, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}} THEN 05 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Mean BP{{{SINGLE-QUOTE}}} THEN 06 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive BP Source 1{{{SINGLE-QUOTE}}} THEN 07 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}} THEN 08 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_pulse ox source{{{SINGLE-QUOTE}}} THEN 09 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.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 in ({{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Mean BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive BP Source 1{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_vs_pulse ox source{{{SINGLE-QUOTE}}} ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}1.Vital Signs - Basic{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
// || " delete from #tmp_aaa where timstmp2 is not null "
|| " Delete from #tmp_aaa where Value is Null "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Vital Signs - Basic in Past 24 Hours -All Charted \b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := (obsNamesList[i]);
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("farenheit" , "Heart Rate" , "Resp Rate" , "Noninvasive Diastolic BP" , "Noninvasive Systolic BP" ,
"Noninvasive Mean BP", "Noninvasive BP Source 1", "SCH_vs_pulse ox saturation", "SCH_vs_pulse ox source")
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "Heart Rate" then formattedText1 := formattedText1 || "\b HR:\b0 ";
elseif obsName = "Farenheit" then formattedText1 := formattedText1 || "\b T:\b0 ";
elseif obsName = "Resp Rate" then formattedText1 := formattedText1 || "\b R:\b0 ";
elseif obsName = "Noninvasive Systolic BP" then formattedText1 := formattedText1 || "\b BP:\b0 ";
elseif obsName = "Noninvasive Diastolic BP" then formattedText1 := formattedText1 || "/";
elseif obsName = "Noninvasive Mean BP" then formattedText1 := formattedText1 || "\b Mean BP:\b0 ";
elseif obsName = "Noninvasive BP Source 1" then formattedText1 := formattedText1 || "/";
elseif obsName = "SCH_vs_pulse ox saturation" then formattedText1 := formattedText1 || "\b Pulse Ox:\b0 ";
//elseif obsName = "SCH_vs_pulse ox source" then formattedText1 := formattedText1 || "/" ; //b O2 L/min:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]);
endif; // Obsname amongst the Vital Signs observations
// for Urine
// SCH_io_Foley Catheter, io_output_condom_catheter, SCH_io_Straight Catheter
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif;
// DOCUMENT OPEN
/*
if thisdocumentCommunication.EventType = "DocumentOpening"
then
// Query the database for the vitals info
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, o.ValueText, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}Farenheit{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}} THEN 05 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Systolic BP - Radial{{{SINGLE-QUOTE}}} THEN 06 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Diastolic BP - Radial{{{SINGLE-QUOTE}}} THEN 07 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Systolic BP - Second Line{{{SINGLE-QUOTE}}} THEN 08 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Diastolic - Second Line{{{SINGLE-QUOTE}}} THEN 09 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}} THEN 10 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}L/min{{{SINGLE-QUOTE}}} THEN 11 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height in cm{{{SINGLE-QUOTE}}} THEN 20 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height in ft{{{SINGLE-QUOTE}}} THEN 21 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height remainder in inches{{{SINGLE-QUOTE}}} THEN 22 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}} THEN 23 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt gm ob NU{{{SINGLE-QUOTE}}} THEN 24 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt lb ob NU{{{SINGLE-QUOTE}}} THEN 25 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt oz ob NU{{{SINGLE-QUOTE}}} THEN 26 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt lb ob NU{{{SINGLE-QUOTE}}} THEN 27 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt oz ob NU{{{SINGLE-QUOTE}}} THEN 28 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - grams{{{SINGLE-QUOTE}}} THEN 29 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - lbs{{{SINGLE-QUOTE}}} THEN 40 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - oz{{{SINGLE-QUOTE}}} THEN 41 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Weight - lbs{{{SINGLE-QUOTE}}} THEN 42 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}} THEN 43 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_Occipital-Frontal Head{{{SINGLE-QUOTE}}} THEN 44 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Stool{{{SINGLE-QUOTE}}}THEN 45 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Urine{{{SINGLE-QUOTE}}}THEN 46 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.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 in ( "
|| " {{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}L/min{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Systolic BP - Radial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Diastolic BP - Radial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Systolic BP - Second Line{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Arterial Diastolic - Second Line{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby b wt gm ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby a wt lb ob NU{{{SINGLE-QUOTE}}} , "
|| " {{{SINGLE-QUOTE}}}AS deliv baby b wt lb ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby a wt oz ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby b wt oz ob NU{{{SINGLE-QUOTE}}} , "
|| " {{{SINGLE-QUOTE}}}SCH_Newborn Weight - grams{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Newborn Weight - lbs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Newborn Weight - oz{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Weight - lbs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Height in ft{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Height remainder in inches{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Height in cm{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_vs_Occipital-Frontal Head{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Current Weight{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Stool{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Urine{{{SINGLE-QUOTE}}} "
|| " ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}B1. Newborn Vital Signs{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}B2. Newborn Assessment/Intervention{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}1.Vital Signs - Basic{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}1.Vital Signs - Critical Care{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
|| " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
|| " update t2 set timstmp2 = {{{SINGLE-QUOTE}}}first weight{{{SINGLE-QUOTE}}}, name = {{{SINGLE-QUOTE}}}First Adult Weight - kg{{{SINGLE-QUOTE}}} from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq <> t2.sortseq and t2.name = {{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}} "
|| " delete from #tmp_aaa where timstmp2 is not null and timstmp2 <> {{{SINGLE-QUOTE}}}first weight{{{SINGLE-QUOTE}}} "
|| " "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// Process the First Group Data Elements (past 24 hours)
header1 :="\b Vital Signs in Past 24 Hours - Last Charted \b0\n\n";
formattedText1:= " ";
thisdatefield := " ";
yesterday:= now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := last (first i from obsNamesList);
// Reformat the Time Stamp
thisdatefield_unformatted := last (first i from highValuesList);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("farenheit","Heart Rate","Resp Rate","SCH_vs_pulse ox saturation","L/min",
"Noninvasive Diastolic BP","Noninvasive Systolic BP","Arterial Systolic BP - Radial","Arterial Diastolic BP - Radial",
"Arterial Systolic BP - Second Line","Arterial Diastolic - Second Line" )
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := last (first i from highValuesList);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> last (first i from highValuesList) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := last (first i from highValuesList);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "Heart Rate" then formattedText1 := formattedText1 || "\b HR:\b0 ";
elseif obsName = "Farenheit" then formattedText1 := formattedText1 || "\b T:\b0 ";
elseif obsName = "Noninvasive Systolic BP" then formattedText1 := formattedText1 || "\b BP:\b0 ";
elseif obsName = "Noninvasive Diastolic BP" then formattedText1 := formattedText1 || "/";
elseif obsName = "Arterial Systolic BP - Radial" then formattedText1 := formattedText1 || "\b ART BP:\b0 ";
elseif obsName = "Arterial Diastolic BP - Radial" then formattedText1 := formattedText1 || "/";
elseif obsName = "Arterial Systolic BP - Second Line" then formattedText1 := formattedText1 || "\b ART BP Second:\b0 ";
elseif obsName = "Arterial Diastolic - Second Line" then formattedText1 := formattedText1 || "/";
elseif obsName = "Resp Rate" then formattedText1 := formattedText1 || "\b R:\b0 ";
elseif obsName = "SCH_vs_pulse ox saturation" then formattedText1 := formattedText1 || "\b Pulse Ox:\b0 ";
elseif obsName = "L/min" then formattedText1 := formattedText1 || "\b O2 L/min:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || last (first i from lastValuesList);
endif; // Obsname amongst the Vital Signs observations
enddo;
formattedText1 := header1 || formattedText1;
// Process the Second Group Data Elements (Start of Chart)
header2 :="\n\n \b Additional Information - Last Charted \b0 \n\n";
formattedText2:= " ";
thisdatefield := " ";
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := last (first i from obsNamesList);
// Reformat the Time Stamp
thisdatefield_unformatted := last (first i from highValuesList);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the second group
if obsName in (
"AS deliv baby a wt gm ob NU" , "AS deliv baby b wt gm ob NU" , "AS deliv baby a wt lb ob NU" , "AS deliv baby b wt lb ob NU" , "AS deliv baby a wt oz ob NU" , "AS deliv baby b wt oz ob NU" ,
"SCH_Newborn Weight - grams","SCH_Newborn Weight - lbs","SCH_Newborn Weight - oz", "Weight - lbs","Weight - kg","First Adult Weight - kg","Height in ft" , "Height remainder in inches" , "Height in cm",
"SCH_vs_Occipital-Frontal Head", "Current Weight","SCH_io_newborn_diaper count - Stool" , "SCH_io_newborn_diaper count - Urine"
)
then
if thisdatefield = " " // first timestamp
then
thisdatefield := last (first i from highValuesList);
formattedText2 := thisdatefield_formatted;
endif;
if thisdatefield <> last (first i from highValuesList) // new timestamp
then
formattedText2 := formattedText2 || "\n" || thisdatefield_formatted;
thisdatefield := last (first i from highValuesList);
else
formattedText2 := formattedText2 || " " ;
endif;
if obsName = "SCH_io_newborn_diaper count - Stool" then formattedText2 := formattedText2 || "\b Stool Diaper:\b0 ";
elseif obsName = "SCH_io_newborn_diaper count - Urine" then formattedText2 := formattedText2 || "\b Urine Diaper:\b0 ";
elseif obsName = "SCH_vs_Occipital-Frontal Head" then formattedText2 := formattedText2 || "\b H.C./cm:\b0 ";
elseif obsName = "Height in cm" then formattedText2 := formattedText2 || "\b Ht/cm:\b0 ";
elseif obsName = "Height in ft" then formattedText2 := formattedText2 || "\b Ht/ft:\b0 ";
elseif obsName = "Height remainder in inches" then formattedText2 := formattedText2 || "-";
elseif obsName = "SCH_Newborn Weight - grams" then formattedText2 := formattedText2 || "\b Wt/gm:\b0 "; curwt:= last (first i from lastValuesList);
elseif obsName = "SCH_Newborn Weight - lbs" then formattedText2 := formattedText2 || "\b Wt/lb:\b0 ";
elseif obsName = "SCH_Newborn Weight - oz" then formattedText2 := formattedText2 || "-";
elseif obsName = "AS deliv baby a wt gm ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/gm:\b0 "; delwt:= last (first i from lastValuesList);
elseif obsName = "AS deliv baby b wt gm ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/gm:\b0 "; delwt:= last (first i from lastValuesList);
elseif obsName = "AS deliv baby a wt lb ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/lb:\b0 ";
elseif obsName = "AS deliv baby a wt oz ob NU" then formattedText2 := formattedText2 || "-";
elseif obsName = "AS deliv baby b wt lb ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/lb:\b0 ";
elseif obsName = "AS deliv baby b wt oz ob NU" then formattedText2 := formattedText2 || "-";
elseif obsName = "Weight - lbs" then formattedText2 := formattedText2 || "\b Wt/lb:\b0 ";
elseif obsName = "Weight - kg" then formattedText2 := formattedText2 || "\b Wt/kg:\b0 "; lastwt := last (first i from lastValuesList);
elseif obsName = "First Adult Weight - kg" then formattedText2 := formattedText2 || "\b First Wt/kg:\b0 "; firstwt:= last (first i from lastValuesList);
endif;
formattedText2 := formattedText2 || " ";
formattedText2 := formattedText2 || last (first i from lastValuesList);
endif; // Obsname amongst the Additional Information observations
enddo;
// Calculate the weight change
If exist delwt // Baby since birth weight
then
wtlabel := "Wt change since birth: \b0 ";
wtscale := " gm ";
wtchange := ((curwt as number) - (delwt as number)) formatted with " %.2f %";
wtchangepcnt := (((curwt as number) - (delwt as number))/(delwt as number) * 100) formatted with " %.2f %%";
else // Adult since first weighing
wtlabel := "Wt change since first weighing: \b0 ";
wtscale := " kg ";
wtchange := ((lastwt as number) - (firstwt as number)) formatted with " %.2f %";
wtchangepcnt := (((lastwt as number) - (firstwt as number)) /(firstwt as number) * 100) formatted with " %.2f %%";
endif;
If wtchange is not null
then
wtchange := " \n\n\b " || wtlabel || wtchange || wtscale || wtchangepcnt ;
else
wtchange := " ";
endif;
formattedText2 := header2 || formattedText2 || wtchange;
formattedTextAll:= formattedText1 || formattedText2;
endif; // Document Open
*/
// Write to the Structured Note Text Box
If formattedTextAll is not null
then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end: