| 1 | PSUCS4 ;BIR/DJE - PBM CS GENERATE RECORDS ;13 OCT 1999 | 
|---|
| 2 | ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005 | 
|---|
| 3 | ; | 
|---|
| 4 | ; ** | 
|---|
| 5 | ; General Calls from type 2 & 17 | 
|---|
| 6 | ; ** | 
|---|
| 7 | ;DBIAs | 
|---|
| 8 | ; Reference to file #50    supported by DBIA 221 | 
|---|
| 9 | ; Reference to file #58.8  supported by DBIA 2519 | 
|---|
| 10 | ; Reference to file #58.81 supported by DBIA 2520 | 
|---|
| 11 | ; | 
|---|
| 12 | GNAME ;3.2.5.11. Functional Requirement 11 | 
|---|
| 13 | ;Field   # 58.81,4 [DRUG] Points to File # 50 | 
|---|
| 14 | S PSUDRG(4)=$$VALI^PSUTL(58.81,PSUIENDA,"4") | 
|---|
| 15 | ; | 
|---|
| 16 | ;Generic Drug Name | 
|---|
| 17 | ;Field   # 50,.01 [GENERIC NAME]**Field to be extracted | 
|---|
| 18 | S PSUGDN(.01)=$$VALI^PSUTL(50,PSUDRG(4),".01") | 
|---|
| 19 | I $G(PSUGDN(.01))="" S PSUGDN(.01)="Unknown Generic Name" | 
|---|
| 20 | Q | 
|---|
| 21 | ; | 
|---|
| 22 | LOCTYP ;3.2.5.7.   Functional Requirement 7 | 
|---|
| 23 | ;Transactions with a dispensing type (field # 58.81,1) of '2' | 
|---|
| 24 | ; - Dispensed from Pharmacy must be associated with a location type | 
|---|
| 25 | ;(field # 58.8,1) of 'M' for Master or 'S' for Satellite. | 
|---|
| 26 | ;Transactions with a dispensing type (field # 58.81,1) of '17' | 
|---|
| 27 | ;- Logged for Patient must  be associated with a location type | 
|---|
| 28 | ;(field # 58.8,1) of 'N' for narcotic location. | 
|---|
| 29 | ;S PSULTP(1)=$$VALI^PSUTL(58.81,PSUIENDA,"1") | 
|---|
| 30 | ;D MOVEI^PSUTL("PSULTP") | 
|---|
| 31 | S PSULTP(1)=$$VALI^PSUTL(58.8,PSULOC,1) | 
|---|
| 32 | Q:PSUTYP=17 | 
|---|
| 33 | ; | 
|---|
| 34 | ;3.2.5.8.   Functional Requirement 8 | 
|---|
| 35 | ;Transactions with a dispensing type '2'-dispensed from pharmacy | 
|---|
| 36 | ;(field # 58.81,1) and a Location type of 'M' for 'S' (field # 58.8,1) | 
|---|
| 37 | ; | 
|---|
| 38 | ; Continue Processing Flag (CPFLG) | 
|---|
| 39 | S CPFLG="Y" | 
|---|
| 40 | ; but that have been cancelled (field # 58.81,55) will be excluded. | 
|---|
| 41 | ; (ie.If there is a 'cancel verified order date' - PSUCDT) | 
|---|
| 42 | S PSUCDT(55)=$$VALI^PSUTL(58.81,PSUIENDA,"55") | 
|---|
| 43 | Q:$G(PSUCDT(55))="" | 
|---|
| 44 | S CPFLG="N" | 
|---|
| 45 | Q | 
|---|
| 46 | ; | 
|---|
| 47 | ;3.2.5.9.   Functional Requirement 9 | 
|---|
| 48 | ;Dispensing transactions that meet the criteria in functional | 
|---|
| 49 | ;requirements 3.2.5.3., 3.2.5.7. and 3.2.5.8. will have the following | 
|---|
| 50 | ;additional data elements for the  drug extracted. | 
|---|
| 51 | ; | 
|---|
| 52 | NDC ;NDC | 
|---|
| 53 | ;Field # 50,31 [NDC]**Field to be extracted | 
|---|
| 54 | ;If no data found, send "No NDC". | 
|---|
| 55 | S PSUNDC(31)=$$VALI^PSUTL(50,PSUDRG(4),"31") | 
|---|
| 56 | I $G(PSUNDC(31))="" S PSUNDC(31)="No NDC" | 
|---|
| 57 | Q | 
|---|
| 58 | ; | 
|---|
| 59 | ; | 
|---|
| 60 | FORMIND ;Formulary/Non-Formulary Indicator | 
|---|
| 61 | ;Field # 50,51 [NON-FORMULARY]**Field to be extracted | 
|---|
| 62 | S PSUFID(51)=$$VALI^PSUTL(50,PSUDRG(4),"51") | 
|---|
| 63 | Q | 
|---|
| 64 | ; | 
|---|
| 65 | NFIND ;National Formulary Indicator | 
|---|
| 66 | ;Product will need to check whether or not Vs 4.0 of | 
|---|
| 67 | ;National Drug File is installed. If not, this field will not exist. | 
|---|
| 68 | ;Check for National Drug File | 
|---|
| 69 | S (NFIND,NFRES)="" | 
|---|
| 70 | S VERSION=$$VERSION^XPDUTL("PSN") | 
|---|
| 71 | Q:VERSION<4.0 | 
|---|
| 72 | ;Field # 50.68,17 [NATIONAL FORMULARY INDICATOR]***Field to be extracted | 
|---|
| 73 | ;If  National Drug File vs 4.0 is not installed | 
|---|
| 74 | ;Transmission format: Send null | 
|---|
| 75 | ;If National Drug File vs 4.0 is installed | 
|---|
| 76 | S PSUDRG4=PSUDRG(4) | 
|---|
| 77 | D GETS^PSUTL(50,PSUDRG4,"20;22;3;52","PSUDRG","I") | 
|---|
| 78 | D MOVEI^PSUTL("PSUDRG") | 
|---|
| 79 | S PSUDRG(4)=PSUDRG4 | 
|---|
| 80 | ; | 
|---|
| 81 | S PSUNFI(17)=$$FORMI^PSNAPIS(PSUDRG(20),PSUDRG(22)) | 
|---|
| 82 | ;Transmission format: Internal value ('1' for Yes, '0' for  No) | 
|---|
| 83 | ;National Formulary Restriction Indicator | 
|---|
| 84 | ;Product shall check whether or not Vs 4.0 of National Drug File | 
|---|
| 85 | ;is installed. If not, this field will not exist. | 
|---|
| 86 | ;Field #50.6818,.01[NATIONAL FORMULARY RESTRICTION]Field to be extracted | 
|---|
| 87 | ; | 
|---|
| 88 | S PSUNFR(.01)=$$FORMR^PSNAPIS(PSUDRG(20),PSUDRG(22))>0 | 
|---|
| 89 | S PSUNFR(.01)=$S($G(PSUNFR(.01))="":0,1:PSUNFR(.01)) | 
|---|
| 90 | ; | 
|---|
| 91 | ;If  National Drug File vs 4.0 is not installed | 
|---|
| 92 | ;Transmission format: Send null | 
|---|
| 93 | ;If National Drug File vs 4.0 is installed | 
|---|
| 94 | ;Transmission format:  If no value is found send '0', | 
|---|
| 95 | ;if data exists sent '1' | 
|---|
| 96 | Q | 
|---|
| 97 | ; | 
|---|
| 98 | VPNAME ;VA Product Name | 
|---|
| 99 | ;Field # 50,21[VA PRODUCT NAME]**Field to be extracted | 
|---|
| 100 | S PSUVPN(21)=$$VALI^PSUTL(50,PSUDRG(4),"21") | 
|---|
| 101 | S PSUDRG4=PSUDRG(4) ;if no value found, send "Unknown VA Product Name" | 
|---|
| 102 | I $G(PSUVPN(21))="" S PSUVPN(21)="Unknown VA Product Name" | 
|---|
| 103 | D GETS^PSUTL(50,PSUDRG(4),"3;52","PSUDRG","I"),MOVEI^PSUTL("PSUDRG") | 
|---|
| 104 | S PSUDRG(4)=PSUDRG4 ;DEA, NFI | 
|---|
| 105 | Q | 
|---|
| 106 | ; | 
|---|
| 107 | VDC ; VA Drug Class | 
|---|
| 108 | ;Field   # 50,2 [NATIONAL DRUG CLASS] Pointer to File # 50.605 | 
|---|
| 109 | ;used DRUG pointer from previous quantity check. | 
|---|
| 110 | S PSUNAC(2)=$$VALI^PSUTL(50,PSUDRG(4),"2") | 
|---|
| 111 | ; | 
|---|
| 112 | ;Field   # 50.605,.01 [CODE]**Field to be extracted | 
|---|
| 113 | S PSUFID(.01)=PSUNAC(2) | 
|---|
| 114 | Q | 
|---|
| 115 | ;Field   # 58.8001,.01 [DRUG] Pointer to File # 50 | 
|---|
| 116 | ; | 
|---|
| 117 | PDT ;Package details | 
|---|
| 118 | ;Field   # 58.8001,7 [BREAKDOWN UNIT]**Field to be extracted | 
|---|
| 119 | ;Field   # 58.8001,8 [PACKAGE SIZE]**Field to be extracted | 
|---|
| 120 | S PSUSITE=0 | 
|---|
| 121 | S PSUSITE=$$VALI^PSUTL(58.8,PSUIENDA,20) | 
|---|
| 122 | S:'PSUSITE PSUSITE=$$VALI^PSUTL(58.81,PSUIENDA,2) | 
|---|
| 123 | D GETS^PSUTL(58.8001,"PSUSITE,PSUDRG(4)","7;8","PSUPDT","I") | 
|---|
| 124 | D MOVEI^PSUTL("PSUPDT") | 
|---|
| 125 | S UNIT=$G(PSUPDT(7),"NA") | 
|---|
| 126 | Q | 
|---|