Order Entry Order and Print Rules
  •  It is a good idea to avoid creating error messages that will not allow the user to file.
  • Warning messages are helpful, but error messages can create a lot of user frustration.
  • [f ord msg] = warning but user can continue
  • [f ord err msg] =user cannot continue
Order rule that gives error message and does not allow the user to continue.
Example:

"TOTAL THYROXINE is inactive, delete the TT4 procedure & enter TSH instead"^M,
IF{[f ord proc mne]="TT4" [f ord err msg](M);
[f ord ok]};
 

Order Message That Displays and allows the user to file
[f ord proc mne]="PC"^A,
   "Packed Cell (PC) order includes a group and screen"^M,
  IF{A [f ord msg](M);
  [f ord ok]};
 
Order Message Generated Based on Priority and Response to a Query

 [f ord pri]="R"^A,
 [q OE.LAB.CA]="Y"^B,
 "POST OP CALCIUM LEVELS MUST BE ORDERED AS PRI=S (PRIORITY STAT)"^M,
 IF{A&B [f ord err msg](M);[f ord ok]};
 

Order Rule Based on Ordering Physician

[f ord dr]="Cox,Terry              DR"^A,
[f ord dr]="Zor,Maria L.           DR"^B,
[f ord dr]="Bal,A                      DR"^C,
"TROPINE ORDERING IS RESTRICTED TO STUDY PHYSICIANS ONLY"^M,
IF{A!B!C [f ord ok];
[f ord err msg](M)};

;need to use the dr field as it appears in the dr dictionary
;dont use quotes around variables
;error message based on who the ordering dr is
 

Order Rule Based on Location and if the ordering doctor is the same as the attending doctor 
[f pt location]="CER"^A,
[f pt location]="FER"^B,
"edit the ordering physician"^M,
IF{[f ord dr mne]=[f pt admit dr mne]&(A!B) [f ord err msg](M);
[f ord ok]};

;rule to flag if the ordering physicians is the same as the attending
;physician at the location of FER
 

Order Message based on patients location
If the pt is registered to any of the three locations the order
cannot be placed else the order is OK:
 [f pt location]="LB3"^X,
   [f pt location]="LB4"^X1,
   [f pt location]="MHS-GORHAM"^X2,
   "Can not order. Test Cannot be done in Gorham."^M,
   IF{X!X1!X2 [f ord err msg](M);
   [f ord ok]};

 Howard Chase <hchase@nchin.org>

Print Rules
Print rule based on day and time

;This rule dictates during regular weekdays (Mon-Fri)  requisitions will print to CADM.PR01
;after 1515 and before 0730
[f day of week]="MON"^A,
[f day of week]="TUE"^B,
[f day of week]="WED"^C,
[f day of week]="THU"^D,
[f day of week]="FRI"^E,
[f now]<0730^F,
[f now]>1515^G,
[f ord tm]<0731^H,
[f ord tm]>1515^I,
IF{(A!B!C!D!E)&(H!I) [f do print];
[f do not print]};
 
 

Print Rule based on weekend printing
;rule to print to F OR K site anytime on Saturday or Sunday
[f day of week]="SAT"^A,
[f day of week]="SUN"^B,
IF{A!B [f do print];
[f do not print]};
 
Print Rule Based on Patients Location 
[f pt location]="C1C"^A,
[f pt location]="C2C"^B,
IF{A!B [f do print];
[f do not print]};
 
Print Rule Based on Patient's Location and Query Response
 [f pt location]="CA2"^A,
 [f pt location]="CA3"^B,
 [f pt location]="CPAT-A2"^C,
 [f pt location]="CPAT-CS"^D,
 [f pt location]="CACS"^E,
 ([q OE.SWREF])="HIPS"^F,
 IF{A!B!C!D!E!F [f do print];
 [f do not print]};
Print Rule Based on Ordering Priority

IF{[f ord pri]="S" [f do print];
[f do not print] };
 

Print Rule Based on Query Response
 IF{([q OE.CEA8])="Y" [f do print];[f do not print]};