source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORCMEDT1.m@ 1751

Last change on this file since 1751 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.5 KB
Line 
1ORCMEDT1 ;SLC/MKB-QO,Set editor ;11/6/01 13:33
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**8,46,57,95,110,245**;Dec 17, 1997;Build 2
3OI ; -- Enter/edit generic orderable items
4 N X,Y,DA,DR,DIE,DIC,ID,DLAYGO,ORDG
5 F S ORDG=$$DGRP Q:ORDG'>0 D W !!
6 . F S D="S."_$P(ORDG,U,4) D Q:Y'>0 S DA=+Y,ID=DA_";99ORD",DR=".01"_$S($P(Y,U,3):";2///^S X=ID;5////"_+ORDG,1:"") D ^DIE W ! ;110
7 .. S DIC="^ORD(101.43,",DIC(0)="AEQL",DLAYGO=101.43,DIE=DIC D IX^DIC ;110
8 Q
9 ;
10DGRP() ; -- Returns sub-display group of Nursing or Other for generic OI
11 N X,Y,DIC,ORGRP,ORDG,ORI
12 F ORI="NURS","OTHER" S ORDG=+$O(^ORD(100.98,"B",ORI,0)) D DG^ORCHANG1(ORDG,"BILD",.ORGRP)
13 S DIC="^ORD(100.98,",DIC(0)="AEQ",DIC("S")="I $D(ORGRP(+Y))"
14 S DIC("A")="Type of Orderable: " D ^DIC
15 S:Y>0 Y=+Y_U_$G(^ORD(100.98,+Y,0))
16 Q Y
17 ;
18QUICK ; -- Enter/edit quick order dialogs
19 N ORQDLG,ORDG
20 F S ORQDLG=$$DIALOG^ORCMEDT0("Q") Q:ORQDLG="^" D QCK0(ORQDLG) W !
21 Q
22QCK0(ORQDLG) ; -- edit quick order ORQDLG
23 N ORDIALOG,DA,DR,DIE,DIDEL,ORQUIT,ORVP,ORL,ACTION,FIRST,ORTYPE,ORNAME,X,Y,BEFORCRC,AFTERCRC
24 Q:'$G(ORQDLG) S DA=ORQDLG,(ORVP,ORL)=0,FIRST=1,ORTYPE="Z"
25 S ORNAME=$$NAME^ORCMEDT4(ORQDLG) Q:(ORNAME="@")!(ORNAME="^") ;deleted,^
26 S BEFORCRC=$$RAWCRC^ORCMEDT8(ORQDLG)
27 S DR=".01///^S X=ORNAME;2;8;20"_$S(DUZ(0)="@":";30",1:""),DIE="^ORD(101.41,"
28 D ^DIE G:$D(Y)!$D(DTOUT) QR D GETQDLG^ORCD(ORQDLG) G:'$G(ORDIALOG) QR
29 I '$P($G(^ORD(101.41,ORQDLG,0)),U,7) S X=+$P($G(^ORD(101.41,+ORDIALOG,0)),U,7) S:X $P(^ORD(101.41,ORQDLG,0),U,7)=X,^ORD(101.41,"APKG",X,ORQDLG)=""
30 W ! I $D(^ORD(101.41,+ORDIALOG,3.1)) X ^(3.1) G:$G(ORQUIT) QQ
31Q1 D DIALOG^ORCDLG G:$G(ORQUIT) QQ
32 D DISPLAY^ORCDLG S ACTION=$$OK G:ACTION="^" QQ
33 D:ACTION="P" SAVE^ORCMEDT0,AUTO(ORQDLG) I ACTION="E" S FIRST=0 G Q1 ;fall thru if "C"
34QQ X:$D(^ORD(101.41,+ORDIALOG,4)) ^(4)
35QR S AFTERCRC=$$RAWCRC^ORCMEDT8(ORQDLG)
36 I BEFORCRC'=AFTERCRC D UPDQNAME^ORCMEDT8(ORQDLG) ; Rename personal quick order if modified
37 Q
38 ;
39OK() ; -- Ready to save?
40 N X,Y,DIR S DIR(0)="SAM^P:PLACE;E:EDIT;C:CANCEL;",DIR("B")="PLACE"
41 S DIR("A")="(P)lace, (E)dit, or (C)ancel this quick order? "
42 S DIR("?")="Enter P to save this quick order, or E to change any of the displayed values; enter C to quit without saving these responses"
43 D ^DIR S:$D(DTOUT) Y="^"
44 Q Y
45 ;
46SAVE G SAVE^ORCMEDT0
47 ;
48AUTO(DLG) ; -- set AutoAccept flag for GUI
49 N X,Y,DIR
50 S DIR(0)="YA",DIR("A")="Auto-accept this order? "
51 S DIR("B")=$S($P($G(^ORD(101.41,+DLG,5)),U,8):"YES",1:"NO")
52 S DIR("?")="Enter YES if this order can be placed simply by selecting it, or NO if the dialog should be presented to complete the order."
53 D ^DIR S:Y=1!(Y=0) $P(^ORD(101.41,+DLG,5),U,8)=$S(Y:1,1:"")
54 I $P($G(^ORD(101.41,+DLG,0)),"^",8)'=1&($P($G(^(0)),"^",9)=2)&(Y) D EXPLAIN S $P(^ORD(101.41,+DLG,5),"^",8)="" ;Reset auto-accept to no if explanation required.
55 Q
56 ;
57SET ; -- Order Sets
58 N ORSET,ORDG
59 F S ORSET=$$DIALOG^ORCMEDT0("O") Q:ORSET="^" D SET0(ORSET) W !
60 Q
61SET0(ORSET) ; -- edit order set ORSET
62 N DA,DR,DIE,DIC,DIK,X,Y,SEQ,ITM,LCNT,QUIT,ORNAME Q:'$G(ORSET)
63 S ORNAME=$$NAME^ORCMEDT4(ORSET) Q:(ORNAME="@")!(ORNAME="^") ;deleted,^
64 S DR=".01///^S X=ORNAME;2;20"_$S(DUZ(0)="@":";30;40",1:""),DA=ORSET
65 S DIE="^ORD(101.41," D ^DIE Q:$D(Y) Q:'$G(DA)
66S1 I $O(^ORD(101.41,+ORSET,10,0)) D Q:QUIT ;Show existing components
67 . W !,"ORDER SET COMPONENTS:" S (SEQ,LCNT,QUIT)=0
68 . S DIK="^ORD(101.41,"_+ORSET_",10,",DA(1)=+ORSET ;just in case
69 . F S SEQ=$O(^ORD(101.41,+ORSET,10,"B",SEQ)) Q:SEQ'>0 D
70 . . S DA=0 F S DA=$O(^ORD(101.41,+ORSET,10,"B",SEQ,DA)) Q:DA'>0 D
71 . . . S ITM=$P($G(^ORD(101.41,+ORSET,10,DA,0)),U,2) I ITM'>0 D ^DIK Q
72 . . . S LCNT=LCNT+1 I LCNT>(IOSL-3) R !,"Press <return> to continue ...",X:DTIME S LCNT=0 I X["^" S QUIT=1 Q
73 . . . W !?3,SEQ,?10,$P(^ORD(101.41,ITM,0),U)
74S2 S QUIT=0 F D Q:QUIT W ! ;Enter/edit components
75 . S DIC="^ORD(101.41,"_+ORSET_",10,",DIC(0)="AEQLM",D="B^D"
76 . S DIC("A")="Select COMPONENT SEQUENCE#: ",DIC("P")=$P(^DD(101.41,10,0),U,2)
77 . K DA S DA(1)=+ORSET D MIX^DIC1 I Y'>0 S QUIT=1 Q
78 . S DA=+Y,DIE=DIC,DR=".01;2R" D ^DIE Q:'$G(DA)
79 . I $D(^ORD(101.41,+ORSET,10,DA,0)),'$P(^(0),U,2) S DIK=DIE D ^DIK
80 Q
81 ;
82PROTOCOL ; -- Convert additional protocols to dialogs
83 N X,Y,DIC,ORERR
84 F S DIC="^ORD(101,",DIC(0)="AEQM" D ^DIC Q:Y'>0 D W !
85 . S ORP=+Y,ORM=$$MENU Q:ORM="^" ; What about "^^"-jumping? (ORWARD)
86 . W !,"Converting ..." D ONE(ORP,ORM,.ORERR) I '$G(ORERR) W " done." Q
87 . W " unable to convert.",!,">> "_$P(ORERR,U,2) K ORERR
88 Q
89ONE(PITEM,ORADD,ERROR) ; -- Convert single item protocol, add to menu(s)
90 N PMENU,DMENU,NAME,ORPOS,POS,XUTL,DA,DIK
91 I $D(^ORD(100.99,1,101.41,PITEM,0)) S DA=PITEM,DA(1)=1,DIK="^ORD(100.99,1,101.41," D ^DIK ; delete error entry
92 S NAME=$P($G(^ORD(101,PITEM,0)),U),DITEM=$$ITEM^ORCONVRT(PITEM)
93 I 'DITEM!$D(^ORD(100.99,1,101.41,PITEM,0)) S ERROR=$G(^(0)) Q
94 Q:'$G(ORADD) ;to add, may enter here with PITEM & DITEM defined
95ADD S PMENU=0 F S PMENU=$O(^ORD(101,"AD",PITEM,PMENU)) Q:PMENU'>0 D W "."
96 . S DMENU=$O(^ORD(101.41,"AB",$P(^ORD(101,PMENU,0),U),0)) Q:'DMENU
97 . S ORPOS=$$FINDXUTL(PMENU,PITEM) Q:'ORPOS
98 . S XUTL=$G(^XUTL("XQORM",PMENU_";ORD(101,",ORPOS,0))
99 . S DA=$O(^ORD(101.41,DMENU,10,"B",ORPOS,0)) I DA Q:$P(^ORD(101.41,DMENU,10,DA,0),U,2)=DITEM S POS=$O(^ORD(101.41,DMENU,10,"B",""),-1),ORPOS=($P(POS,".")+1)_".1",DA="" ; move to end, if collision
100 . S DA=$$NEXT^ORCONVRT(DMENU)
101 . S ^ORD(101.41,DMENU,10,DA,0)=ORPOS_U_DITEM_U_$P(XUTL,U,4)_U_$S($P(XUTL,U,3)'=$P(^ORD(101.41,DITEM,0),U,2):$P(XUTL,U,3),1:"")
102 . S ^ORD(101.41,DMENU,10,"B",ORPOS,DA)="",^ORD(101.41,DMENU,10,"D",DITEM,DA)=""
103 . S ^ORD(101.41,"AD",DITEM,DMENU,DA)="",^ORD(101.41,DMENU,99)=$H
104 Q
105 ;
106FINDXUTL(MENU,ITEM) ; -- Returns position of ITEM in MENU
107 N XQORM,POS
108 S XQORM=MENU_";ORD(101," D XREF^XQORM
109 S POS=0 F S POS=$O(^XUTL("XQORM",XQORM,POS)) Q:POS'>0 I $P(^(POS,0),U,2)=ITEM Q
110 Q POS
111 ;
112MENU() ; -- Add converted item to menus?
113 N X,Y,DIR S DIR(0)="YA"
114 S DIR("A")="Add this item to the same menus again? ",DIR("B")="YES"
115 S DIR("?")="Enter YES to have this item placed on the same menus in the Order Dialog file as it was in the Protocol file"
116 D ^DIR S:$D(DTOUT) Y="^"
117 Q Y
118EXPLAIN ;Give reason why user can't set auto-accept to yes
119 W !!,"The combination of VERIFY set to NO and ASK FOR ANOTHER ORDER set to",!,"YES, DON'T ASK and AUTO-ACCEPT set to YES is not allowed."
120 W !!,"This combination of settings could cause CPRS to enter into an infinite loop",!,"creating the same order over and over. If you wish to have"
121 W !,"AUTO-ACCEPT set to YES you must change one of the other two fields",!,"to a different value.",!!,"AUTO-ACCEPT is being set to NO for you."
122 Q
Note: See TracBrowser for help on using the repository browser.