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

APSQFAS.m

Go to the documentation of this file.
APSQFAS ;IHS/ASDS/ENM/POC - NEW RX ORDER MAIN DRIVER USING FAST OPTION 
 ;;6.0;IHS PHARMACY MODIFICATIONS;**3**;FEB 20, 2001
 ;---------------------------------------------------------------
START ;EP
 D EOJ
 S (PSONEW("QFLG"),PSONEW("DFLG"))=0
 G:$G(PSODFN)']"" END
 I $P($G(PSOPAR),"^",4)'=1,$P($G(PSOPAR),"^",21)=1 D DISPLAY
 I PSONEW("QFLG") S PSORX("QFLG")=1 G END
 D:$P($G(PSOPAR),"^",7)=1 ASK G:PSONEW("QFLG") END ; Asks if want to do RX
 ; ----- ----- ----- ----- -----
 ;IHS/DSD/ENM 11/4/93
IHSV ; hook to store data for patient in PCC parameter array for later use
 I $P(%APSITE,U,15)="Y" D ^APSPCCV
 I $D(^DPT(PSODFN,.1)) ; RESET NAKED FOR CODE WHICH FOLLOWS
 ; ----- ----- ----- ----- -----
 ;D ^PSONEW1 ; Continue order entry
 D ^APSQFAS1 ; Continue order entry
 I PSONEW("QFLG") S PSORX("QFLG")=1 G END ;BACKUP TO PSORX AGAIN
 I PSONEW("DFLG") Q  ;NO NEED TO DELETE NUMBER AS NOT ASSIGNED YET
 ;CHANGED NEXT FEW LINES FOR LISTER
 ;D ^APSQFAS2
 D EN^VALM("APSQDIS")
 I '$D(DRUGPICK) S PSONEW("QFLG")=1
 I PSONEW("QFLG") Q
DIQ ;S APSQHIT=0 F  S APSQHIT=$O(DRUG(APSQHIT)) Q:APSQHIT=""  D  D ^APSQFAS3,FIN
 S APSQDG=0 F  S APSQDG=$O(DRUGPICK(APSQDG)) Q:APSQDG=""  D  D ^APSQFAS3,FIN
 .;S APSQDG=+DRUG(APSQHIT)
 .;Q:'APSQDG
 .D GETS^DIQ(9009035.3,APSQDG_",","*","I","APSQ","ERR")
 .M APSQF=APSQ(9009035.3,APSQDG_",") K APSQ ;EASIER TO WORK WITH
 K APSQF ;GET RID OF THESE FOR NEXT LOOP
 ;K DRUG ;MOD 11/24/98 IHS/OKCAO/POC
 K DRUGPICK
 ;END OF CHANGES
 Q
FIN ;FINISH UP
 ;
 I PSONEW("QFLG") G END
 I PSONEW("DFLG") W !,*7,"RX DELETED",! Q  ;G START FAST OPTION
IHSP ;---- ---- ---- ---- ---- ----
 ;IHS PCC HOOK (CREATE APSP PRIMARY CARE VISIT ENTRY)
 I $P(%APSITE,U,35)=1 D ^APSPCVRX ;IHS/DSD/ENM 11/4/93
 ;---- ---- ---- ---- ---- ----
 ;D:$P($G(PSOPAR),"^",7)=1 AUTO^PSONRXN I $P($G(PSOPAR),"^",7)'=1 S PSOX=PSONEW("RX #") D CHECK^PSONRXN
 D AUTO^PSONRXN
 I PSONEW("DFLG")!PSONEW("QFLG") D DEL Q  ;G START FAST OPTION
 ;Set chronic medication data in ^PSRX(,9999999)
 ;D ^PSOZCM ;IHS/DSD/ENM 11/8/93 NOW HANDLED IN PSODIR1
EXD ;IHS/DSD/ENM 4/20/94 Check %APSITE P11 for Exp Date
 ;I $P(%APSITE,U,11)]"" D ^PSOZEXP ;IHS/DSD/ENM DISABLED 12/22/94
 ;S PSONEW("RELEASED DATE/TIME")=PSONEW("ISSUE DATE") ;IHS/DSD/ENM 4/18/94
 D ^PSONEW2 I PSONEW("DFLG") D DEL Q  ;G START ; Asks if correct FAST OPTION
 D EN^PSON52(.PSONEW) ; Files entry in File 52
 I $G(APSP("CM"))]"" S $P(^PSRX(PSONEW("IRXN"),9999999),"^",2)=APSP("CM") ;IHS/DSD/ENM 09/19/96 SET CHRONIC MED
 ;I $D(^XUSEC("PSORPH",DUZ)) S APSPZRP=PSONEW("IRXN") ;IHS/DSD/ENM 12/1/95 VAR USED IN PSORX
 I $D(^XUSEC("PSORPH",DUZ)) S APSPZRP=$G(PSORX("PSOL",1)) ;IHS/DSD/ENM 12/1/95 VAR USED IN PSORX
 ;--- --- --- --- ---
 ;I $D(^XUSEC("PSORPH",DUZ)) D  ;IHS/DSD/ENM 11/30/95 RELEASE DT SET
 ;.S RXP=PSONEW("IRXN"),PSRH=DUZ,PSIN=$P($G(^PS(59.7,1,49.99)),"^",2)
 ;.D ^APSPDISP
 ;D NOW^%DTC S APSPZRD=% ;IHS/DSD/ENM USED FOR RELEASE DATE/TIME f31
 ;S DR="31////"_APSPZRD,DIE="^PSRX(",DA=PSONEW("IRXN") D ^DIE
