source: WorldVistAEHR/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCU.m@ 1005

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

initial load of WorldVistAEHR

File size: 3.1 KB
Line 
1GMRCU ;SLC/DLT - Consult/Request Utilities ;5/20/98 14:21
2 ;;3.0;CONSULT/REQUEST TRACKING;**1**;DEC 27, 1997
3MTIM ;CONVERT TIME from X=2890313.1304 INTO X=13:04
4 S X=$P(X,".",2) Q:'$L(X)
5 S X=$S(X:$E(X,1,2)_$E("00",0,2-$L($E(X,1,2)))_":"_$E(X,3,4)_$E("00",0,2-$L($E(X,3,4))),1:"")
6 Q
7REGDT ; Receives X in internal date.time, and returns X in MM/DD/YY format
8 S X=$S(X:$E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3),1:"")
9 Q
10REGDTM ;Receives X in internal date.time, and returns X in MM/DD/YY TT:TT
11 N T
12 S T=$P(X,".",2),X=$S(X:$E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3),1:"")_" "_$S(T:$E(T,1,2)_$E("00",0,2-$L($E(T,1,2)))_":"_$E(T,3,4)_$E("00",0,2-$L($E(T,3,4))),1:"")
13 Q
14SIDT ; Receives X as internal date/time and returns X in DD MMM YY
15 N MON,MM
16 S X=$P(X,".") I 'X S X="" Q
17 S MON="JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC"
18 S MM=$E(X,4,5),MM=$S(MM:$P(MON,U,MM),1:"")
19 S X=$E(X,6,7)_" "_MM_" "_$E(X,2,3)
20 Q
21FMHL7DTM ; Recieves X as internal date/time and returns X in CCYYMMDDHHMM
22 N T
23 S T=$P(X,".",2)
24 S T=$S(T:$E(T,1,2)_$E("00",0,2-$L($E(T,1,2)))_$E(T,3,4)_$E("00",0,2-$L($E(T,3,4))),1:"0000")
25 S X=($E($P(X,"."),1,3)+1700)_$E($P(X,"."),4,7)_T
26 Q
27HL7FMDTM ; Recieves X as CCYYMMDDHHMM and returns X as internal date/time
28 N DATE,TIME
29 S DATE=$E(X,1,8),TIME=$E(X,9,12)
30 S DATE=DATE-17000000,X=DATE_"."_TIME
31 Q
32DEM ; Gets Demographic Data from VADPT
33 ; Receives: DFN
34 ; Returns: GMRCPNM,GMRCSN,GMRCDOB,SEX,GMRCWARD,GMRCRB,GMRCAGE
35 ; and GMRCWLI,GMRCHLI
36 K VAINDT,VAHOW D OERR^VADPT
37 S GMRCPNM=VADM(1)
38 S GMRCSN=$S($D(VA("PID")):VA("PID"),1:$P(VADM(2),"^",2))
39 S GMRCAGE=VADM(4),SEX=$P(VADM(5),"^")
40 S GMRCWARD=$P(VAIN(4),"^",2),GMRCRB=VAIN(5),GMRCWLI=$P(VAIN(4),"^",1)
41 S GMRCDOB=$P(VADM(3),"^",2)
42 K VA,VAIN,VADM,VAERR
43 Q
44MD ; Format physician names ;4/4/89 11:39 ;
45 ; Recieves: IFN for New Person file as PR and desired name length, as NML
46 ; Returns: Lastname,FI to specified length as PR
47 N PRFI,PRLN,PRNM
48 S PRNM=$S(PR:$S($D(^VA(200,+PR,0)):$P(^(0),"^"),1:"UNKNOWN"),1:"UNKNOWN")
49 I PRNM?1A.A." ".A1",".A.E S PRLN=$P(PRNM,","),PRFI=$E($P(PRNM,",",2),1) I $L(PRLN)>(NML-2) S PRLN=$E(PRLN,1,(NML-2))
50 S PR=$S(PRNM="UNKNOWN":PRNM,1:PRLN_","_PRFI)
51 Q
52NAME ; Format names ;6/30/89 11:20 ;
53 ; Recieves: FILE (3 for User, 16 for Person, 6 for Provider)
54 ; IFN (Internal file # for above file),
55 ; NML (Desired length for name to be returned)
56 ; FNF (Flag to specify first name format: 0 for FI, 1 for FN)
57 ; Returns: Lastname,First(name/initial) to specified length as NM
58 ;
59 N DIC,RAWNM,LN,FN,FA,NI,CH,X,Y
60 S DIC=FILE,DIC(0)="NXZ",X=IFN D ^DIC S RAWNM=$S($D(Y(0,0)):Y(0,0),1:"UNKNOWN")
61 S LN=$P(RAWNM,","),FN=$P(RAWNM,",",2)
62 S FA=0 I $L(FN) F NI=1:1 S CH=$E(FN,NI) Q:CH?1A S FA=NI
63 I FA S FN=$E(FN,FA+1,$L(FN))
64 I 'FNF S FN=$E(FN,1)
65 S NM=$S($L(FN):LN_","_FN,1:LN),NM=$E(NM,1,NML)
66 K FILE,IFN,NML,FNF
67 Q
68PTRCLN ;Clean out subservice 'B' X-reference of deleted entries
69 S I=0 F S I=$O(^GMR(123.5,I)) Q:I<1 I $D(^(I,10,0)) S J=0 F S J=$O(^GMR(123.5,I,10,J)) Q:J<1 S ENTRY=+^(J,0) I '$D(^GMR(123.5,ENTRY,0)) K ^GMR(123.5,I,10,J,0),^GMR(123.5,I,10,"B",ENTRY) D
70 .S CNT=$P(^GMR(123.5,I,10,0),"^",4),$P(^(0),"^",4)=CNT-1
71 K CNT,ENTRY,I,J Q
Note: See TracBrowser for help on using the repository browser.