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

PSOERXH2.m

Go to the documentation of this file.
PSOERXH2 ;BIR/MFR - eRx Hold Utilities ; 12/12/22 9:53am
 ;;7.0;OUTPATIENT PHARMACY;**700**;MAY 2021;Build 261
 ;
BATCHHLD(ERXIEN,HOLDIEN,HOLDCOMM,TYPE) ; Batch Hold/Un-Hold for Additional eRx (Same Day, Patient and Provider) 
 ;Input: ERXIEN   - eRx IEN (Pointer to #52.49)
 ;       HOLDIEN  - Hold Code IEN (Pointer to #52.45)
 ;       HOLDCOMM - Hold/Un-Hold Comments
 ;       TYPE     - H: Hold | U:Un-Hold
 N MSGDTTM,EPRVIEN,EPATIEN,RECDAT,HOLDERX,HOLDARR,MTYPE,NEWSTS
 S MSGDTTM=$$GET1^DIQ(52.49,ERXIEN,.03,"I")
 S EPRVIEN=+$$GET1^DIQ(52.49,ERXIEN,2.1,"I")
 S EPATIEN=+$$GET1^DIQ(52.49,ERXIEN,.04,"I")
 S RECDAT=MSGDTTM\1
 F  S RECDAT=$O(^PS(52.49,"PAT2",EPATIEN,RECDAT)) Q:'RECDAT!((RECDAT\1)'=(MSGDTTM\1))  D
 . S HOLDERX=0 F  S HOLDERX=$O(^PS(52.49,"PAT2",EPATIEN,RECDAT,HOLDERX)) Q:'HOLDERX  D
 . . I ERXIEN=HOLDERX Q
 . . I TYPE="H",'$F(",I,N,",","_$$GET1^DIQ(52.49,HOLDERX,1,"E")_",") Q
 . . I TYPE="U",HOLDIEN'=$$GET1^DIQ(52.49,HOLDERX,1,"I") Q
 . . I EPRVIEN'=$$GET1^DIQ(52.49,HOLDERX,2.1,"I") Q
 . . S HOLDARR(HOLDERX)=HOLDERX
 I '$D(HOLDARR) Q
 ;
 W !!,"The following prescriptions are from the same provider and received on the"
 W !,"same day:",!
 W !,"PROVIDER: "_$$GET1^DIQ(52.49,ERXIEN,2.1),?40,"eRx RECEIVED DATE: "_$$GET1^DIQ(52.49,ERXIEN,.03)
 D LSTERXS^PSOERPT1(.HOLDARR,0,0)
 W !
 N X,Y,DIR,DTOUT,DUOUT,DIROUT,DIRUT
 S DIR(0)="Y",DIR("A")="Do you want to "
 I TYPE="H" S DIR("A")=DIR("A")_"put them on HOLD-"_$$GET1^DIQ(52.45,HOLDIEN,.01)
 I TYPE="U" S DIR("A")=DIR("A")_"remove them from HOLD"
 S DIR("B")="No" D ^DIR I '$G(Y) Q
 ;
 W ?50,"Updating..."
 S HOLDERX=0
 F  S HOLDERX=$O(HOLDARR(HOLDERX)) Q:'HOLDERX  D
 . I TYPE="H" S NEWSTS=HOLDIEN
 . I TYPE="U" D
 . . S MSGTYPE=$$GET1^DIQ(52.49,PSOIEN,.08,"I")
 . . I MSGTYPE="RE" S NEWSTS=$$PRESOLV^PSOERXA1("RXI","ERX") Q
 . . I MSGTYPE="CX" S NEWSTS=$$PRESOLV^PSOERXA1("CXI","ERX") Q
 . . S NEWSTS=$$PRESOLV^PSOERXA1("I","ERX")
 . D UPDSTAT^PSOERXU1(HOLDERX,$$GET1^DIQ(52.45,NEWSTS,.01),HOLDCOMM)
 . ;S DIE="52.49",DR="1////"_HOLDIEN,DA=HOLDERX D ^DIE K DIE
 H .5 W "done.",$C(7) H 1
 Q