VAQUTL95 ;ALB/JFP/JRP - SETS COMMONLY USED VARIABLES;01-APR-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
;
STATPTR ; -- Sets PDX status pointers
S (VAQRSLT,VAQUNSOL)=""
S VAQRSLT=$O(^VAT(394.85,"B","VAQ-RSLT",VAQRSLT))
S VAQUNSOL=$O(^VAT(394.85,"B","VAQ-UNSOL",VAQUNSOL))
QUIT
;
PAUSE ; -- Pauses the screen
W ! S DIR(0)="EA",DIR("A")="Press RETURN to continue:" D ^DIR K DIR W !
QUIT
;
END ; -- End of code
QUIT
;
IMPDTE(XMITDATE) ;CHECK DATE USED IN PDX TRANSMISSIONS FOR PRECISENESS
;INPUT : XMITDATE - Date in format MM-DD-YYYY
;OUTPUT : N - If date is precise, MM-DD-YYYY (what was sent)
; If date is not precise
; MM--YYYY if day is not precise
; YYYY if month is not precise
; -1 - Bad input
;
;CHECK INPUT
Q:($G(XMITDATE)="") -1
Q:(XMITDATE'?2N1"-"2N1"-"4N) -1
;DECLARE VARIABLES
N MONTH,DAY,YEAR
;GET PIECES OF DATE
S MONTH=$P(XMITDATE,"-",1)
S DAY=$P(XMITDATE,"-",2)
S YEAR=$P(XMITDATE,"-",3)
;YEAR IS IMPRECISE (ERROR)
Q:('(+YEAR)) -1
;MONTH NOT PRECISE
Q:('(+MONTH)) YEAR
;DAY NOT PRECISE
Q:('(+DAY)) (MONTH_"--"_YEAR)
;DATE IS PRECISE
Q XMITDATE
;
AMPMTIME(XMITTIME) ;PLACE AM/PM ON END OF TIME USED IN PDX TRANSMISSIONS
;INPUT : XMITTIME - Time in format hh:mm:ss (seconds optional)
;OUTPUT : N - XMITTIME concatenated with AM or PM
; If time falls between midnight and noon, AM is used
; If time falls between noon and midnight, PM is used
; -1 - Bad input
;NOTES : If seconds are not included, 00 will be used
; : If time is exactly midnight, AM is used
; : If time is exactly noon, PM is used
; : If time is between 00:00:00 and 00:00:59, 00:01:00 will
; be used as the input time (FileMan has problem with it)
; : Time between midnight and one AM will return 12AM
;
;CHECK INPUT
Q:($G(XMITTIME)="") -1
S:(XMITTIME?2N1":"2N) XMITTIME=XMITTIME_":00"
S:(XMITTIME?2N1":"2N1":") XMITTIME=XMITTIME_"00"
Q:(XMITTIME'?2N1":"2N1":"2N) -1
S:(XMITTIME?1"00:00:"2N) XMITTIME="00:01:00"
;DECLARE VARIABLES
N HOUR,OUTPUT
S HOUR=+$P(XMITTIME,":",1)
S OUTPUT=-1
;MIDNIGHT TO NOON (AM) - CONVERT 00 AM TO 12 AM
I (HOUR<12) D
.S:('HOUR) OUTPUT="12:"_$P(XMITTIME,":",2,3)_"AM"
.S:(HOUR) OUTPUT=XMITTIME_"AM"
;NOON TO MIDNIGHT (PM)
S:(HOUR>11) OUTPUT=XMITTIME_"PM"
Q OUTPUT
;
CHCKDT(XMITDT) ;CHECK DATE AND TIME OF PDX TRANSMISSION
;INPUT : XMITDT - Date and time of transmission
; MM-DD-YYYY@hh:mm:ss
;OUTPUT : N - Date and time in acceptable FimeMan format
; -1 - Bad input/error
;NOTES : Refer to $$IMPDTE for date check
; : Refer to $$AMPMTIME for time check
;
;CHECK INPUT
Q:($G(XMITDT)="") -1
;DECLARE VARIABLES
N DATE,TIME
S DATE=$$IMPDTE($P(XMITDT,"@",1))
Q:(DATE="-1") -1
S TIME=$$AMPMTIME($P(XMITDT,"@",2))
Q:(TIME="-1") -1
Q (DATE_"@"_TIME)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQUTL95 2971 printed Oct 16, 2024@18:27:46 Page 2
VAQUTL95 ;ALB/JFP/JRP - SETS COMMONLY USED VARIABLES;01-APR-93
+1 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
+2 ;
STATPTR ; -- Sets PDX status pointers
+1 SET (VAQRSLT,VAQUNSOL)=""
+2 SET VAQRSLT=$ORDER(^VAT(394.85,"B","VAQ-RSLT",VAQRSLT))
+3 SET VAQUNSOL=$ORDER(^VAT(394.85,"B","VAQ-UNSOL",VAQUNSOL))
+4 QUIT
+5 ;
PAUSE ; -- Pauses the screen
+1 WRITE !
SET DIR(0)="EA"
SET DIR("A")="Press RETURN to continue:"
DO ^DIR
KILL DIR
WRITE !
+2 QUIT
+3 ;
END ; -- End of code
+1 QUIT
+2 ;
IMPDTE(XMITDATE) ;CHECK DATE USED IN PDX TRANSMISSIONS FOR PRECISENESS
+1 ;INPUT : XMITDATE - Date in format MM-DD-YYYY
+2 ;OUTPUT : N - If date is precise, MM-DD-YYYY (what was sent)
+3 ; If date is not precise
+4 ; MM--YYYY if day is not precise
+5 ; YYYY if month is not precise
+6 ; -1 - Bad input
+7 ;
+8 ;CHECK INPUT
+9 if ($GET(XMITDATE)="")
QUIT -1
+10 if (XMITDATE'?2N1"-"2N1"-"4N)
QUIT -1
+11 ;DECLARE VARIABLES
+12 NEW MONTH,DAY,YEAR
+13 ;GET PIECES OF DATE
+14 SET MONTH=$PIECE(XMITDATE,"-",1)
+15 SET DAY=$PIECE(XMITDATE,"-",2)
+16 SET YEAR=$PIECE(XMITDATE,"-",3)
+17 ;YEAR IS IMPRECISE (ERROR)
+18 if ('(+YEAR))
QUIT -1
+19 ;MONTH NOT PRECISE
+20 if ('(+MONTH))
QUIT YEAR
+21 ;DAY NOT PRECISE
+22 if ('(+DAY))
QUIT (MONTH_"--"_YEAR)
+23 ;DATE IS PRECISE
+24 QUIT XMITDATE
+25 ;
AMPMTIME(XMITTIME) ;PLACE AM/PM ON END OF TIME USED IN PDX TRANSMISSIONS
+1 ;INPUT : XMITTIME - Time in format hh:mm:ss (seconds optional)
+2 ;OUTPUT : N - XMITTIME concatenated with AM or PM
+3 ; If time falls between midnight and noon, AM is used
+4 ; If time falls between noon and midnight, PM is used
+5 ; -1 - Bad input
+6 ;NOTES : If seconds are not included, 00 will be used
+7 ; : If time is exactly midnight, AM is used
+8 ; : If time is exactly noon, PM is used
+9 ; : If time is between 00:00:00 and 00:00:59, 00:01:00 will
+10 ; be used as the input time (FileMan has problem with it)
+11 ; : Time between midnight and one AM will return 12AM
+12 ;
+13 ;CHECK INPUT
+14 if ($GET(XMITTIME)="")
QUIT -1
+15 if (XMITTIME?2N1"
SET XMITTIME=XMITTIME_":00"
+16 if (XMITTIME?2N1"
SET XMITTIME=XMITTIME_"00"
+17 if (XMITTIME'?2N1"
QUIT -1
+18 if (XMITTIME?1"00
SET XMITTIME="00:01:00"
+19 ;DECLARE VARIABLES
+20 NEW HOUR,OUTPUT
+21 SET HOUR=+$PIECE(XMITTIME,":",1)
+22 SET OUTPUT=-1
+23 ;MIDNIGHT TO NOON (AM) - CONVERT 00 AM TO 12 AM
+24 IF (HOUR<12)
Begin DoDot:1
+25 if ('HOUR)
SET OUTPUT="12:"_$PIECE(XMITTIME,":",2,3)_"AM"
+26 if (HOUR)
SET OUTPUT=XMITTIME_"AM"
End DoDot:1
+27 ;NOON TO MIDNIGHT (PM)
+28 if (HOUR>11)
SET OUTPUT=XMITTIME_"PM"
+29 QUIT OUTPUT
+30 ;
CHCKDT(XMITDT) ;CHECK DATE AND TIME OF PDX TRANSMISSION
+1 ;INPUT : XMITDT - Date and time of transmission
+2 ; MM-DD-YYYY@hh:mm:ss
+3 ;OUTPUT : N - Date and time in acceptable FimeMan format
+4 ; -1 - Bad input/error
+5 ;NOTES : Refer to $$IMPDTE for date check
+6 ; : Refer to $$AMPMTIME for time check
+7 ;
+8 ;CHECK INPUT
+9 if ($GET(XMITDT)="")
QUIT -1
+10 ;DECLARE VARIABLES
+11 NEW DATE,TIME
+12 SET DATE=$$IMPDTE($PIECE(XMITDT,"@",1))
+13 if (DATE="-1")
QUIT -1
+14 SET TIME=$$AMPMTIME($PIECE(XMITDT,"@",2))
+15 if (TIME="-1")
QUIT -1
+16 QUIT (DATE_"@"_TIME)