516 lines
30 KiB
Plaintext
516 lines
30 KiB
Plaintext
maintenance:
|
|
|
|
title: Vital Signs - Highs and Lows;;
|
|
mlmname: DOC_FUNC_VS_24hrs;;
|
|
arden: version 4.5;;
|
|
version: 2.00;;
|
|
institution: St.Clair Hospital;;
|
|
author: Don Warnick;;
|
|
specialist: ;;
|
|
date: 2010-02-02;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose:
|
|
;;
|
|
explanation:
|
|
Change history
|
|
|
|
02.02.2010 DW Copied from Jacob{{{SINGLE-QUOTE}}}s Springhill MLM stored here under the name DOC_SMC_FUNC_DOC_SMC_VITAL_SIGNS_HIGHS_AND_LOWS_Springhill
|
|
08.18.2014 DW CSR# 32616 Add Newborn & Critical Care values to the Vital Signs Section (re-introduced this MLM & commented out VS section of DOC_ST_Clair_MAIN_PN_MLM)
|
|
09.04.2014 DW CSR# 32175 Add Button for Ortostatic Vital Signs
|
|
09.26.2014 DW HD# 1491452 Round the "Weight Change" value for newborn and adult to 2 digits
|
|
04.18.2015 GOS CSR#33155 Added 3 orthostatic BP Heart Rate [supine, Sitting, Standing] observations in existing query
|
|
10.27.2015 GOS CSR#33428 Added 2 Lbs weight changes observations And Showing Lbs Weight in Vital Sign on SN opening.
|
|
09.08.2016 DW HD# 2316157 - Orthostatic BP not pulling into the EPN - Had to first copy Prod version to Dev as they were very different. Added a dash to the observation name.
|
|
|
|
;;
|
|
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}}}Supine Systolic BP{{{SINGLE-QUOTE}}} THEN 01 "
|
|
|| " WHEN Name = {{{SINGLE-QUOTE}}}Supine Diastolic BP{{{SINGLE-QUOTE}}} THEN 02 "
|
|
|| " WHEN Name = {{{SINGLE-QUOTE}}}Sitting Systolic BP{{{SINGLE-QUOTE}}} THEN 04 "
|
|
|| " WHEN Name = {{{SINGLE-QUOTE}}}Sitting Diastolic BP{{{SINGLE-QUOTE}}} THEN 05 "
|
|
|| " WHEN Name = {{{SINGLE-QUOTE}}}Standing Systolic BP{{{SINGLE-QUOTE}}} THEN 07 "
|
|
|| " WHEN Name = {{{SINGLE-QUOTE}}}Standing Diastolic BP{{{SINGLE-QUOTE}}} THEN 08 "
|
|
|| " WHEN Name = {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - supine{{{SINGLE-QUOTE}}} THEN 03 "
|
|
|| " WHEN Name = {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - sitting{{{SINGLE-QUOTE}}} THEN 06 "
|
|
|| " WHEN Name = {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - standing{{{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}}}Supine Systolic BP{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Supine Diastolic BP{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Sitting Systolic BP{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Sitting Diastolic BP{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Standing Systolic BP{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Standing Diastolic BP{{{SINGLE-QUOTE}}}, "
|
|
|| " {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - supine{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - sitting{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - standing{{{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 "
|
|
|| " delete from #tmp_aaa where timstmp2 is not null "
|
|
|| " "
|
|
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|
|
|| " drop table #tmp_aaa "
|
|
};
|
|
|
|
header1 :="\n\n\b Orthostatic 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 ("Supine Systolic BP" , "Supine Diastolic BP" , "Sitting Systolic BP" , "Sitting Diastolic BP" , "Standing Systolic BP" , "Standing Diastolic BP","sch_orthostatic heart rate - supine",
|
|
"sch_orthostatic heart rate - sitting","sch_orthostatic heart rate - standing" )
|
|
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 = "Supine Systolic BP" then formattedText1 := formattedText1 || "\b Supine BP:\b0 ";
|
|
elseif obsName = "Supine Diastolic BP" then formattedText1 := formattedText1 || "/";
|
|
elseif obsName = "Sitting Systolic BP" then formattedText1 := formattedText1 || "\b Sitting BP:\b0 ";
|
|
elseif obsName = "Sitting Diastolic BP" then formattedText1 := formattedText1 || "/";
|
|
elseif obsName = "Standing Systolic BP" then formattedText1 := formattedText1 || "\b Standing BP:\b0 ";
|
|
elseif obsName = "Standing Diastolic BP" then formattedText1 := formattedText1 || "/";
|
|
elseif obsName = "sch_orthostatic heart rate - supine" then formattedText1 := formattedText1 || "\b Supine HR:\b0 ";
|
|
elseif obsName = "sch_orthostatic heart rate - sitting" then formattedText1 := formattedText1 || "\b Sitting HR:\b0 ";
|
|
elseif obsName = "sch_orthostatic heart rate - standing" then formattedText1 := formattedText1 || "\b Standing HR:\b0 ";
|
|
endif;
|
|
|
|
formattedText1 := formattedText1 || " ";
|
|
formattedText1 := formattedText1 || last (first i from lastValuesList);
|
|
|
|
endif; // Obsname amongst the Vital Signs observations
|
|
|
|
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
|
|
|
|
|
|
|
|
(OccCode, userName) := read last {" select OccupationCode, IDCode from CV3USER with (nolock) where guid = " || sql(thisDocumentCommunication.UserGUID) };
|
|
// IF ( OccCode = "IT" AND userName = "jlaw" ) then
|
|
// break;
|
|
// endif;
|
|
|
|
// 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}}} "
|
|
|| " update t2 set timstmp2 = {{{SINGLE-QUOTE}}}first weight lbs{{{SINGLE-QUOTE}}}, name = {{{SINGLE-QUOTE}}}First Adult Weight - lbs{{{SINGLE-QUOTE}}} from #tmp_aaa t1 " // Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq <> t2.sortseq and t2.name = {{{SINGLE-QUOTE}}}Weight - lbs{{{SINGLE-QUOTE}}} " // Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
|| " delete from #tmp_aaa where timstmp2 is not null and timstmp2 <> {{{SINGLE-QUOTE}}}first weight{{{SINGLE-QUOTE}}} And timstmp2 <> {{{SINGLE-QUOTE}}}first weight lbs{{{SINGLE-QUOTE}}} " // Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
|| " "
|
|
|| " 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);
|
|
elseif obsName = "First Adult Weight - lbs" then formattedText2 := formattedText2 || "\b First Wt/lb:\b0 "; // Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
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 ";
|
|
wtscalelbs := " lbs "; // Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
wtchange := ((curwt as number) - (delwt as number)) formatted with " %.2f %";
|
|
wtchangepcnt := (((curwt as number) - (delwt as number))/(delwt as number) * 100) formatted with " %.2f %%";
|
|
//Start: Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
Calc := (wtchange as number) * ("0.00220462" as number) ;
|
|
If Calc Is Not Null Then
|
|
WtChangeLbs := Read first{" Select Format( " || Calc || " , {{{SINGLE-QUOTE}}}00.00{{{SINGLE-QUOTE}}}) " } ;
|
|
// End : Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
Endif;
|
|
|
|
else // Adult since first weighing
|
|
|
|
wtlabel := "Wt change since first weighing: \b0 ";
|
|
wtscale := " kg ";
|
|
wtscalelbs := " lbs "; // Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
wtchange := ((lastwt as number) - (firstwt as number)) formatted with " %.2f %";
|
|
wtchangepcnt := (((lastwt as number) - (firstwt as number)) /(firstwt as number) * 100) formatted with " %.2f %%";
|
|
//Start: Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
Calc := (wtchange as number) * ("2.20462" as number) ;
|
|
If Calc Is Not Null Then
|
|
WtChangeLbs := Read first{" Select Format( " || Calc || " , {{{SINGLE-QUOTE}}}00.00{{{SINGLE-QUOTE}}}) " } ;
|
|
Endif;
|
|
// End : Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
|
|
endif;
|
|
|
|
|
|
If wtchange is not null
|
|
then
|
|
//wtchange := " \n\n\b " || wtlabel || wtchange || wtscale || wtchangepcnt ;
|
|
wtchange := " \n\n\b " || wtlabel || WtChangeLbs || wtscalelbs || wtchange || wtscale || wtchangepcnt ; // Added By Shivprasad for CSR:33428 on 27 Oct 2015
|
|
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:
|