EXDT ;EXPIRATION DATE SET FOR 9999999 NODE ;IHS/DSD/ENM 4/20/94
 ;I $D(P(99)) S ^PSRX(PSONEW("IRXN"),9999999)=$S('$D(^(9999999)):P(99),1:P(99)_U_$P(^(9999999),U,2,9))
 I $D(P(99)) S $P(^PSRX(PSONEW("IRXN"),9999999),"^")=+P(99) ;IHS/DSD/ENM 09/19/96
 D NPSOSD^PSOUTIL(.PSONEW) ; Adds newly added rx to PSOSD array
IHSH ;
 ;IHS/DSD/ENM 11/22/95 HOOK FOR DATA LINK TO IHS/PCC
 S APSPDOC1=$P($G(^VA(200,PSONEW("PROVIDER"),0)),U,16),APCDALVR("APCDTPRV")=$S($P($G(^AUTTSITE(1,0)),U,22):PSONEW("PROVIDER"),1:APSPDOC1) ;IHS/DSD/ENM 11/22/95
 ;IHS/DSD/ENM NEXT LINE COPIED AND PROVIDER VALUE CHANGED 11/22/95
 ;I $P(%APSITE,U,15)="Y" S APSRX=PSONEW("IRXN"),APCDALVR("APCDDATE")=PSONEW("ISSUE DATE"),APCDALVR("APCDTPRV")=PSONEW("PROVIDER") S:PSONEW("PATIENT STATUS")'=1 APCDALVR("APCDCAT")="I" D ^APSPCCN
 ;IHS/DSD/ENM 08/13/97 NEXT LINE COPIED AND NEW DATE VAR PASSED TO PCC
 ;I $P(%APSITE,U,15)="Y" S APSRX=PSONEW("IRXN"),APCDALVR("APCDDATE")=PSONEW("ISSUE DATE") S:PSONEW("PATIENT STATUS")'=1 APCDALVR("APCDCAT")="I" D ^APSPCCN
 I $P(%APSITE,U,15)="Y" S APSRX=PSONEW("IRXN"),APCDALVR("APCDDATE")=APSEFDT S:PSONEW("PATIENT STATUS")'=1 APCDALVR("APCDCAT")="I" D ^APSPCCN
 Q  ;G START FAST OPTION
END D EOJ ; Clean up          
 Q
 ;
 ;----------------------------------------------------------------
DISPLAY ;
 ;S (PSOOPT,PSOQFLG)=0 D ^PSODSPL
 S PSOOPT=-1,PSOQFLG=0 D ^PSODSPL ;IHS/DSD/ENM 3/29/94
 S APSPFLG=1 ;IHS/DSD/ENM 3/29/94
 I PSOQFLG S PSONEW("QFLG")=1
 K PSOQFLG
 Q
 ;
ASK ;
 S DIR(0)="SB^Y:YES;N:NO;P:PROFILE;R:REFILL;A:ALLERGIES/REACTIONS;G:GOTO NEW",DIR("B")="Y"
 S DIR("A")="NEW FAST RX FOR "_$G(PSORX("NAME"))_" ?"
 S DIR("?",1)="Enter a Y for Yes, N for No, a P to see a Profile,"
 S DIR("?")="a R to do refills if any are allowed or A to review Allergies."
 S DIR("?",2)="Enter a G for GOTO NEW"
 D ^DIR K DIR
 I $D(DIRUT) S (PSONEW("QFLG"),PSORX("QFLG"))=1 G ASKX
 I $G(Y)="N" S PSONEW("QFLG")=1 G ASKX
 ;IHS/DSD/ENM PSOBUILD CALL REMOVED IN PATCH 18 ;09-14-94
 I "Pp"[Y D ^PSOBUILD,^PSODSPL G ASK
 I "Rr"[Y S (PSORX("DO REFILL"),PSONEW("QFLG"))=1
 I "Aa"[Y D GMRA^PSODEM G ASK
 ;I "Gg"[Y S APSQFNEW=1,PSONEW("QFLG")=1 ;D INIT^PSORX ;OPTION IHS/OKCAO/POC 
 I "Gg"[Y S APSQFNEW=1,PSONEW("QFLG")=1,PSOFROM="NEW" ;D INIT^PSORX ;OPTION IHS/OKCAO/POC 
ASKX ;
 K DIRUT,DTOUT,DUOUT,X,Y
 Q
 ;
DEL ;
 W !,*7,"RX DELETED",!
 I $P($G(PSOPAR),"^",7)=1 D
 . S DIE="^PS(59,",DA=PSOSITE,PSOY=$O(PSONEW("OLD LAST RX#",""))
 . S PSOX=PSONEW("OLD LAST RX#",PSOY)
 . L +^PS(59,+PSOSITE,PSOY)
 . S DR=$S(PSOY=8:"2003////"_PSOX,PSOY=3:"1002.1////"_PSOX,1:"2003////"_PSOX)
 . D:PSOX<$P(^PS(59,+PSOSITE,PSOY),"^",3) ^DIE K DIE,X,Y
 . L -^PS(59,+PSOSITE,PSOY)
 . K PSOX,PSOY Q
EOJ ;
 L:$D(PSONEW("RX #")) -PSONRXN(PSONEW("RX #")) ; +Lock set in PSONRXN
 K PSODRUG,ANQDATA,LSI,C,MAX,MIN,NDF,REF,SIG,SER,PSOFLAG,PSOHI,PSOLO,APSPZRD
 K APSQFOPT ;FOR DAYS SUPPLY OPTION CALCULATING
 K APSPCM,APSPCA,APSPDOC1
 K:'$D(APSQFNEW) PSONEW
 Q