Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSUCS3

PSUCS3.m

Go to the documentation of this file.
  1. PSUCS3 ;BIR/DJE,DJM - GENERATE PSU CS RECORDS (TYPE 17) ;25 AUG 1998
  1. ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
  1. ;
  1. ;DBIA'S
  1. ; Reference to file #40.8 supported by DBIA 2438
  1. ; Reference to file #58.81 supported by DBIA 2520
  1. ; Reference to file #50 supported by DBIA 221
  1. ; Reference to file #42 supported by DBIA 1848
  1. ; Reference to file #2 supported by DBIA 10035
  1. ; Reference to file #58.8 supported by DBIA 2519
  1. ; ***
  1. ; TYPE 17 - "Logged for patient"
  1. ; ***
  1. ;
  1. TYP17 ; Processing the transaction for dispensing type 17
  1. ;('logged for patient'). If the dispensing type=17 and a patient IEN
  1. ;is identified, one can use this information one find the ward location
  1. ;if the patient is still an inpatient when the extract is done.
  1. D FACILTY
  1. ;
  1. ; (type 17 specific call)
  1. ; Patient SSN
  1. D SSN
  1. ;
  1. ; Generic name, Location type.
  1. D GNAME^PSUCS4,LOCTYP^PSUCS4
  1. ; Requirement 3.2.5.7
  1. Q:"N"'[PSULTP(1)
  1. ;
  1. ; check if drug administered multiple times for a patient
  1. D MULTCHK
  1. ;
  1. ;VA Drug class, Formulary/Non-formulary, National formulary Indicator.
  1. D NDC^PSUCS4,FORMIND^PSUCS4,NFIND^PSUCS4
  1. ;
  1. ;(type 17 specific call)
  1. ; Dispense unit, unit cost, Quantity
  1. D DUNIT,UNITC,QTY17
  1. ;
  1. ; VA Product name, VA drug class, Packaging
  1. D VPNAME^PSUCS4,VDC^PSUCS4
  1. ;
  1. Q
  1. ;
  1. ;
  1. ;
  1. ; Type 17 specific calls
  1. ;
  1. ;
  1. MULTCHK ;
  1. ; store in array (quit if already administered)
  1. S PSUMCHK=0
  1. S PSUQT(5)=$$VALI^PSUTL(58.81,PSUIENDA,5)
  1. ; if patient,drug collection started increment QT
  1. I $D(^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4))) D Q
  1. . S X=^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4),"QT")
  1. . S ^("QT")=X+PSUQT(5)
  1. ; Save the IEN of the first transaction for collection
  1. ;S PSUMCIEN=PSUIENDA
  1. ; start patient drug collection
  1. S ^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4))=PSUIENDA
  1. S ^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4),"QT")=PSUQT(5)
  1. Q
  1. ;
  1. FACILTY ;
  1. ;Field # 2,.1[WARD LOCATION]
  1. S PSUWLC(.01)=$$VALI^PSUTL(2,PSUPIEN(73),".01")
  1. Q:PSUWLC(.01)=""
  1. S PSUWLC(.01)=$O(^DIC(42,"B",PSUWLC(.01),""))
  1. Q:PSUWLC(.01)=""
  1. ;
  1. ;Field # 58.842,.01 [WARD] Points to File # 42
  1. S PSUWARD(1)=$$VALI^PSUTL(58.842,PSUWLC(.01),"1")
  1. ;D GETS^PSUTL(58.842,PSUWLC(.1),"1","PSUWARD","I")
  1. ;D MOVEI^PSUTL("PSUWARD")
  1. ;
  1. ;Field # 42,.015 [DIVISION] Points to File # 40.8
  1. S PSUDIV(.015)=$$VALI^PSUTL(42,PSUWARD(1),".015")
  1. ;
  1. ;Field # 40.8,1 [FACILITY NUMBER]**Field to be extracted
  1. S PSUFCN(1)=$$VALI^PSUTL(40.8,PSUDIV(.015),"1")
  1. S SENDER=PSUFCN(1)
  1. S PSURI=""
  1. Q
  1. ;
  1. SSN ;Field # 58.81,73 [PATIENT] Points to File # 2
  1. ;Field # 2,.09 [SOCIAL SECURITY NUMBER]**Field to be extracted
  1. Q:$G(PSUPIEN(73))=""
  1. S DFN=PSUPIEN(73) D PID^VADPT
  1. S PSUSSN(.09)=$TR(VA("PID"),"-","")
  1. Q
  1. ;
  1. DUNIT ;Dispense Unit
  1. ;Field # 50,14.5 [DISPENSE UNIT]**Field to be extracted
  1. S PSUDUN(14.5)=$$VALI^PSUTL(50,PSUDRG(4),"14.5")
  1. S UNIT=PSUDUN(14.5)
  1. Q
  1. ;
  1. UNITC ;Unit Cost
  1. ;Field # 50,16 [PRICE PER DISPENSE UNIT]**Field to be extracted
  1. S PSUPDU(16)=$$VALI^PSUTL(50,PSUDRG(4),"16")
  1. Q
  1. ;
  1. QTY17 ;For transactions with a dispensing type =17, total the number of doses
  1. ;dispensed for the same drug (Field # 58.81,4), regardless of the date
  1. ;dispensed within the reporting month. The dispensed (transaction) date
  1. ;will be the date the first dose was administered to the patient during
  1. ;the reporting period. The data will be transmitted as a single data
  1. ;record.
  1. ;Sum of Values # 58.81,5 [TOTAL QUANTITY]**Field to be extracted
  1. Q ;this is handled in gathering into "MC"
  1. S PSUTQ(5)=$$VALI^PSUTL(58.81,PSUIENDA,5)
  1. S OLDXTMP=$G(^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4)),"QT")
  1. S ^XTMP(PSUCSJB,"MC",PSULOC,PSUPIEN(73),PSUDRG(4),"QT")=OLDXTMP+PSUTQ(5)
  1. Q