1 | PSONDCUT ;BIRM/MFR - NDC Utilities ;10/15/04
|
---|
2 | ;;7.0;OUTPATIENT PHARMACY;**148**;DEC 1997
|
---|
3 | ;Reference to $$ECMEON^BPSUTIL supported by DBIA 4410
|
---|
4 | ;References to $$GETNDC^PSSNDCUT,$$NDCFMT^PSSNDCUT,SAVNDC^PSSNDCUT supported by IA 4707
|
---|
5 | ;
|
---|
6 | CHGNDC(RX,RFL,BCODE) ; Prompt for NDC code during Rx Release for HIPAA/NCPDP project
|
---|
7 | ;Input: (r) RX - Rx IEN (#52)
|
---|
8 | ; (o) RFL - Refill Number (#52.1)
|
---|
9 | ; (o) BCODE - Displays PID: 999-99-9999/MED: XXXXX XXXXXXXXXXX 999MG in the NDC prompt (1-YES/0-NO)
|
---|
10 | ;
|
---|
11 | ;Output: (r) NDCCHG - NDC was changed? (1-YES/0-NO)^New NDC number
|
---|
12 | ; OR "^" if no valid NDC or "^" entered
|
---|
13 | ;
|
---|
14 | N PSONDC,NEWNDC,SITE
|
---|
15 | I '$D(RFL) S RFL=$$LSTRFL^PSOBPSU1(RX)
|
---|
16 | S SITE=$$RXSITE^PSOBPSUT(RX,RFL) I '$$ECMEON^BPSUTIL(SITE) Q "^" ; ECME is not turned ON for the Rx's Division
|
---|
17 | ;
|
---|
18 | ; - Retrieving Rx NDC and Fill Date
|
---|
19 | S PSONDC=$$GETNDC(RX,RFL)
|
---|
20 | ;
|
---|
21 | ; - Prompts for NDC number
|
---|
22 | I $G(BCODE) F I=1:1:5 W $C(7)
|
---|
23 | S NEWNDC=PSONDC D NDCEDT(RX,RFL,,SITE,.NEWNDC,$G(BCODE)) I NEWNDC="^"!(NEWNDC="") Q "^"
|
---|
24 | ;
|
---|
25 | ; - If NDC changed, resubmit to ECME and save new NDC in the DRUG and PRESCRIPTION files
|
---|
26 | I PSONDC'=NEWNDC D Q ("1^"_NEWNDC)
|
---|
27 | . D SAVNDC(RX,RFL,NEWNDC,0,1)
|
---|
28 | . D ECMESND^PSOBPSU1(RX,RFL,,"ED",NEWNDC,,"RX RELEASE-NDC CHANGE",,1,,1)
|
---|
29 | Q 0
|
---|
30 | ;
|
---|
31 | NDCEDT(RX,RFL,DRG,SITE,NDC,BCODE) ; Allows editing of the Rx NDC code
|
---|
32 | ; Input: (r) RX - Rx IEN (#52)
|
---|
33 | ; (o) RFL - Refill Number (#52.1)
|
---|
34 | ; (o) DRG - Drug IEN (#50)
|
---|
35 | ; (o) NDC - Default NDC Number/Return parameter ("" means no NDC selected) (Note: REQUIRED for Output value)
|
---|
36 | ; (o) BCODE - Display the PID/Drug Name in the NDC prompt
|
---|
37 | ;Output: (r) .NDC - Selected NDC Number
|
---|
38 | ;
|
---|
39 | N SNDC,SYN,Z,IDX,I,PID,DFN,DRGNAM,PRPT,DIR
|
---|
40 | K ^TMP($J,"PSONDCDP"),^TMP($J,"PSONDCFM")
|
---|
41 | I '$G(DRG),$G(RX) S DRG=$$GET1^DIQ(52,RX,6,"I")
|
---|
42 | I '$D(RFL) S RFL=$$LSTRFL^PSOBPSU1(RX)
|
---|
43 | S IDX=0,SITE=+$G(SITE) I 'SITE,$G(RX) S SITE=$$RXSITE^PSOBPSUT(RX,RFL)
|
---|
44 | ;
|
---|
45 | ; - Setting the NDC currently on the PRESCRIPTION (passed in)
|
---|
46 | I $G(NDC)'="",$$NDCFMT^PSSNDCUT(NDC)'="" S IDX=1,^TMP($J,"PSONDCFM",IDX)=NDC,^TMP($J,"PSONDCDP",NDC)=IDX
|
---|
47 | ;
|
---|
48 | ; - Retrieving NDC from the PRESCRIPTION file
|
---|
49 | I $G(RX) D
|
---|
50 | . S NDC=$$GETNDC(RX,RFL)
|
---|
51 | . I NDC'="",'$D(^TMP($J,"PSONDCDP",NDC)) D
|
---|
52 | . . S IDX=IDX+1,^TMP($J,"PSONDCFM",IDX)=NDC,^TMP($J,"PSONDCDP",NDC)=IDX
|
---|
53 | ;
|
---|
54 | S:'IDX IDX=1
|
---|
55 | ;
|
---|
56 | ; - Retrieving NDC from the DRUG/NDF files
|
---|
57 | S NDC=$$GETNDC^PSSNDCUT(DRG)
|
---|
58 | I NDC'="",'$D(^TMP($J,"PSONDCDP",NDC)) D
|
---|
59 | . S IDX=IDX+1,^TMP($J,"PSONDCFM",IDX)=NDC,^TMP($J,"PSONDCDP",NDC)=IDX
|
---|
60 | ;
|
---|
61 | ; - Retrieving NDC by OUTPATIENT SITE from the DRUG/NDF files
|
---|
62 | S NDC=$$GETNDC^PSSNDCUT(DRG,SITE)
|
---|
63 | I NDC'="",'$D(^TMP($J,"PSONDCDP",NDC)) D
|
---|
64 | . S IDX=IDX+1,^TMP($J,"PSONDCFM",IDX)=NDC,^TMP($J,"PSONDCDP",NDC)=IDX
|
---|
65 | ;
|
---|
66 | ; - Retrieving NDCs from SYNONYMS
|
---|
67 | S SYN=0
|
---|
68 | F S SYN=$O(^PSDRUG(DRG,1,SYN)) Q:SYN="" D
|
---|
69 | . S Z=$G(^PSDRUG(DRG,1,SYN,0)),SNDC=$$NDCFMT^PSSNDCUT($P(Z,"^",2)) I SNDC="" Q
|
---|
70 | . I $D(^TMP($J,"PSONDCDP",SNDC)) Q
|
---|
71 | . S IDX=IDX+1,^TMP($J,"PSONDCFM",IDX)=SNDC
|
---|
72 | . S ^TMP($J,"PSONDCDP",SNDC)=IDX
|
---|
73 | ;
|
---|
74 | I '$D(^TMP($J,"PSONDCFM")) D S NDC="^" G END
|
---|
75 | . W !!,"No valid NDC codes found for "_$$GET1^DIQ(50,DRG,.01),$C(7)
|
---|
76 | ;
|
---|
77 | ASK ; Ask for NDC
|
---|
78 | S PRPT=""
|
---|
79 | I $G(BCODE) D
|
---|
80 | . S DFN=$$GET1^DIQ(52,RX,2,"I") D DEM^VADPT S PID=$P(VADM(2),"^",2)
|
---|
81 | . S DRGNAM=$E($$GET1^DIQ(50,DRG,.01),1,25),PRPT="PID: "_PID_"/MED: "_DRGNAM_"/"
|
---|
82 | K DIR S DIR(0)="FOA^1:15",DIR("A")=PRPT_"NDC: ",DIR("B")=$G(^TMP($J,"PSONDCFM",1)) I DIR("B")="" K DIR("B")
|
---|
83 | S DIR("?")="^D NDCHLP^PSONDCUT" D ^DIR I $D(DIRUT) S NDC="^" G END
|
---|
84 | I Y'?.N S NDC=Y I '$D(^TMP($J,"PSONDCDP",NDC)) W !,$C(7) D NDCHLP W !,$C(7) G ASK
|
---|
85 | I Y?.N D I NDC="" W !,$C(7) D NDCHLP W !,$C(7) G ASK
|
---|
86 | . I $L(Y)=11 S NDC=$$NDCFMT^PSSNDCUT(Y) S:NDC'="" NDC=$S($D(^TMP($J,"PSONDCDP",NDC)):NDC,1:"") Q
|
---|
87 | . S NDC=$G(^TMP($J,"PSONDCFM",+Y))
|
---|
88 | W " ",NDC
|
---|
89 | ;
|
---|
90 | END K ^TMP($J,"PSONDCDP"),^TMP($J,"PSONDCFM")
|
---|
91 | Q
|
---|
92 | ;
|
---|
93 | SAVNDC(RX,RFL,NDC,CMP,DRG) ; Saves the NDC in the PRESCRIPTION and DRUG files
|
---|
94 | ; Input: (r) RX - Rx IEN (#52)
|
---|
95 | ; (o) RFL - Refill Number (#52.1)
|
---|
96 | ; (r) NDC - NDC Number
|
---|
97 | ; (o) CMP - CMOP? (1-YES/0-NO)
|
---|
98 | ; (o) DRG - Save in the DRUG file (1-YES/0-NO) ((Def: 0)
|
---|
99 | ;
|
---|
100 | S NDC=$$NDCFMT^PSSNDCUT(NDC) I NDC="" Q
|
---|
101 | ;
|
---|
102 | ;- Saving the NDC in the PRESCRIPTION file (#52)
|
---|
103 | I '$D(RFL) S RFL=$$LSTRFL^PSOBPSU1(RX)
|
---|
104 | ;
|
---|
105 | N DA,DIE,DR
|
---|
106 | I 'RFL S DIE="^PSRX(",DA=RX,DR="27///"_NDC D ^DIE
|
---|
107 | I RFL,$D(^PSRX(RX,1,RFL,0)) S DIE="^PSRX("_RX_",1,",DA(1)=RX,DA=RFL,DR="11///"_NDC D ^DIE
|
---|
108 | ;
|
---|
109 | ;- Saving the NDC in the DRUG file (#50)
|
---|
110 | I $G(DRG) D SAVNDC^PSSNDCUT($$GET1^DIQ(52,RX,6,"I"),$$RXSITE^PSOBPSUT(RX,RFL),NDC,$G(CMP))
|
---|
111 | Q
|
---|
112 | ;
|
---|
113 | GETNDC(RX,RFL) ; Returns the Rx NDC #
|
---|
114 | ; Input: (r) RX - Rx IEN (#52)
|
---|
115 | ; (o) RFL - Refill #
|
---|
116 | ; Output: NDC - Rx NDC #
|
---|
117 | N NDC,I S NDC=""
|
---|
118 | I '$D(RFL) S RFL=$$LSTRFL^PSOBPSU1(RX)
|
---|
119 | I RFL S NDC=$$GET1^DIQ(52.1,RFL_","_RX,11)
|
---|
120 | I 'RFL!(NDC="") S NDC=$$GET1^DIQ(52,RX,27)
|
---|
121 | Q $$NDCFMT^PSSNDCUT(NDC)
|
---|
122 | ;
|
---|
123 | NDCHLP ; Help Text for the NDC Code Selection
|
---|
124 | N I
|
---|
125 | W !,"Select one of the following valid NDC code(s) below: ",!
|
---|
126 | S I=0 F S I=$O(^TMP($J,"PSONDCFM",I)) Q:'I D
|
---|
127 | . W !?10,$J(I,2)," - ",^TMP($J,"PSONDCFM",I)
|
---|
128 | Q
|
---|