source: WorldVistAEHR/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQUTL95.m@ 1306

Last change on this file since 1306 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.8 KB
Line 
1VAQUTL95 ;ALB/JFP/JRP - SETS COMMONLY USED VARIABLES;01-APR-93
2 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
3 ;
4STATPTR ; -- Sets PDX status pointers
5 S (VAQRSLT,VAQUNSOL)=""
6 S VAQRSLT=$O(^VAT(394.85,"B","VAQ-RSLT",VAQRSLT))
7 S VAQUNSOL=$O(^VAT(394.85,"B","VAQ-UNSOL",VAQUNSOL))
8 QUIT
9 ;
10PAUSE ; -- Pauses the screen
11 W ! S DIR(0)="EA",DIR("A")="Press RETURN to continue:" D ^DIR K DIR W !
12 QUIT
13 ;
14END ; -- End of code
15 QUIT
16 ;
17IMPDTE(XMITDATE) ;CHECK DATE USED IN PDX TRANSMISSIONS FOR PRECISENESS
18 ;INPUT : XMITDATE - Date in format MM-DD-YYYY
19 ;OUTPUT : N - If date is precise, MM-DD-YYYY (what was sent)
20 ; If date is not precise
21 ; MM--YYYY if day is not precise
22 ; YYYY if month is not precise
23 ; -1 - Bad input
24 ;
25 ;CHECK INPUT
26 Q:($G(XMITDATE)="") -1
27 Q:(XMITDATE'?2N1"-"2N1"-"4N) -1
28 ;DECLARE VARIABLES
29 N MONTH,DAY,YEAR
30 ;GET PIECES OF DATE
31 S MONTH=$P(XMITDATE,"-",1)
32 S DAY=$P(XMITDATE,"-",2)
33 S YEAR=$P(XMITDATE,"-",3)
34 ;YEAR IS IMPRECISE (ERROR)
35 Q:('(+YEAR)) -1
36 ;MONTH NOT PRECISE
37 Q:('(+MONTH)) YEAR
38 ;DAY NOT PRECISE
39 Q:('(+DAY)) (MONTH_"--"_YEAR)
40 ;DATE IS PRECISE
41 Q XMITDATE
42 ;
43AMPMTIME(XMITTIME) ;PLACE AM/PM ON END OF TIME USED IN PDX TRANSMISSIONS
44 ;INPUT : XMITTIME - Time in format hh:mm:ss (seconds optional)
45 ;OUTPUT : N - XMITTIME concatenated with AM or PM
46 ; If time falls between midnight and noon, AM is used
47 ; If time falls between noon and midnight, PM is used
48 ; -1 - Bad input
49 ;NOTES : If seconds are not included, 00 will be used
50 ; : If time is exactly midnight, AM is used
51 ; : If time is exactly noon, PM is used
52 ; : If time is between 00:00:00 and 00:00:59, 00:01:00 will
53 ; be used as the input time (FileMan has problem with it)
54 ; : Time between midnight and one AM will return 12AM
55 ;
56 ;CHECK INPUT
57 Q:($G(XMITTIME)="") -1
58 S:(XMITTIME?2N1":"2N) XMITTIME=XMITTIME_":00"
59 S:(XMITTIME?2N1":"2N1":") XMITTIME=XMITTIME_"00"
60 Q:(XMITTIME'?2N1":"2N1":"2N) -1
61 S:(XMITTIME?1"00:00:"2N) XMITTIME="00:01:00"
62 ;DECLARE VARIABLES
63 N HOUR,OUTPUT
64 S HOUR=+$P(XMITTIME,":",1)
65 S OUTPUT=-1
66 ;MIDNIGHT TO NOON (AM) - CONVERT 00 AM TO 12 AM
67 I (HOUR<12) D
68 .S:('HOUR) OUTPUT="12:"_$P(XMITTIME,":",2,3)_"AM"
69 .S:(HOUR) OUTPUT=XMITTIME_"AM"
70 ;NOON TO MIDNIGHT (PM)
71 S:(HOUR>11) OUTPUT=XMITTIME_"PM"
72 Q OUTPUT
73 ;
74CHCKDT(XMITDT) ;CHECK DATE AND TIME OF PDX TRANSMISSION
75 ;INPUT : XMITDT - Date and time of transmission
76 ; MM-DD-YYYY@hh:mm:ss
77 ;OUTPUT : N - Date and time in acceptable FimeMan format
78 ; -1 - Bad input/error
79 ;NOTES : Refer to $$IMPDTE for date check
80 ; : Refer to $$AMPMTIME for time check
81 ;
82 ;CHECK INPUT
83 Q:($G(XMITDT)="") -1
84 ;DECLARE VARIABLES
85 N DATE,TIME
86 S DATE=$$IMPDTE($P(XMITDT,"@",1))
87 Q:(DATE="-1") -1
88 S TIME=$$AMPMTIME($P(XMITDT,"@",2))
89 Q:(TIME="-1") -1
90 Q (DATE_"@"_TIME)
Note: See TracBrowser for help on using the repository browser.