source: FOIAVistA/tag/r/PHARMACY_BENEFITS_MANAGEMENT-PSU/PSUCS3.m@ 628

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

initial load of FOIAVistA 6/30/08 version

File size: 3.6 KB
Line 
1PSUCS3 ;BIR/DJE,DJM - GENERATE PSU CS RECORDS (TYPE 17) ;25 AUG 1998
2 ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
3 ;
4 ;DBIA'S
5 ; Reference to file #40.8 supported by DBIA 2438
6 ; Reference to file #58.81 supported by DBIA 2520
7 ; Reference to file #50 supported by DBIA 221
8 ; Reference to file #42 supported by DBIA 1848
9 ; Reference to file #2 supported by DBIA 10035
10 ; Reference to file #58.8 supported by DBIA 2519
11 ; ***
12 ; TYPE 17 - "Logged for patient"
13 ; ***
14 ;
15TYP17 ; Processing the transaction for dispensing type 17
16 ;('logged for patient'). If the dispensing type=17 and a patient IEN
17 ;is identified, one can use this information one find the ward location
18 ;if the patient is still an inpatient when the extract is done.
19 D FACILTY
20 ;
21 ; (type 17 specific call)
22 ; Patient SSN
23 D SSN
24 ;
25 ; Generic name, Location type.
26 D GNAME^PSUCS4,LOCTYP^PSUCS4
27 ; Requirement 3.2.5.7
28 Q:"N"'[PSULTP(1)
29 ;
30 ; check if drug administered multiple times for a patient
31 D MULTCHK
32 ;
33 ;VA Drug class, Formulary/Non-formulary, National formulary Indicator.
34 D NDC^PSUCS4,FORMIND^PSUCS4,NFIND^PSUCS4
35 ;
36 ;(type 17 specific call)
37 ; Dispense unit, unit cost, Quantity
38 D DUNIT,UNITC,QTY17
39 ;
40 ; VA Product name, VA drug class, Packaging
41 D VPNAME^PSUCS4,VDC^PSUCS4
42 ;
43 Q
44 ;
45 ;
46 ;
47 ; Type 17 specific calls
48 ;
49 ;
50MULTCHK ;
51 ; store in array (quit if already administered)
52 S PSUMCHK=0
53 S PSUQT(5)=$$VALI^PSUTL(58.81,PSUIENDA,5)
54 ; if patient,drug collection started increment QT
55 I $D(^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4))) D Q
56 . S X=^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4),"QT")
57 . S ^("QT")=X+PSUQT(5)
58 ; Save the IEN of the first transaction for collection
59 ;S PSUMCIEN=PSUIENDA
60 ; start patient drug collection
61 S ^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4))=PSUIENDA
62 S ^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4),"QT")=PSUQT(5)
63 Q
64 ;
65FACILTY ;
66 ;Field # 2,.1[WARD LOCATION]
67 S PSUWLC(.01)=$$VALI^PSUTL(2,PSUPIEN(73),".01")
68 Q:PSUWLC(.01)=""
69 S PSUWLC(.01)=$O(^DIC(42,"B",PSUWLC(.01),""))
70 Q:PSUWLC(.01)=""
71 ;
72 ;Field # 58.842,.01 [WARD] Points to File # 42
73 S PSUWARD(1)=$$VALI^PSUTL(58.842,PSUWLC(.01),"1")
74 ;D GETS^PSUTL(58.842,PSUWLC(.1),"1","PSUWARD","I")
75 ;D MOVEI^PSUTL("PSUWARD")
76 ;
77 ;Field # 42,.015 [DIVISION] Points to File # 40.8
78 S PSUDIV(.015)=$$VALI^PSUTL(42,PSUWARD(1),".015")
79 ;
80 ;Field # 40.8,1 [FACILITY NUMBER]**Field to be extracted
81 S PSUFCN(1)=$$VALI^PSUTL(40.8,PSUDIV(.015),"1")
82 S SENDER=PSUFCN(1)
83 S PSURI=""
84 Q
85 ;
86SSN ;Field # 58.81,73 [PATIENT] Points to File # 2
87 ;Field # 2,.09 [SOCIAL SECURITY NUMBER]**Field to be extracted
88 Q:$G(PSUPIEN(73))=""
89 S DFN=PSUPIEN(73) D PID^VADPT
90 S PSUSSN(.09)=$TR(VA("PID"),"-","")
91 Q
92 ;
93DUNIT ;Dispense Unit
94 ;Field # 50,14.5 [DISPENSE UNIT]**Field to be extracted
95 S PSUDUN(14.5)=$$VALI^PSUTL(50,PSUDRG(4),"14.5")
96 S UNIT=PSUDUN(14.5)
97 Q
98 ;
99UNITC ;Unit Cost
100 ;Field # 50,16 [PRICE PER DISPENSE UNIT]**Field to be extracted
101 S PSUPDU(16)=$$VALI^PSUTL(50,PSUDRG(4),"16")
102 Q
103 ;
104QTY17 ;For transactions with a dispensing type =17, total the number of doses
105 ;dispensed for the same drug (Field # 58.81,4), regardless of the date
106 ;dispensed within the reporting month. The dispensed (transaction) date
107 ;will be the date the first dose was administered to the patient during
108 ;the reporting period. The data will be transmitted as a single data
109 ;record.
110 ;Sum of Values # 58.81,5 [TOTAL QUANTITY]**Field to be extracted
111 Q ;this is handled in gathering into "MC"
112 S PSUTQ(5)=$$VALI^PSUTL(58.81,PSUIENDA,5)
113 S OLDXTMP=$G(^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4)),"QT")
114 S ^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4),"QT")=OLDXTMP+PSUTQ(5)
115 Q
Note: See TracBrowser for help on using the repository browser.