source: FOIAVistA/trunk/r/HOSPITAL_BASED_HOME_CARE-HBH/HBHCXMV.m@ 749

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

initial load of FOIAVistA 6/30/08 version

File size: 3.8 KB
Line 
1HBHCXMV ; LR VAMC(IRMS)/MJT-HBHC populate ^HBHC(634 with Visit Data, or ^HBHC(634.5, file of recs in ^HBHC(632 w/pseudo SSNs, called by ^HBHCFILE, calls HBHCXMV1 ; Oct 2000
2 ;;1.0;HOSPITAL BASED HOME CARE;**2,5,6,9,12,15,17,14,19**;NOV 01, 1993
3 D START^HBHCXMV1
4LOOP ; Loop thru ^HBHC(632) "AC","N" cross-ref to create nodes in ^HBHC(634) => transmit
5 S HBHCDFN="" F S HBHCDFN=$O(^HBHC(632,"AC","N",HBHCDFN)) Q:HBHCDFN="" D SETNODE
6EXIT ; Exit module
7 D EXIT^HBHCXMV1
8 Q
9SETNODE ; Set node in ^HBHC(634) (Transmit)
10 S HBHCINFO=^HBHC(632,HBHCDFN,0),HBHCXMT4=$P(HBHCINFO,U,8),HBHCAPDT=$P(HBHCINFO,U,2),HBHCSSN=$P(^DPT($P(HBHCINFO,U),0),U,9)
11 Q:$P(HBHCINFO,U,7)]"" ; cancelled/no show appointment
12 Q:HBHCAPDT>HBHCLSDT ; Visit appointment date > HBHCLSDT (last date to include in transmit set up in ^HBHCFILE)
13 I HBHCAPDT<2961001 D PCE^HBHCXMV1 Q
14 I HBHCSSN'?9N D PSSN^HBHCXMV1 Q
15 S HBHCPRV=+^HBHC(631.4,$P(HBHCINFO,U,4),0) S:$L(HBHCPRV)'=4 HBHCPRV=HBHCPRV_HBHCSP1
16 S HBHCTIME=$P(HBHCAPDT,".",2) S:$L(HBHCTIME)<4 HBHCTIME=HBHCTIME_$E(HBHCZRO4,1,(4-($L(HBHCTIME)))) S:$L(HBHCTIME)>4 HBHCTIME=$E(HBHCTIME,1,4)
17 S HBHCDATE=$E(HBHCAPDT,4,5)_$E(HBHCAPDT,6,7)_(1700+$E(HBHCAPDT,1,3))_HBHCTIME
18 S HBHCLNME=$P($P(^DPT($P(HBHCINFO,U),0),U),",") S:$L(HBHCLNME)'=11 HBHCLNME=$S($L(HBHCLNME)<11:HBHCLNME_$E(HBHCSP10,1,11-$L(HBHCLNME)),1:$E(HBHCLNME,1,11))
19 S HBHCQAI=$S(($L($P(HBHCINFO,U,16))=1)&($E(HBHCINFO,U,16)=""):HBHCSP1_$P(HBHCINFO,U,16),($L($P(HBHCINFO,U,16))=1)&($E(HBHCINFO,U,16)]""):$P(HBHCINFO,U,16)_HBHCSP1,$L($P(HBHCINFO,U,16))=2:$P(HBHCINFO,U,16),1:HBHCSP2)
20DX ; Dx
21 D INIT,DX^HBHCUTL3
22 S HBHCL=0 F S HBHCL=$O(HBHCDX(HBHCL)) Q:HBHCL'>0 S HBHCDX=$P(HBHCDX(HBHCL)," "),HBHCDX=$P(HBHCDX,".")_$P(HBHCDX,".",2) S HBHCDX(HBHCL)=$S($L(HBHCDX)'=6:HBHCDX_$E(HBHCSP6,1,6-$L(HBHCDX)),1:HBHCDX)
23 ; Note: HBHCI initialized here vs in CPT loop, since need HBHCI to continue for each 10 CPT code iteration
24 S (HBHCFLAG,HBHCI,HBHCL)=0 F S HBHCL=$O(HBHCDX(HBHCL)) Q:HBHCL'>0 S HBHCCNT1=HBHCCNT1+1,@("HBHCDX"_HBHCCNT1)=HBHCDX(HBHCL) D:(HBHCCNT1=5)&('HBHCFLAG) CPT D:HBHCCNT1=5 WRITE
25 F D:'HBHCFLAG CPT D WRITE Q:HBHCFLAG
26 Q
27CPT ; CPT Codes
28 F HBHCCNT=1:1:10 S HBHCI=$O(^HBHC(632,HBHCDFN,2,HBHCI)) Q:HBHCI'>0 S HBHCNOD2=^HBHC(632,HBHCDFN,2,HBHCI,0) D SET
29 S:HBHCI'>0 HBHCFLAG=1
30 Q
31SET ; Set CPT variables
32 I HBHCCNT<10 S @("HBHCCPT"_HBHCCNT)=$S($P(HBHCNOD2,U)]"":$E($P($G(^ICPT($P(HBHCNOD2,U),0)),U),1,5),1:HBHCSP5) S:$L(@("HBHCCPT"_HBHCCNT))'=5 @("HBHCCPT"_HBHCCNT)=@("HBHCCPT"_HBHCCNT)_$E(HBHCSP5,1,5-$L(@("HBHCCPT"_HBHCCNT)))
33 I HBHCCNT=10 S HBHCCP10=$S($P(HBHCNOD2,U)]"":$E($P($G(^ICPT($P(HBHCNOD2,U),0)),U),1,5),1:HBHCSP5) S:$L(HBHCCP10)'=5 HBHCCP10=HBHCCP10_$E(HBHCSP5,1,5-$L(HBHCCP10))
34 Q
35WRITE ; Write transmit record, separate records containing max 5 DX & 10 CPTs each are generated for same visit if > 5 DX or > 10 CPTs exist
36 Q:(HBHCDX1=HBHCSP6)&(HBHCCPT1=HBHCSP5)
37 L +^HBHC(634,0) S HBHCNDX1=$P(^HBHC(634,0),U,3)+1 F Q:'$D(^HBHC(634,HBHCNDX1)) S HBHCNDX1=HBHCNDX1+1
38 S $P(^HBHC(634,0),U,3)=HBHCNDX1,$P(^HBHC(634,0),U,4)=$P(^HBHC(634,0),U,4)+1 L -^HBHC(634,0)
39 S HBHCREC=HBHCFORM_HBHCHOSP_HBHCSSN_HBHCDATE_HBHCPRV_HBHCLNME_HBHCQAI_HBHCDX1_HBHCDX2_HBHCDX3_HBHCDX4_HBHCDX5_HBHCCPT1_HBHCCPT2_HBHCCPT3_HBHCCPT4_HBHCCPT5_HBHCCPT6_HBHCCPT7_HBHCCPT8_HBHCCPT9_HBHCCP10_HBHCSP24
40 S ^HBHC(634,HBHCNDX1,0)=HBHCREC,^HBHC(634,"B",$E(HBHCREC,1,30),HBHCNDX1)=""
41 ; Flag record as filed
42 L +^HBHC(632,HBHCDFN,0) K:HBHCXMT4]"" ^HBHC(632,"AC",HBHCXMT4,HBHCDFN) S $P(^HBHC(632,HBHCDFN,0),U,8)="F",^HBHC(632,"AC","F",HBHCDFN)="",$P(^HBHC(632,HBHCDFN,0),U,9)=HBHCTDY L -^HBHC(632,HBHCDFN,0)
43 ; Initialize QAI, DX & CPT fields to spaces after 1st record written to avoid multiple count(s) of same data when > 5 DX or > 10 CPTs exist
44 S HBHCQAI=HBHCSP2
45INIT ; Initialize variables
46 F HBHCK=1:1:5 S @("HBHCDX"_HBHCK)=HBHCSP6
47 S (HBHCCNT,HBHCCNT1)=0,HBHCCP10=HBHCSP5
48 F HBHCJ=1:1:9 S @("HBHCCPT"_HBHCJ)=HBHCSP5
49 Q
Note: See TracBrowser for help on using the repository browser.