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

APSEPPIM.m

Go to the documentation of this file.
APSEPPIM ;IHS/ASDS/ENM/POC - PRINTS THE PATIENT MEDICATION SHEETS ;16-Jun-2009 13:30;SM
 ;;7.0;IHS PHARMACY MODIFICATIONS;**1003,1007,1008**;Sep 23, 2004
 ; Modified - IHS/CIA/PLS - 02/18/04 - NRNDC+2
 ;                          07/24/05 - PMI+3
 ;            IHS/MSC/PLS - 08/19/08 - Line EN1+8
 ;                          03/16/09 - Modified to support VistA PMI information
EN ;EP - NORMAL ENTRY POINT FROM APSPNE4 PRINT LINE
 U IO(0)
 I '$D(^PS(50.621))!'$D(^PS(50.622)) D  Q
 .W !,"NDF Patient Medication Instruction Sheets data has not been installed",!!
 ;
 N APSPQ,PSNLANG,APSPNUM,%ZIS,ZTSAVE,LP
 ;
LANG ;EP
 S PSNLANG=$$GET1^DIQ(59.7,1,14,"I")
 S PSNLANG=$S(PSNLANG:PSNLANG,1:1)  ;Default to English if not defined
 S PSNLANG=$$DIR^APSPUTIL("S^1:English;2:Spanish","Select Language",PSNLANG,,.APSPQ)
 Q:'PSNLANG
 ;
COPIES ;EP
 S APSPNUM=$$DIR^APSPUTIL("N^1:10:0","How many copies",1,,,.APSPQ)
 Q:'APSPNUM
 D DEV
 Q
DEV ;
 F LP="PPL","APSPCPP","PSNLANG","APSPNUM" S ZTSAVE(LP)=""
 S:$L($G(APSPCPP)) %ZIS("B")=APSPCPP
 D EN^XUTMDEVQ("PMI^APSEPPIM","Print Medication Information Sheets",.ZTSAVE,.%ZIS)
 I POP D  Q
 .W !,"No device selected and no PMIs printed.",!
 Q
 ;
EN1 ;EP  - ENTRY FROM MENU OPTION FOR SINGLE PATIENT
 N PPL,PSOSD,DFN,APSQRXN,APSQIEN,APSQDRG,APSQ
 N PSRX,PSNDFN,NAM,APSDNAM,APSDOC,APSPNDC,CR,DFN,ED,ED1,ED2,ED3,NDC,NUM
 N P2,PG,PPI,PPL,PS,PSODFN,SSN,SEX,VA,VADM,XNDC
 N Z,PSCNT,PSOCT,PSODTCUT,PSOERR,PSOLIST,PSOOPT,PSOSTA,RXN,STP,STR
 N J,JJ,IEN,DIWI,DIW,DIWT,DN,APSPIRN,APSPZDT
 N POP,VAERR,CNT,DIR,DIWTC,DOB,DRG,IOHG,DIWX,IOBS
 D PT^APSPNUM   ; IHS/BAO/DMH - 03/01/2002
 ; IHS/MSC/PLS - 08/19/08
 ;Q:'PSODFN
 Q:'$D(PSODFN)
 S PSONUM="LIST"
 D EN^APSPNUM
 G:'$D(PSOLIST) END
 S PPL=PSOLIST(1) ;BETTER WATCH THIS AS IT CAN BE TOO LONG
 G EN
 ;
PMI ;SET UP AND PRINT
 U IO
 Q:'$D(PPL)  ;Nothing to print
 N APSQ,APSQIEN,DRG,APSQRXN,APSDOC,APSDNAM   ;IHS/CIA/PLS - 07/24/2005
 N PSNDFN,PSNTYPE,NUM,PSRX,PSODFN,PSNDF,PSNPN,PSNGCN,APSI
 S NUM=APSPNUM
 S PSNTYPE=$S(PSNLANG=1:2,1:5)
 F APSI=1:1 S APSQIEN=$P(PPL,",",APSI) Q:'APSQIEN  D
 .S DRG=+$P(^PSRX(APSQIEN,0),U,6)
 .Q:'DRG
 .S APSQRXN=+^PSRX(APSQIEN,0)
 .S PSRX=$P(APSQRXN,U)  ; Prescription Number
 .S APSDOC=$P(^PSRX(APSQIEN,0),U,4),APSDNAM=$P(^VA(200,APSDOC,0),U)
 .S (PSNDFN,PSODFN)=$P(^PSRX(APSQIEN,0),U,2)
 .S PSNDF=$G(^PSDRUG(DRG,"ND"))
 .S PSNPN=+$P(PSNDF,U,3),PSNDF=+PSNDF
 .S PSNGCN=$P($G(^PSNDF(50.68,PSNPN,1)),U,5)
 .S:'$L(PSNGCN) PSNGCN=" "
 .D DOONE^PSNPPIP
 ;
END ;EP
 D ^%ZISC
 S:$D(ZTQUEUED) ZTREQ="@"
 Q
NRNDC ;IHS/ASD/ENM 05/31/01 - GET LAST REFILL NDC OR NEW RX NDC
 S APSPIRN=$O(^PSRX(APSQIEN,1,"A"),-1)
 ; IHS/CIA/PLS - 02/18/04 - Changed lookup for refill NDC to use extrinsic function
 ;I +APSPIRN S APSPNDC=$P($G(^PSRX(APSQIEN,1,APSPIRN,0)),"^",13) Q
 ;S APSPNDC=$P($G(^PSRX(APSQIEN,2)),"^",7)
 I +APSPIRN S APSPNDC=$$NDCVAL^APSPFUNC(APSQIEN,APSPIRN)
 E  S APSPNDC=$$NDCVAL^APSPFUNC(APSQIEN)
 Q
 ;
PAUSE ;EP
 N QQ
 S QQ=$$DIR^APSPUTIL("FO","Press <return> to continue.")
 Q