source: WorldVistAEHR/trunk/r/PHARMACY_BENEFITS_MANAGEMENT-PSU/PSUCS17.m@ 1169

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

initial load of WorldVistAEHR

File size: 2.7 KB
RevLine 
[613]1PSUCS17 ;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 #58.81 supported by DBIA 2520
6 ; Reference to file #50 supported by DBIA 221
7 ;
8 ; ***
9 ; TYPE 17 - "Logged for patient"
10 ; ***
11EN ;EP scan the ^XTMP(job,"MC",loc,pat,drug,qt)=PSUIENDA
12 ; where type 17 were stored combining multiples for a patient
13 S PSULOC="",PSUMCHK=0,PSUTYP=17
14 F S PSULOC=$O(^XTMP(PSUCSJB,"MC",PSULOC)) Q:PSULOC="" D
15 . S DFN=0
16 . F S DFN=$O(^XTMP(PSUCSJB,"MC",PSULOC,DFN)) Q:DFN'>0 D DRUG
17 Q
18DRUG ;EP loop drugs within patient
19 S Z=0
20 F S Z=$O(^XTMP(PSUCSJB,"MC",PSULOC,DFN,Z)) Q:Z="" S X=^(Z) D
21 . S PSUPIEN(73)=DFN
22 . S PSUIENDA=X,PSUDRG=Z
23 . S PSUDTM(3)=$$VALI^PSUTL(58.81,PSUIENDA,3),SENDER=PSUSNDR
24 . ;S PSURI="H" DAM TEST
25 . N Z
26 . D TYP17
27 . I 'PSUTQY(5) Q ; do not send if QTY=0
28 . D BUILDREC^PSUCS5
29 . K PSUSSN,PSUPLC
30 Q
31 ;
32TYP17 ; Processing the transaction for dispensing type 17
33 ;('logged for patient'). If the dispensing type=17 and a patient IEN
34 ;is identified, one can use this information one find the ward location
35 ;if the patient is still an inpatient when the extract is done.
36 D FACILTY
37 ;
38 ; (type 17 specific call)
39 ; Patient SSN
40 D SSN
41 ;
42 ; Generic name, Location type.
43 D GNAME^PSUCS4,LOCTYP^PSUCS4
44 ; Requirement 3.2.5.7
45 Q:"N"'[PSULTP(1)
46 ;
47 ;
48 ;VA Drug class, Formulary/Non-formulary, National formulary Indicator.
49 D NDC^PSUCS4,FORMIND^PSUCS4,NFIND^PSUCS4
50 ;
51 ;(type 17 specific call)
52 ; Dispense unit, unit cost, Quantity
53 D DUNIT,UNITC,QTY17
54 ;
55 ; VA Product name, VA drug class, Packaging
56 D VPNAME^PSUCS4,VDC^PSUCS4
57 ;
58 Q
59 ;
60 ;
61 ;
62 ; Type 17 specific calls
63 ;
64 ;
65 ;
66FACILTY ;
67 D DIVISION^PSUCS2
68 Q
69 ;
70SSN ;Field # 58.81,73 [PATIENT] Points to File # 2
71 ;Field # 2,.09 [SOCIAL SECURITY NUMBER]**Field to be extracted
72 Q:$G(PSUPIEN(73))=""
73 S DFN=PSUPIEN(73) D PID^VADPT
74 S PSUSSN(.09)=$TR(VA("PID"),"-","")
75 Q
76 ;
77DUNIT ;Dispense Unit
78 ;Field # 50,14.5 [DISPENSE UNIT]**Field to be extracted
79 S PSUDUN(14.5)=$$VALI^PSUTL(50,PSUDRG(4),"14.5")
80 S UNIT=PSUDUN(14.5)
81 Q
82 ;
83UNITC ;Unit Cost
84 ;Field # 50,16 [PRICE PER DISPENSE UNIT]**Field to be extracted
85 S PSUPDU(16)=$$VALI^PSUTL(50,PSUDRG(4),"16")
86 Q
87 ;
88QTY17 ;For transactions with a dispensing type =17, total the number of doses
89 ;dispensed for the same drug (Field # 58.81,4), regardless of the date
90 ;dispensed within the reporting month. The dispensed (transaction) date
91 ;will be the date the first dose was administered to the patient during
92 ;the reporting period. The data will be transmitted as a single data
93 ;record.
94 ;Sum of Values # 58.81,5 [TOTAL QUANTITY]**Field to be extracted
95 ; Store in ^XTMP(job,"MC",loc,dfn,drg,qt)
96 S PSUTQY(5)=^XTMP(PSUCSJB,"MC",PSULOC,DFN,PSUDRG,"QT")
97 Q
Note: See TracBrowser for help on using the repository browser.