source: WorldVistAEHR/trunk/r/PHARMACY_BENEFITS_MANAGEMENT-PSU/PSUAR2.m@ 623

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1PSUAR2 ;BIR/PDW - ASSEMBLE AR/WS RECORDS FOR TRANSMISSION ;10 JUL 1999
2 ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
3 ; DBIA(s)
4 ; Reference to file #50 supported by DBIA 221
5 ;
6EN ;EP Build ("RECORDS") from scan of ^XTMP(PSUARSUB,"DIV_DRUG",Drug,Div)=Total
7 S PSUDRDA=0,PSULC=0,PSUDIVDA=0
8 K ^XTMP(PSUARSUB,"RECORDS")
9 K ^XTMP(PSUARSUB,"DRUG_TOTAL")
10 F S PSUDIVDA=$O(^XTMP(PSUARSUB,"DIV_DRUG",PSUDIVDA)) Q:PSUDIVDA="" D DRUGSCAN
11 Q
12 ;
13DRUGSCAN ;EP Scan for Drugs within division
14 S PSUDDRDA=0,PSULC=0 ;**1
15 F S PSUDRDA=$O(^XTMP(PSUARSUB,"DIV_DRUG",PSUDIVDA,PSUDRDA)) Q:PSUDRDA'>0 S PSUTOT=^(PSUDRDA) D
16 . S PSULC=PSULC+1
17 . S ^XTMP(PSUARSUB,"RECORDS",PSUDIVDA,PSULC)=$$RECORD(PSUDRDA,PSUDIVDA,PSUTOT)
18 . S X=$G(^XTMP(PSUARSUB,"DRUG_TOTAL",PSUDRDA))
19 . S ^XTMP(PSUARSUB,"DRUG_TOTAL",PSUDRDA)=X+PSUTOT
20 Q
21 ;
22RECORD(PSUDRDA,PSUDIV,PSUTOT) ;EP Return record assembled
23 ;
24 ; @x@(Fld) holds the appropriate field values from the drug file 50
25 ;
26 N PSU,PSUP,PSUSEND,PSUDIVH
27 I '$D(^XTMP(PSUARSUB,"PSUDRUG_DET",PSUDRDA)) D DRUG(PSUDRDA)
28 S X="^XTMP(PSUARSUB,""PSUDRUG_DET"",PSUDRDA)"
29 ; piece = value @X@(field from file 50)
30 ; Process for sender being division or site
31 S PSUSEND=PSUDIV,PSUDIVH=""
32 I PSUDIV["_0H" S PSUSEND=$G(PSUSNDR),PSUDIVH="H"
33 S PSU(2)=PSUSEND
34 S PSU(3)=PSUDIVH
35 S PSU(4)=$G(PSUMON)
36 S PSU(5)=@X@(21)
37 S PSU(6)=@X@(2)
38 S PSU(7)=@X@(31)
39 S PSU(8)=@X@(.01)
40 S PSU(9)=@X@(51)
41 S PSU(10)=@X@(99999.17) ;indicator for National Formulary
42 S PSU(11)=@X@(99999.18) ;Indicator for National Formulary Restriction
43 S PSU(12)=@X@(14.5)
44 S PSU(13)=@X@(16)
45 S PSU(14)=@X@(301)
46 S PSU(15)=@X@(302)
47 S PSU(16)=$G(PSUTOT)
48 S PSU(17)=@X@(52)
49 S PSU(18)=@X@(3)
50 S PSU(19)=$G(PSUTDSP(PSUDIVDA,PSUDRDA)) ;Quantity Dispensed
51 S PSU(20)=$G(PSUTRET(PSUDIVDA,PSUDRDA)) ;Quantity Returned
52 S PSUP=0
53 F S PSUP=$O(PSU(PSUP)) Q:PSUP'>0 S PSU(PSUP)=$TR(PSU(PSUP),"^","'")
54 S PSUP=0
55 F S PSUP=$O(PSU(PSUP)) Q:PSUP'>0 S $P(PSU,"^",PSUP)=PSU(PSUP)
56 S PSU=PSU_"^"
57 Q PSU
58 ;
59DRUG(PSUDRDA) ;EP assemble from file 50+ needed fields
60 ; PSUDRDA is da for the DRUG in file 50 from (58.52,.01)
61 ; Store the fields in ^XTMP(PSUARSUB,"PSUDRUG_DET",PSUDDA,Field)=value
62 N PSUDRUG,PSUNDF
63 D GETS^PSUTL(50,PSUDRDA,".01;2;14.5;15;16;20;21;22;25;31;51;301;302;52;3","PSUDRUG","I")
64 ; Move PSUDRUG(Field,"I") value to PSUDRUG(Field) nodes
65 D MOVEI^PSUTL("PSUDRUG")
66 ;
67PROCESS ;Further process field values into their final values
68 ;
69 S PSUDRUG(51)=$$VAL^PSUTL(50,PSUDRDA,51)
70 I PSUDRUG(31)="" S PSUDRUG(31)="No NDC"
71 I PSUDRUG(21)="" S PSUDRUG(21)="Unknown VA Product Name"
72 I PSUDRUG(.01)="" S PSUDRUG(.01)="Unknown Generic Name"
73 S X=+PSUDRUG(301)
74 S PSUDRUG(301)=$S(X=0:"03 or 04",X=1:"06 or 07",2:"17",3:"22",1:X)
75 I PSUDRUG(52) S PSUDRUG(52)="N/F"
76 ;
77 ; Process VA DRUG CLASS
78 ; Test for new NDF software s PSUNDF=1 if yes
79 S PSUNDF=0
80 I $$VERSION^XPDUTL("PSN")'<4 S PSUNDF=1
81 ;
82 ; Process for National Formulary Indicator & Restrictions
83 ; Put into node 99999.17 for file(50.68,17)
84 ; Put into node 99999.18 for file(50.68,18)
85 ; test to see if file 50.68 exists (comes in with V4 of NDF)
86 S PSUDRUG(99999.17)=""
87 S PSUDRUG(99999.18)=""
88 I 'PSUNDF G STORE
89 ; Process for National Formulary Indicator from VA Product Name file
90 S PSUVPNDA=PSUDRUG(22)
91 I PSUNDF S PSUDRUG(99999.17)=$$FORMI^PSNAPIS(PSUDRUG(20),PSUDRUG(22))
92 ; Process for National Formulary Restriction
93 I PSUNDF S PSUDRUG(99999.18)=$$FORMR^PSNAPIS(PSUDRUG(20),PSUDRUG(22))
94 K PSUNFR
95 ;
96STORE ;Store the processed values into ^TMP
97 M ^XTMP(PSUARSUB,"PSUDRUG_DET",PSUDRDA)=PSUDRUG
98 Q
99 ;
100REC ;EP Move PSUAR_RECORDS to PSUAREC)
101 M ^XTMP(PSUARSUB,"PSUAREC")=^XTMP(PSUARSUB,"RECORDS",$J)
102 Q
Note: See TracBrowser for help on using the repository browser.