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

PSUCS17.m

Go to the documentation of this file.
  1. PSUCS17 ;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 #58.81 supported by DBIA 2520
  1. ; Reference to file #50 supported by DBIA 221
  1. ;
  1. ; ***
  1. ; TYPE 17 - "Logged for patient"
  1. ; ***
  1. EN ;EP scan the ^XTMP(job,"MC",loc,pat,drug,qt)=PSUIENDA
  1. ; where type 17 were stored combining multiples for a patient
  1. S PSULOC="",PSUMCHK=0,PSUTYP=17
  1. F S PSULOC=$O(^XTMP(PSUCSJB,"MC",PSULOC)) Q:PSULOC="" D
  1. . S DFN=0
  1. . F S DFN=$O(^XTMP(PSUCSJB,"MC",PSULOC,DFN)) Q:DFN'>0 D DRUG
  1. Q
  1. DRUG ;EP loop drugs within patient
  1. S Z=0
  1. F S Z=$O(^XTMP(PSUCSJB,"MC",PSULOC,DFN,Z)) Q:Z="" S X=^(Z) D
  1. . S PSUPIEN(73)=DFN
  1. . S PSUIENDA=X,PSUDRG=Z
  1. . S PSUDTM(3)=$$VALI^PSUTL(58.81,PSUIENDA,3),SENDER=PSUSNDR
  1. . ;S PSURI="H" DAM TEST
  1. . N Z
  1. . D TYP17
  1. . I 'PSUTQY(5) Q ; do not send if QTY=0
  1. . D BUILDREC^PSUCS5
  1. . K PSUSSN,PSUPLC
  1. Q
  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. ;
  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. ;
  1. FACILTY ;
  1. D DIVISION^PSUCS2
  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. ; Store in ^XTMP(job,"MC",loc,dfn,drg,qt)
  1. S PSUTQY(5)=^XTMP(PSUCSJB,"MC",PSULOC,DFN,PSUDRG,"QT")
  1. Q