source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SDAMBMR1.m@ 1765

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

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1SDAMBMR1 ;ALB/MLI - AMBULATORY PROCEDURE MANAGEMENT REPORTS ; 4/27/00 10:39am
2 ;;5.3;Scheduling;**28,132,180**;Aug 13, 1993
3 S (SDCL,SDT)=$P(SDOE0,U,4) Q:$S('SDT:1,'$D(^SC(SDT,0)):1,1:0)
4 D 2^VADPT
5 N SDSSN S SDT=$S(SDSC="C":$P(^SC(SDT,0),U),$P(^SC(SDT,0),U,8)]"":$P(^(0),U,8),1:"U"),SDSSN=$P(VADM(2),"^"),VADM(2)=+SDSSN ; save ssn in string format
6 S VADM(5)=$S(VADM(5)]"":$P(VADM(5),U),1:"M") S:SDT=0 SDT="Z"
7 S SDDIV=$S($P(SDOE0,U,11):$P(SDOE0,U,11),1:$O(^DG(40.8,0)))
8 Q:'SDDIV!('VAUTD&'$D(VAUTD(SDDIV)))
9 I SDSC="S" Q:'SDAS&'$D(SDS(SDT))
10 I SDSC="C" Q:'VAUTC&'$D(VAUTC(SDT))
11 ;
12 K SDVCPTS
13 S SDCT=0
14 D GETCPT^SDOE(SDOE,"SDVCPTS")
15 S (PROC,SDVCPT)=0
16 F S SDVCPT=$O(SDVCPTS(SDVCPT)) Q:'SDVCPT D
17 . S X=$G(SDVCPTS(SDVCPT))
18 . S SDPR=+X
19 . S SDQTY=+$P(X,U,16)
20 . IF SDPR]"",$$CPT^ICPTCOD(SDPR,0) S SDCT=SDCT+SDQTY I SDRT="E",SDPN="P",'SDP,'$D(SDP(SDPR)) S SDCT=SDCT-SDQTY
21 ;
22 Q:'SDCT I SDRT="E",SDPN="N" Q:'VAUTN&'$D(VAUTN(VADM(1)))
23EN S SDVB="SDSX"_$P(VADM(5),U)
24 G 1:'$D(^TMP($J,"*PT",VADM(1),VADM(2))),2:'$D(^(VADM(2),VAEL(4))),3:'$D(^TMP($J,"*CL",VADM(2),SDT)),4:'$D(^(SDT,VAEL(4))),5:'$D(^TMP($J,"*DT",VADM(2),$P(SDI,"."))) S SDF=0 D:'$D(^($P(SDI,"."),VAEL(4))) CK
25 G 6:SDF,9
261 S SDTOT=SDTOT+1,SDAGE=SDAGE+VADM(4),@(SDVB)=(@(SDVB)+1)
272 S SDTOT(VAEL(4))=SDTOT(VAEL(4))+1,SDAGE(VAEL(4))=SDAGE(VAEL(4))+VADM(4),@(SDVB_"(VAEL(4))")=@(SDVB_"(VAEL(4))")+1
28 I $D(^TMP($J,"*CL",VADM(2),SDT)) G 4:'$D(^(SDT,VAEL(4))),5:'$D(^TMP($J,"*DT",VADM(2),$P(SDI,"."))) S SDF=0 D:'$D(^($P(SDI,"."),VAEL(4))) CK G 6:SDF,9
293 S ^("T")=^TMP($J,SDT,"T")+1,^("A")=^TMP($J,SDT,"A")+VADM(4),^("S"_$P(VADM(5),U))=^TMP($J,SDT,"S"_$P(VADM(5),U))+1
304 S ^(VAEL(4))=^TMP($J,SDT,"T",VAEL(4))+1,^(VAEL(4))=^TMP($J,SDT,"A",VAEL(4))+VADM(4),^(VAEL(4))=^TMP($J,SDT,"S"_$P(VADM(5),U),VAEL(4))+1 I $D(^TMP($J,"*DT",VADM(2),$P(SDI,"."))) S SDF=0 D:'$D(^($P(SDI,"."),VAEL(4))) CK G 6:SDF,9
315 S SDVST=SDVST+1
326 S SDVST(VAEL(4))=SDVST(VAEL(4))+1
339 S (^TMP($J,"*PT",VADM(1),VADM(2),VAEL(4)),^TMP($J,"*CL",VADM(2),SDT,VAEL(4)),^TMP($J,"*DT",VADM(2),$P(SDI,"."),VAEL(4)))="",SDFL=1 I SDRT="E",SDPN="P",'SDP S SDFL=0
34 I SDRT="E",(SDPN="N"),'$D(^TMP($J,"*PTC",SDT,VADM(1),VADM(2),VAEL(4),SDI)) S ^(SDI)=VADM(4)_"^"_VADM(5)_"^^^^^^^^"_SDSSN
35 ;
36 S (PROC,SDVCPT)=0
37 F S SDVCPT=$O(SDVCPTS(SDVCPT)) Q:'SDVCPT D
38 . S X=$G(SDVCPTS(SDVCPT))
39 . S SDPRO=+X
40 . S SDQTY=+$P(X,U,16)
41 . I SDPRO]"",$$CPT^ICPTCOD(SDPRO,0) I SDFL!('SDFL&$D(SDP(SDPRO))) S SDPRC(VAEL(4))=SDPRC(VAEL(4))+SDQTY,^(VAEL(4))=^TMP($J,SDT,"PR",VAEL(4))+SDQTY I SDRT="E" D PRO:SDPN="P",NM:SDPN="N"
42 S SDSTP=SDSTP+1,SDSTP(VAEL(4))=SDSTP(VAEL(4))+1,^("ST")=^TMP($J,SDT,"ST")+1,^(VAEL(4))=^("ST",VAEL(4))+1
43 D KVAR^VADPT Q
44PRO S ^(VAEL(4))=$S($D(^TMP($J,"*PRO",SDT,SDPRO,VAEL(4))):^(VAEL(4))+1,1:1) I SDPT=1 S ^(SDI)=VAEL(4)_"^"_VADM(4)_"^"_VADM(5)_"^"_$S($D(^(VADM(1),VADM(2),SDI)):$P(^(SDI),U,4)+1,1:1)_"^^^^^^"_SDSSN
45 N MODIFIER,PTR
46 S PTR=0
47 F S PTR=$O(SDVCPTS(SDVCPT,1,PTR)) Q:'PTR D
48 . S MODIFIER=$G(SDVCPTS(SDVCPT,1,PTR,0))
49 . Q:'MODIFIER
50 . S ^(VAEL(4))=^TMP($J,"*PRO",SDT,SDPRO,VAEL(4))_"^"_MODIFIER
51 . Q
52 Q
53CK I VAEL(4) S SDF=1 I $D(^TMP($J,"*DT",VADM(2),$P(SDI,"."),0)) K ^(0) S SDVST(0)=SDVST(0)-1
54 I 'VAEL(4) I '$D(^TMP($J,"*DT",VADM(2),$P(SDI,"."),1)) S SDF=1 Q
55 Q
56NM S ^(SDI)=^TMP($J,"*PTC",SDT,VADM(1),VADM(2),VAEL(4),SDI)_"^"_SDPRO
57 N MODIFIER,PTR
58 S PTR=0,PROC=PROC+1
59 S ^TMP($J,"*PTC",SDT,VADM(1),VADM(2),VAEL(4),SDI,PROC)=""
60 F S PTR=$O(SDVCPTS(SDVCPT,1,PTR)) Q:'PTR D
61 . S MODIFIER=$G(SDVCPTS(SDVCPT,1,PTR,0))
62 . Q:'MODIFIER
63 . S ^(PROC)=^TMP($J,"*PTC",SDT,VADM(1),VADM(2),VAEL(4),SDI,PROC)_MODIFIER_"^"
64 . Q
65 Q
66QS W !,"Enter a service or 'return' when all services have been selected" S SDX=$P(^DD(44,9,0),U,3) W !,"Choose from:" F I=1:1:5 S SDI=$P(SDX,";",I) W !,"'",$P(SDI,":",1),"' FOR ",$P(SDI,":",2)
67 Q
68NONE W !!,"The ambulatory procedures management reports have run",!,"No matches were found for the following requested information:",! K Y S $P(Y,"-",81)="" W Y D DT^SDAMBMR2 W !!,"DATE RANGE: ",SDB,"-",SDE,!,"DIVISION(S): " W:VAUTD "ALL"
69 I 'VAUTD F I=0:0 S I=$O(VAUTD(I)) Q:'I W VAUTD(I),", "
70 W !,$S(SDSC="C":"CLINIC(S): ",1:"SERVICE(S): ") W:VAUTC!SDAS "ALL" I '(VAUTC!SDAS) S I=0 F I1=0:0 S I=$S(SDSC="C":$O(VAUTC(I)),1:$O(SDS(I))) Q:'I W:SDSC="C" I,", " I SDSC="S" D SET^SDAMBMR2 W SDT,", "
71 Q:SDRT="B" I SDPN="N" W !,"PATIENT(S): " W:VAUTN "ALL" I 'VAUTN S I=0 F I1=0:0 S I=$O(VAUTN(I)) Q:'I W I,", "
72 Q:SDPN="N" W !,"PROCEDURE(S): " W:SDP "ALL" I 'SDP S I=0 F S I=$O(SDP(I)) Q:I="" W $P($$CPT^ICPTCOD(I,0),U),", "
73 Q
Note: See TracBrowser for help on using the repository browser.