Disclaimer: Use of the following attributes is done at the sole discretion of the user. Iatric Systems is not responsible for any problems arising from the use of this code. All code should be implemented and tested thoroughly in a TEST environment before moving LIVE.
CDS Basics
- Position the cursor……………………P(R,S)^#
- When to default in information:
Always ……………………………….Data^/[ANS%0,CD]|0
If Blank……………………………….IF{/[ANS%0,CD];Data}^/[ANS%0,CD]|0 - Update the screen……………………/[ANS%0,CD]|0^#
- Allow data entry using IFE……………1 or “”
- @t.fields……………………………..Temporary fields, pulls from / file
- @p.fields……………………………..Permanent fields, pulls from disk
Creating default answers
Example #1 – Default Y/N if attending doctor is same as primary care doctor.
Admitting Screens
MIS Attribute
Example #2 – Default reason for visit into OE reason for procedure.
In this case, via the short form registration, the comments are the reason for visit.
In OE, the test is ordered and the ADM comments default into the reason for procedure.
The attribute checks first for a reason for visit, and if not available, the comments are taken to ensure this works with all types of registrations, short and full.
Example #3
Setup default answer via a fragment call to another module
In this example we set up a query to appear on the CBC ordering screen in OE that will show the total patient charges (so far) that have passed to B/AR. Obviously, this would work better with inpatients that have more than a one day los.
The BAR fragment can quickly find the patient’s file via the acct number index.
On page 3, we pull the total charges in an AL D footnote.
Charges are pulled into field for display mostly. With the value of the IFE set to nil, users won’t be allowed to edit the field.
Calling An NPR Report From An Attribute
In this example, we added a query to our CBC screen to allow the ordering user to generate a re-print of the Admitting form.
The output was sent to VIEW, like an ordinary NPR report run from a menu.
To print the report, we pass control to a macro residing in our macro library.
;————————————————————————————
;Macro loads appropriate / variables and calls Admissions form
;————————————————————————————
@SETUP.PATIENT,
@SETUP.PROGRAM,
@GET.ADM.DATABASE,
@OPEN.TO.ADM.AND.KEEP.SLASH,
@CALL.PROGRAM,
@RESTORE.PREFIXES,
@SEG.BACK,
END;
;————————————————————————————-
SETUP.PATIENT
A^/[“urn”]
SETUP.PROGRAM
“ADM.PAT.zcus.adm.form4″^/PR,
“%”_/PR_”.S(“_D(34)_/PR_”.R”_D(34)_”,”_D(34)_0_D(34)_”)”^/PR
GET.ADM.DATABASE
/.FAC^MIS.FACILITY.mnemonic,
“ADM”^MIS.FACILITY.database,
@Next(MIS.FACILITY.database),
MIS.FACILITY.database^/ADM.DB
OPEN.TO.ADM.AND.KEEP.SLASH
“SEGS”^MEW
$[MEW](@MIS.APPL.database.segment[/ADM.DB],@MIS.APPL.database.directory[/ADM.DB]),
CL(S,*S,?S,:S,&S),
ZZ%OP(!S,”P”),MOVE(/,!),ZZ%OP(/S,”P”),MOVE(!,/),CL(!U)
CALL.PROGRAM
%Z.sign.on.direct(/.MIS,/ADM.DB,””,/.USR,/PR,.,1)X
RESTORE.PREFIXES
CL(U,*U,?U,:U,&U,/U)
SEG.BACK
CL($U,%U)
“Pop up” Messages via Attributes
First for the attribute:
Again, we call a macro in our library:
;————————————————————————————
;Macro checks to see if any messages need to be ‘popped’ up to the ordering user
;based on the patient’s blood pressure
;————————————————————————————
@INITIALIZE,
IF{SP<90 @SYSTOLIC.TOO.LOW}, IF{DP>90 @DIASTOLIC.TOO.HIGH},
END;
;————————————————————————————-
INITIALIZE
A#”0/”^SP,
A#”1/”^DP
SYSTOLIC.TOO.LOW
@INITIALIZE.MSG,
“Systolic Pressure is Low”^/BP.MSG[1],
“Check With Patient for History”^/BP.MSG[2],
@DISPLAY.MSG
DIASTOLIC.TOO.HIGH
@INITIALIZE.MSG,
“Diastolic Pressure is Elevated”^/BP.MSG[1],
“Check With Patient for History”^/BP.MSG[2],
@DISPLAY.MSG
INITIALIZE.MSG
“”^MSG,
DO{+/BP.MSG[MSG]^MSG “”^/BP.MSG[MSG]}
DISPLAY.MSG
@Bell(“”)^#,
@Window.centered(8,50,3)^#,
“!! WARNING !!”:50C^#,
N(D(4,0))^#,
N(“”)^#,
DO{+/BP.MSG[MSG]^MSG N(/BP.MSG[MSG]:50C)^#},
NN(D(4,0))^#,
N(“Press << ENTER >>”:50C)^#,
#0,
@Window.close(“”)^#
Message #1:
Message #2:
Adding field level security
Example #1 – Control Enter/Edit access to a particular field.
In this example, we set up an attribute to determine whether or not a user has access to edit a particular field. We set up a custom field in MIS pertaining to allergies.
In the attribute, we check the custom field:
If the user has access, the cursor will stop at that query, otherwise, it will simply skip over it.
Example #2 – Control viewing of response to a customer-defined field.
For this example, we will use the same MIS query to control the access as in the previous example. In this example, we need to erase the query IAT.CONF, if the user doesn’t have access, when the screen displays (in the first query on the screen ADMDRSTR).
The macro being called is again stored in our macro library:
;——————————————————————————–
;Macro will nill out a particular query based on the row, col, and field length
;Query is passed in as argument A
;——————————————————————————–
@INITIALIZE,
@GET.ROW.COL.LEN,
@ADJUST.VALS,
@ZAP.QUERY,
END;
;——————————————————————————–
INITIALIZE
A^MIS.QUERY.mnemonic,
/CDS^MIS.SCREEN.mnemonic,
“”^/ROW^/COL^/LEN
GET.ROW.COL.LEN
IF{@MIS.SCREEN.resp.row’=”SAME”;
@MIS.SCREEN.query.row}^/ROW,
@MIS.SCREEN.resp.col^/COL,
IF{@MIS.SCREEN.resp.len;
@MIS.QUERY.length}^/LEN
ADJUST.VALS
/ROW+3^/ROW,
/COL-1^/COL
ZAP.QUERY
P(/ROW,/COL,” “:/LEN)^#
Obviously, control from example 1 should be added so that in addition to not viewing a field, we don’t give restricted users access to Enter/Edit the field as well.
With restricted user (Frank) the field confidential information is not viewable.
With non-restricted user (Joel) the field is viewable.
One Extra Trick: Double Click Hot Key
What to enter on the menu:
Macro:
Age Related Z Programs
Z.age
Arguments: A = birthdate YYYYMMDD
B = base date YYYYMMDD Optional, uses @.today otherwise
Returns: Age in years, months days, according to the following scheme:
Under 1 year
nM dD
Under 5 years
nY mM
5 or over
nn
Example call: %Z.age(@birthdate,@.today) returns age
%Z.age(19560315,20000421) returns 44
Notes:
MEDITECH age fields are stored in this format. @ADM.PAT.age for example. Do not compare ages stored in the format with > and < because the ASCII value does not always correspond to the age. Reformat the age with %Z.age.with.years, Z.age.format.strip or Z.age.in.years if you need to do comparisons.
Z.age.ck
Arguments: A = age in Z.age format
B = not nil if “weeks gestational age” allowed
Returns: Users input if valid, nil if not valid.
Example call: %Z.age.ck(@age) returns @age
%Z.age.ck(“4Y 11M”) returns “4Y 11M”
%Z.age.ck(“6Y 11M”) returns “” (bad format)
Z.age.format
Arguments: A = age in standard MEDITECH age format
Returns: Age formatted as below, allowing comparisons
returns either nn (years if nn>5)
; nY mmM (if n’=0)
; 0Y mmM ddD
; 0Y 00M 000D ggWG (weeks gestational)
Example call %Z.age.format(@age) returns nY mmM
%Z.age.format(“1M 22D”) returns “0Y 01M 22D”