YSCLHLFN ;DSS-PO/HEC-hrubovcak - Testing support - CLOZAPINE DATA TRANSMISSION ;19 May 2020 14:13:48
;;5.01;MENTAL HEALTH;**149**;Dec 30, 1994;Build 72
Q
;
; Reference to ^DIC supported by DBIA #2051
; Reference to ^XLFDT supported by DBIA #10103
;
TSEND ; SEND HL7 message - Entry point for development /testing
N DFN,HLRSLT,J,PSGORD,PSORXIEN
W !,"Send the HL7 message(s) to Healthshare for selected patient.",!
D ASKUSER(.DFN,.PSGORD,.PSORXIEN)
I 'DFN W !,"No Patient defined" Q
;
S X=$$NOW^XLFDT W !!,"Current Time: ",$$FMTE^XLFDT(X,"2S")," (",X,")"
W !,"DFN = ",DFN," PSOGORD = ",PSGORD," PSORXIEN = ",PSORXIEN,!
D SENDHL7(DFN,PSGORD,PSORXIEN,.HLRSLT)
I '$O(HLRSLT(0)) W !,"Nothing sent."
S J=0 F S J=$O(HLRSLT(J)) Q:'J W !,"HLO message info: "_HLRSLT(J)
Q
;
TGET ; Display YSCLARR values - Entry point for development /testing
N DFN,PSGORD,PSORXIEN,V K YSCLARR
W !,"Get the YSCLARR values for a given patient. It is safe to run anytime."
W !,"No HL7 message will be sent.",!
D ASKUSER(.DFN,.PSGORD,.PSORXIEN)
I 'DFN W !,"No Patient defined" Q
;
D GET^YSCLHLGT(.YSCLARR,DFN,PSGORD,PSORXIEN)
S V="YSCLARR" F S V=$Q(@V) Q:V="" W !,V_$C(61,34)_@V_$C(34)
Q
;
TSAVE ; SAVE message data - Entry point for development / testing
N DFN,PSGORD,PSORXIEN
W !,"Save the YSCLARR in "_$NA(^XTMP("YSCLHL7"))_" global for later HL7 Message transfer to HS",!
D ASKUSER(.DFN,.PSGORD,.PSORXIEN)
I 'DFN W !,"No Patient defined" Q
; not used
;D SAVEDATA^YSCLHLMA(DFN,PSGORD,PSORXIEN)
Q
;
SENDHL7(DFN,PSGORD,PSORXIEN,HLRSLT) ; Build and send registration and clinical/dispense messages
; input: DFN patient file IEN
; PSGORD parmacy patient file UnitDose ien e.g. 167 or 167U
; PSORXIEN prescription ien of prescription file
K HLRSLT ; passed by ref.
K YSCLARR ; in symbol table
N I,NODE,YSUDSIEN
I $G(PSGORD)>0 D
. S YSUDSIEN=+$G(PSGORD("UNDSIEN"))
. D GETCLZOR^YSCLHLGT(.YSCLARR,DFN,YSUDSIEN)
. D GET^YSCLHLGT(.YSCLARR,DFN,PSGORD,0)
. D XMI1PT^YSCLHLMA(.YSCLARR,.HLRSLT)
;
;
I $G(PSORXIEN) D
. D GET^YSCLHLGT(.YSCLARR,DFN,0,PSORXIEN)
. D XMI1PT^YSCLHLMA(.YSCLARR,.HLRSLT)
;
Q
;
ASKUSER(DFN,PSGORD,PSORXIEN) ; ask user for input, all vars. passed by ref.
;
; Select patient from CLOZAPINE PATIENT LIST
N D,DIC,X,Y,YSCLP,YSCLR,DUOUT
;
S DFN=0,PSGORD=0,PSORXIEN=0,DIC=603.01,DIC(0)="AEMQZ"
S DIC("W")="N YS0 S YS0=^(0) W "" "",$P(^DPT($P(YS0,U,2),0),U),"" (#"",$P(YS0,U,2),"")"""
D ^DIC
I $G(DUOUT) S DFN=0 W !,"Aborted...." Q
S DFN=+$P($G(Y(0)),U,2)
Q:'(DFN>0)
;
K DIC S DIC="^PS(55,"_DFN_",5," S DIC(0)="AEMQZ" D ^DIC
I $G(DUOUT) S DFN=0 W !,"Aborted...." Q
S PSGORD=$S($P($G(Y),U)>0:$P($G(Y),U),1:0)
I PSGORD S PSGORD("UNDSIEN")=+Y
;
I PSGORD=0 D
. K DIC S DIC="^PS(55,"_DFN_",""P""," S DIC(0)="AEQZ"
. S DIC("W")="N YS0,YSDRG S YS0=^(0),YSDRG=$P($G(^PSDRUG(+$P($G(^PSRX(+YS0,0)),U,6),0)),U) W "" - ""_YSDRG"
. D ^DIC
. I $G(DUOUT) S DFN=0 W !,"Aborted...." Q
. S PSORXIEN=$S($G(Y(0))>0:$G(Y(0)),1:0)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYSCLHLFN 3096 printed Dec 13, 2024@02:13:40 Page 2
YSCLHLFN ;DSS-PO/HEC-hrubovcak - Testing support - CLOZAPINE DATA TRANSMISSION ;19 May 2020 14:13:48
+1 ;;5.01;MENTAL HEALTH;**149**;Dec 30, 1994;Build 72
+2 QUIT
+3 ;
+4 ; Reference to ^DIC supported by DBIA #2051
+5 ; Reference to ^XLFDT supported by DBIA #10103
+6 ;
TSEND ; SEND HL7 message - Entry point for development /testing
+1 NEW DFN,HLRSLT,J,PSGORD,PSORXIEN
+2 WRITE !,"Send the HL7 message(s) to Healthshare for selected patient.",!
+3 DO ASKUSER(.DFN,.PSGORD,.PSORXIEN)
+4 IF 'DFN
WRITE !,"No Patient defined"
QUIT
+5 ;
+6 SET X=$$NOW^XLFDT
WRITE !!,"Current Time: ",$$FMTE^XLFDT(X,"2S")," (",X,")"
+7 WRITE !,"DFN = ",DFN," PSOGORD = ",PSGORD," PSORXIEN = ",PSORXIEN,!
+8 DO SENDHL7(DFN,PSGORD,PSORXIEN,.HLRSLT)
+9 IF '$ORDER(HLRSLT(0))
WRITE !,"Nothing sent."
+10 SET J=0
FOR
SET J=$ORDER(HLRSLT(J))
if 'J
QUIT
WRITE !,"HLO message info: "_HLRSLT(J)
+11 QUIT
+12 ;
TGET ; Display YSCLARR values - Entry point for development /testing
+1 NEW DFN,PSGORD,PSORXIEN,V
KILL YSCLARR
+2 WRITE !,"Get the YSCLARR values for a given patient. It is safe to run anytime."
+3 WRITE !,"No HL7 message will be sent.",!
+4 DO ASKUSER(.DFN,.PSGORD,.PSORXIEN)
+5 IF 'DFN
WRITE !,"No Patient defined"
QUIT
+6 ;
+7 DO GET^YSCLHLGT(.YSCLARR,DFN,PSGORD,PSORXIEN)
+8 SET V="YSCLARR"
FOR
SET V=$QUERY(@V)
if V=""
QUIT
WRITE !,V_$CHAR(61,34)_@V_$CHAR(34)
+9 QUIT
+10 ;
TSAVE ; SAVE message data - Entry point for development / testing
+1 NEW DFN,PSGORD,PSORXIEN
+2 WRITE !,"Save the YSCLARR in "_$NAME(^XTMP("YSCLHL7"))_" global for later HL7 Message transfer to HS",!
+3 DO ASKUSER(.DFN,.PSGORD,.PSORXIEN)
+4 IF 'DFN
WRITE !,"No Patient defined"
QUIT
+5 ; not used
+6 ;D SAVEDATA^YSCLHLMA(DFN,PSGORD,PSORXIEN)
+7 QUIT
+8 ;
SENDHL7(DFN,PSGORD,PSORXIEN,HLRSLT) ; Build and send registration and clinical/dispense messages
+1 ; input: DFN patient file IEN
+2 ; PSGORD parmacy patient file UnitDose ien e.g. 167 or 167U
+3 ; PSORXIEN prescription ien of prescription file
+4 ; passed by ref.
KILL HLRSLT
+5 ; in symbol table
KILL YSCLARR
+6 NEW I,NODE,YSUDSIEN
+7 IF $GET(PSGORD)>0
Begin DoDot:1
+8 SET YSUDSIEN=+$GET(PSGORD("UNDSIEN"))
+9 DO GETCLZOR^YSCLHLGT(.YSCLARR,DFN,YSUDSIEN)
+10 DO GET^YSCLHLGT(.YSCLARR,DFN,PSGORD,0)
+11 DO XMI1PT^YSCLHLMA(.YSCLARR,.HLRSLT)
End DoDot:1
+12 ;
+13 ;
+14 IF $GET(PSORXIEN)
Begin DoDot:1
+15 DO GET^YSCLHLGT(.YSCLARR,DFN,0,PSORXIEN)
+16 DO XMI1PT^YSCLHLMA(.YSCLARR,.HLRSLT)
End DoDot:1
+17 ;
+18 QUIT
+19 ;
ASKUSER(DFN,PSGORD,PSORXIEN) ; ask user for input, all vars. passed by ref.
+1 ;
+2 ; Select patient from CLOZAPINE PATIENT LIST
+3 NEW D,DIC,X,Y,YSCLP,YSCLR,DUOUT
+4 ;
+5 SET DFN=0
SET PSGORD=0
SET PSORXIEN=0
SET DIC=603.01
SET DIC(0)="AEMQZ"
+6 SET DIC("W")="N YS0 S YS0=^(0) W "" "",$P(^DPT($P(YS0,U,2),0),U),"" (#"",$P(YS0,U,2),"")"""
+7 DO ^DIC
+8 IF $GET(DUOUT)
SET DFN=0
WRITE !,"Aborted...."
QUIT
+9 SET DFN=+$PIECE($GET(Y(0)),U,2)
+10 if '(DFN>0)
QUIT
+11 ;
+12 KILL DIC
SET DIC="^PS(55,"_DFN_",5,"
SET DIC(0)="AEMQZ"
DO ^DIC
+13 IF $GET(DUOUT)
SET DFN=0
WRITE !,"Aborted...."
QUIT
+14 SET PSGORD=$SELECT($PIECE($GET(Y),U)>0:$PIECE($GET(Y),U),1:0)
+15 IF PSGORD
SET PSGORD("UNDSIEN")=+Y
+16 ;
+17 IF PSGORD=0
Begin DoDot:1
+18 KILL DIC
SET DIC="^PS(55,"_DFN_",""P"","
SET DIC(0)="AEQZ"
+19 SET DIC("W")="N YS0,YSDRG S YS0=^(0),YSDRG=$P($G(^PSDRUG(+$P($G(^PSRX(+YS0,0)),U,6),0)),U) W "" - ""_YSDRG"
+20 DO ^DIC
+21 IF $GET(DUOUT)
SET DFN=0
WRITE !,"Aborted...."
QUIT
+22 SET PSORXIEN=$SELECT($GET(Y(0))>0:$GET(Y(0)),1:0)
End DoDot:1