source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPMGLG1.m@ 1259

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

initial load of WorldVistAEHR

File size: 1.8 KB
Line 
1DGPMGLG1 ;ALB/LM - G&L GENERATION, CONT.; 23 MAY 90
2 ;;5.3;Registration;;Aug 13, 1993
3 ;
4A S DFN=+$P(MD,"^",3),ID="",DPT=$S($D(^DPT(DFN,0)):^(0),1:"")
5 D GL,BS,ONEDAY,ASIH
6Q K X,X1,X2,J,L
7 Q
8 ;
9GL Q:'GL
10 S MV("SS")=$S($P(DPT,"^",9)]"":$E($P(DPT,"^",9),+SS,10),1:"NO SS") ; SS=SSN format short/long
11 I $P(DPT,"^",1)']"" S MV("NM")="UNKNOWN,#"_DFN Q
12 S MV("NM")=$E($P(DPT,"^",1),1,18),X=$P(MV("NM"),",",1),X1=$P(MV("NM"),",",2),X2=$E(X1)
13 F J=2:1:$L(X1) S L=$E(X1,J) X "S A=$A(L) I A>64,A<91,$E(X1,J-1)?1A S L=$C(A+32)" S X2=X2_L
14 S MV("NM")=X_","_X2 ; first name to lower case format
15 Q
16 ;
17BS S MV("FM")=+$P(MD,"^",4) ; facility movement
18 S MV("CA")=+$P(MD,"^",14) ; corresponding admission
19 S MV("MT")=+$P(MD,"^",18) ; movement type
20 S MV("TT")=+$P(MD,"^",2) ; transaction type
21 S AD=$S($D(^DGPM(+MV("CA"),0)):^(0),1:"") ; admission movement node
22 S MDP="",X=$O(^DGPM("APMV",DFN,MV("CA"),9999999.9999999-(MD+($P(MD,"^",22)/10000000))))
23 S MIFN=$O(^DGPM("APMV",DFN,MV("CA"),+X,0)) ; MIFN=Movement IFN
24 I MIFN,$D(^DGPM(+MIFN,0)) S MDP=^(0) ; movement data previous
25 Q
26 ;
27ONEDAY S MV("OD")=0 I MV("TT")=3,$P(+AD,".")=$P(+MD,".") S MV("OD")=1 ; date compare adm vs. movement
28 Q
29 ;
30ASIH S MV("AS")=0
31 Q:MV("MT")'=42 ; 42=while ASIH
32 S MV("AS")=1,X=$O(^DGPM("APID",DFN,9999999.9999999-(MD+($P(MD,"^",22)/10000000))))
33 S X=$O(^DGPM("APID",DFN,+X,0))
34 S:X X=$S($D(^DGPM(+X,0)):^(0),1:"")
35 Q:'X
36 Q:$P($P(X,"^"),".")'=$P($P(MD,"^"),".")
37 Q:$P(X,"^",2)'=3 ; 3=discharge
38 S MV("AS")=$P(X,"^",18)
39 Q
40 ;
41VAR ; MV("SS")=SS Number
42 ; MV("NM")=Name format
43 ; MV("FM")=Facility Movement
44 ; MV("CA")=Corresponding Admission
45 ; MV("MT")=Movement Type
46 ; MV("TT")=Transaction Type
47 ; AD=Admission Movement Node
48 ; MV("OD")=One Day
49 ; MDP=Movement Data Previous
50 ; MIFN=Movement IFN
51 ; MV("AS")=while ASIH
Note: See TracBrowser for help on using the repository browser.