Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ORCMEDT1

ORCMEDT1.m

Go to the documentation of this file.
  1. ORCMEDT1 ;SLC/MKB-QO,Set editor ;02/25/08
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**8,46,57,95,110,245,243,296**;Dec 17, 1997;Build 19
  1. OI ; -- Enter/edit generic orderable items
  1. N X,Y,DA,DR,DIE,DIC,ID,DLAYGO,ORDG
  1. F S ORDG=$$DGRP Q:ORDG'>0 D W !!
  1. . 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
  1. .. S DIC="^ORD(101.43,",DIC(0)="AEQL",DLAYGO=101.43,DIE=DIC D IX^DIC ;110
  1. Q
  1. ;
  1. DGRP() ; -- Returns sub-display group of Nursing or Other for generic OI
  1. N X,Y,DIC,ORGRP,ORDG,ORI
  1. F ORI="NURS","OTHER" S ORDG=+$O(^ORD(100.98,"B",ORI,0)) D DG^ORCHANG1(ORDG,"BILD",.ORGRP)
  1. S DIC="^ORD(100.98,",DIC(0)="AEQ",DIC("S")="I $D(ORGRP(+Y))"
  1. S DIC("A")="Type of Orderable: " D ^DIC
  1. S:Y>0 Y=+Y_U_$G(^ORD(100.98,+Y,0))
  1. Q Y
  1. ;
  1. QUICK ; -- Enter/edit quick order dialogs
  1. N ORQDLG,ORDG
  1. F S ORQDLG=$$DIALOG^ORCMEDT0("Q") Q:ORQDLG="^" D QCK0(ORQDLG) W !
  1. Q
  1. QCK0(ORQDLG) ; -- edit quick order ORQDLG
  1. N ORDIALOG,DA,DR,DIE,DIDEL,ORQUIT,ORVP,ORL,ACTION,FIRST,ORTYPE,ORNAME,X,Y,BEFORCRC,AFTERCRC
  1. Q:'$G(ORQDLG) S DA=ORQDLG,(ORVP,ORL)=0,FIRST=1,ORTYPE="Z"
  1. S ORNAME=$$NAME^ORCMEDT4(ORQDLG) Q:(ORNAME="@")!(ORNAME="^") ;deleted,^
  1. S BEFORCRC=$$RAWCRC^ORCMEDT8(ORQDLG)
  1. S DR=".01///^S X=ORNAME;2;8;20"_$S(DUZ(0)="@":";30",1:""),DIE="^ORD(101.41,"
  1. D ^DIE G:$D(Y)!$D(DTOUT) QR D GETQDLG^ORCD(ORQDLG) G:'$G(ORDIALOG) QR
  1. 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)=""
  1. W ! I $D(^ORD(101.41,+ORDIALOG,3.1)) X ^(3.1) G:$G(ORQUIT) QQ
  1. Q1 D DIALOG^ORCDLG G:$G(ORQUIT) QQ
  1. D DISPLAY^ORCDLG S ACTION=$$OK G:ACTION="^" QQ
  1. D:ACTION="P" SAVE^ORCMEDT0,AUTO(ORQDLG) I ACTION="E" S FIRST=0 G Q1 ;fall thru if "C"
  1. QQ X:$D(^ORD(101.41,+ORDIALOG,4)) ^(4)
  1. QR S AFTERCRC=$$RAWCRC^ORCMEDT8(ORQDLG)
  1. I BEFORCRC'=AFTERCRC D UPDQNAME^ORCMEDT8(ORQDLG) ; Rename personal quick order if modified
  1. Q
  1. ;
  1. OK() ; -- Ready to save?
  1. N X,Y,DIR S DIR(0)="SAM^P:PLACE;E:EDIT;C:CANCEL;",DIR("B")="PLACE"
  1. S DIR("A")="(P)lace, (E)dit, or (C)ancel this quick order? "
  1. 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"
  1. D ^DIR S:$D(DTOUT) Y="^"
  1. Q Y
  1. ;
  1. SAVE G SAVE^ORCMEDT0
  1. ;
  1. AUTO(DLG) ; -- set AutoAccept flag for GUI
  1. N X,Y,DIR
  1. I $$VBQO^ORWDXM4(+DLG)=0 S $P(^ORD(101.41,+DLG,5),U,8)="" Q
  1. I $$VALQO^ORWDXM3(+DLG)=0 S $P(^ORD(101.41,+DLG,5),U,8)="" Q
  1. S DIR(0)="YA",DIR("A")="Auto-accept this order? "
  1. S DIR("B")=$S($P($G(^ORD(101.41,+DLG,5)),U,8):"YES",1:"NO")
  1. 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."
  1. D ^DIR S:Y=1!(Y=0) $P(^ORD(101.41,+DLG,5),U,8)=$S(Y:1,1:"")
  1. 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.
  1. Q
  1. ;
  1. SET ; -- Order Sets
  1. N ORSET,ORDG
  1. F S ORSET=$$DIALOG^ORCMEDT0("O") Q:ORSET="^" D SET0(ORSET) W !
  1. Q
  1. SET0(ORSET) ; -- edit order set ORSET
  1. N DA,DR,DIE,DIC,DIK,X,Y,SEQ,ITM,LCNT,QUIT,ORNAME Q:'$G(ORSET)
  1. S ORNAME=$$NAME^ORCMEDT4(ORSET) Q:(ORNAME="@")!(ORNAME="^") ;deleted,^
  1. S DR=".01///^S X=ORNAME;2;20"_$S(DUZ(0)="@":";30;40",1:""),DA=ORSET
  1. S DIE="^ORD(101.41," D ^DIE Q:$D(Y) Q:'$G(DA)
  1. S1 I $O(^ORD(101.41,+ORSET,10,0)) D Q:QUIT ;Show existing components
  1. . W !,"ORDER SET COMPONENTS:" S (SEQ,LCNT,QUIT)=0
  1. . S DIK="^ORD(101.41,"_+ORSET_",10,",DA(1)=+ORSET ;just in case
  1. . F S SEQ=$O(^ORD(101.41,+ORSET,10,"B",SEQ)) Q:SEQ'>0 D
  1. . . S DA=0 F S DA=$O(^ORD(101.41,+ORSET,10,"B",SEQ,DA)) Q:DA'>0 D
  1. . . . S ITM=$P($G(^ORD(101.41,+ORSET,10,DA,0)),U,2) I ITM'>0 D ^DIK Q
  1. . . . S LCNT=LCNT+1 I LCNT>(IOSL-3) R !,"Press <return> to continue ...",X:DTIME S LCNT=0 I X["^" S QUIT=1 Q
  1. . . . W !?3,SEQ,?10,$P(^ORD(101.41,ITM,0),U)
  1. S2 S QUIT=0 F D Q:QUIT W ! ;Enter/edit components
  1. . S DIC="^ORD(101.41,"_+ORSET_",10,",DIC(0)="AEQLM",D="B^D"
  1. . S DIC("A")="Select COMPONENT SEQUENCE#: ",DIC("P")=$P(^DD(101.41,10,0),U,2)
  1. . K DA S DA(1)=+ORSET D MIX^DIC1 I Y'>0 S QUIT=1 Q
  1. . S DA=+Y,DIE=DIC,DR=".01;2R" D ^DIE Q:'$G(DA)
  1. . I $D(^ORD(101.41,+ORSET,10,DA,0)),'$P(^(0),U,2) S DIK=DIE D ^DIK
  1. Q
  1. ;
  1. PROTOCOL ; -- Convert additional protocols to dialogs
  1. N X,Y,DIC,ORERR
  1. F S DIC="^ORD(101,",DIC(0)="AEQM" D ^DIC Q:Y'>0 D W !
  1. . S ORP=+Y,ORM=$$MENU Q:ORM="^" ; What about "^^"-jumping? (ORWARD)
  1. . W !,"Converting ..." D ONE(ORP,ORM,.ORERR) I '$G(ORERR) W " done." Q
  1. . W " unable to convert.",!,">> "_$P(ORERR,U,2) K ORERR
  1. Q
  1. ONE(PITEM,ORADD,ERROR) ; -- Convert single item protocol, add to menu(s)
  1. N PMENU,DMENU,NAME,ORPOS,POS,XUTL,DA,DIK
  1. 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
  1. S NAME=$P($G(^ORD(101,PITEM,0)),U),DITEM=$$ITEM^ORCONVRT(PITEM)
  1. I 'DITEM!$D(^ORD(100.99,1,101.41,PITEM,0)) S ERROR=$G(^(0)) Q
  1. Q:'$G(ORADD) ;to add, may enter here with PITEM & DITEM defined
  1. ADD S PMENU=0 F S PMENU=$O(^ORD(101,"AD",PITEM,PMENU)) Q:PMENU'>0 D W "."
  1. . S DMENU=$O(^ORD(101.41,"AB",$P(^ORD(101,PMENU,0),U),0)) Q:'DMENU
  1. . S ORPOS=$$FINDXUTL(PMENU,PITEM) Q:'ORPOS
  1. . S XUTL=$G(^XUTL("XQORM",PMENU_";ORD(101,",ORPOS,0))
  1. . 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
  1. . S DA=$$NEXT^ORCONVRT(DMENU)
  1. . 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:"")
  1. . S ^ORD(101.41,DMENU,10,"B",ORPOS,DA)="",^ORD(101.41,DMENU,10,"D",DITEM,DA)=""
  1. . S ^ORD(101.41,"AD",DITEM,DMENU,DA)="",^ORD(101.41,DMENU,99)=$H
  1. Q
  1. ;
  1. FINDXUTL(MENU,ITEM) ; -- Returns position of ITEM in MENU
  1. N XQORM,POS
  1. S XQORM=MENU_";ORD(101," D XREF^XQORM
  1. S POS=0 F S POS=$O(^XUTL("XQORM",XQORM,POS)) Q:POS'>0 I $P(^(POS,0),U,2)=ITEM Q
  1. Q POS
  1. ;
  1. N X,Y,DIR S DIR(0)="YA"
  1. S DIR("A")="Add this item to the same menus again? ",DIR("B")="YES"
  1. 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"
  1. D ^DIR S:$D(DTOUT) Y="^"
  1. Q Y
  1. EXPLAIN ;Give reason why user can't set auto-accept to yes
  1. 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."
  1. 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"
  1. 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."
  1. Q