[613] | 1 | GMTSPD ; SLC/JER,KER - Interactive Print-by-Location ; 04/30/2002 [1/26/05 1:50pm]
|
---|
| 2 | ;;2.7;Health Summary;**28,30,47,49,55,70**;Oct 20, 1995;Build 5
|
---|
| 3 | ;
|
---|
| 4 | ; External
|
---|
| 5 | ; DBIA 10040 ^SC(
|
---|
| 6 | ; DBIA 10040 ^SC("B"
|
---|
| 7 | ; DBIA 641 ^SRF("AOR"
|
---|
| 8 | ; DBIA 185 ^SRS("B"
|
---|
| 9 | ; DBIA 10039 ^DIC(42
|
---|
| 10 | ; DBIA 510 ^DISV(
|
---|
| 11 | ; DBIA 10035 ^DPT("CN"
|
---|
| 12 | ; DBIA 10000 C^%DTC
|
---|
| 13 | ; DBIA 10000 NOW^%DTC
|
---|
| 14 | ; DBIA 10006 ^DIC (file #42 and #44)
|
---|
| 15 | ; DBIA 10026 ^DIR
|
---|
| 16 | ; DBIA 10076 ^XUSEC("GMTS VIEW ONLY"
|
---|
| 17 | ; DBIA 10104 $$UP^XLFSTR
|
---|
| 18 | ;
|
---|
| 19 | MAIN ; Interactive Print by Location
|
---|
| 20 | N GMPSAP,GMTSCDT,GMTSTYP,GMLOC,GMTSTN,GMTSSC
|
---|
| 21 | S GMTSTYP=0 K DIROUT
|
---|
| 22 | F D Q:+GMTSTYP'>0!$D(DIROUT)
|
---|
| 23 | . S GMTSTYP=+($$SELTYP) Q:+GMTSTYP'>0!$D(DIROUT)
|
---|
| 24 | . F D Q:+$G(GMTSSC)'>0!$D(DIROUT)!$D(DUOUT)!($D(GMTSSC("ALL")))
|
---|
| 25 | . . K GMTSSC,DUOUT D SELLOC(.GMTSSC) Q:+$G(GMTSSC)'>0!$D(DIROUT)!$D(DUOUT)
|
---|
| 26 | . . D CHKLOC(.GMTSSC) Q:$O(GMTSSC(0))'>0!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
|
---|
| 27 | . . S GMPSAP=$$RXAP^GMTSPD2 Q:$D(DIROUT)!$D(DUOUT)!$D(DTOUT)
|
---|
| 28 | . . N DIROUT D HSOUT^GMTSPD2 W ! S DUOUT=1
|
---|
| 29 | Q
|
---|
| 30 | SELTYP() ; Select Health Summary type
|
---|
| 31 | N DIC,X,Y
|
---|
| 32 | I $D(^DISV(DUZ,"^GMT(142,")),+$G(GMTSTYP)=0 S DIC("B")=$P($G(^GMT(142,+$G(^DISV(DUZ,"^GMT(142,")),0)),U)
|
---|
| 33 | S DIC=142,DIC("A")="Select Health Summary Type: "
|
---|
| 34 | S DIC(0)="AEQM",DIC("S")="I $P(^(0),U)'=""GMTS HS ADHOC OPTION"""
|
---|
| 35 | S Y=$$TYPE^GMTSULT I +Y'>0,X="^^" S DIROUT=1
|
---|
| 36 | I +Y>0,$S($D(^GMT(142,+Y,1,0))=0:1,$O(^(0))'>0:1,1:0) D
|
---|
| 37 | . W !,"This Summary Type includes no components...Please choose another."
|
---|
| 38 | Q Y
|
---|
| 39 | SELLOC(GMX) ; Select multiple Hospital Location
|
---|
| 40 | N DIC,LOC,Y,X,DIR,GMTSLC
|
---|
| 41 | S DIC=44,DIC(0)="AEMQZ",DIC("A")="Select Hospital Location: ",GMTSLC=0
|
---|
| 42 | I $D(^XUSEC("GMTS VIEW ONLY",+($G(DUZ)))) S GMTSLC=1
|
---|
| 43 | S DIC("S")="I ""WCOR""[$P(^(0),U,3)"
|
---|
| 44 | F D Q:+$G(GMX(+$G(Y)))'>0!$D(DIROUT)!$D(DTOUT)!$D(DUOUT) Q:GMTSLC<0
|
---|
| 45 | . D:GMTSLC'>0 ASK Q:$D(GMX("ALL"))
|
---|
| 46 | . D:GMTSLC>0 ^DIC S GMTSLC=GMTSLC+1 Q:$G(DIROUT)=1
|
---|
| 47 | . I +Y'>0 S:X="^^" DIROUT=1 Q
|
---|
| 48 | . S GMX(+Y)=$P(Y,U,1,2)_U_$P(Y(0),U,3)
|
---|
| 49 | . S $P(GMX,U)=+Y
|
---|
| 50 | . I "COR"[$P(Y(0),U,3) S $P(GMX,U,3)="COR"
|
---|
| 51 | . S DIC("A")="Select Next Hospital Location: "
|
---|
| 52 | Q
|
---|
| 53 | ASK ; Prompt for One or ALL
|
---|
| 54 | N ERR,DIC,DIR,LASTI,LAST
|
---|
| 55 | ASK2 S DIR("A")="Select Hospital Location: "
|
---|
| 56 | S LASTI=$G(^DISV(+($G(DUZ)),"^SC(")),LAST=$S(+LASTI>0:$P($G(^SC(+LASTI,0)),"^",1),1:"")
|
---|
| 57 | S DIR(0)="FAO^1:30",DIR("?")="^D A1^GMTSPD",DIR("??")="^D A2^GMTSPD"
|
---|
| 58 | D ^DIR I $L($G(X)),$E($G(X),1)=" ",$L(LAST),+($G(LASTI))>0 D Q
|
---|
| 59 | . W " ",LAST S X=LAST,Y=+LASTI_"^"_LAST,Y(0)=$G(^SC(+LASTI,0)),Y(0,0)=LAST Q
|
---|
| 60 | I $$UP^XLFSTR(Y)="ALL" D Q
|
---|
| 61 | . K GMX S GMX="1^ALL^COR",GMX("ALL")="",GMX(1)="1^ALL^C",GMTSLC=-1
|
---|
| 62 | S ERR=1,DIC=44,DIC(0)="EMZ"
|
---|
| 63 | S DIC("S")="I ""WCOR""[$P(^(0),U,3) S ERR=0"
|
---|
| 64 | D ^DIC
|
---|
| 65 | I $L(X),+($G(ERR))>0 D W ! G ASK2
|
---|
| 66 | . W " ??",!!,?5,"Not a ward, clinic or operating room"
|
---|
| 67 | I +Y'>0 S:X["^^" DIROUT=1,GMTSEXIT="^^" Q
|
---|
| 68 | Q
|
---|
| 69 | A1 ; Single ? Help
|
---|
| 70 | W !," Answer with HOSPITAL LOCATION NAME, or ABBREVIATION, TEAM or 'ALL'"
|
---|
| 71 | W !," for all hospital locations. Enter '^' to return to Health Summary"
|
---|
| 72 | W !," Type Selection or '^^' to exit."
|
---|
| 73 | Q
|
---|
| 74 | A2 ; Double ?? Help
|
---|
| 75 | N GMTSN,GMTSI,GMTSL,GMTSC,GMTSE,GMTSP,GMTSA S GMTSP=+($G(IOSL))-9 S:GMTSP'>0 GMTSP=15
|
---|
| 76 | S (GMTSA,GMTSC,GMTSE)=0,GMTSN="" D A1 W !
|
---|
| 77 | F S GMTSN=$O(^SC("B",GMTSN)) Q:GMTSN="" D Q:GMTSE
|
---|
| 78 | . S GMTSI=0 F S GMTSI=$O(^SC("B",GMTSN,GMTSI)) Q:GMTSI="" D Q:GMTSE
|
---|
| 79 | . . S GMTSL=$P($G(^SC(GMTSI,0)),"^",1) Q:'$L(GMTSL) S GMTSC=GMTSC+1,GMTSA=GMTSA+1
|
---|
| 80 | . . W:GMTSC=1 !,?3,"Choose from:" W !,?3,GMTSL
|
---|
| 81 | . . I GMTSA'<GMTSP D CONT
|
---|
| 82 | Q
|
---|
| 83 | CONT ; Continue Displaying List
|
---|
| 84 | S GMTSP=+($G(IOSL))-1 S:GMTSP'>0 GMTSP=23 S GMTSA=0
|
---|
| 85 | N DIR,DA,X,Y,DTOUT,DUOUT,DIRUT,DIROUT S DIR(0)="E",DIR("A")=" '^' TO STOP",(DIR("?"),DIR("??"))="^D C1^GMTSPD"
|
---|
| 86 | D ^DIR S:+($G(Y))=0 GMTSE=1
|
---|
| 87 | Q
|
---|
| 88 | C1 ; Continue Help
|
---|
| 89 | W !," Enter ether RETURN or '^'" Q
|
---|
| 90 | CHKLOC(LOC) ; Get date range for Clinics/ORs
|
---|
| 91 | I $P($G(LOC),U,3)="COR" D Q:$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
|
---|
| 92 | . S $P(LOC,U,4)=$$SELDATE
|
---|
| 93 | W ! S GMLOC=0 F S GMLOC=$O(LOC(GMLOC)) Q:+GMLOC'>0 D
|
---|
| 94 | . I "COR"[$P(LOC(+GMLOC),U,3) S $P(LOC(+GMLOC),U,4)=$P(LOC,U,4,5)
|
---|
| 95 | Q
|
---|
| 96 | SELDATE() ; Visit/Surgery date range for Print-by-Clinic
|
---|
| 97 | N %,%H,%I,DIR,DEFDT,X,Y,GMBEG,GMEND
|
---|
| 98 | S (GMBEG,GMEND)=0
|
---|
| 99 | D NOW^%DTC S (X,DT)=$P(%,".") D REGDT4^GMTSU S DEFDT=X
|
---|
| 100 | S DIR(0)="D^::EX",DIR("B")=DEFDT
|
---|
| 101 | S DIR("A")="Please enter the beginning Visit or Surgery date"
|
---|
| 102 | D ^DIR
|
---|
| 103 | I Y="^^" S DIROUT=1
|
---|
| 104 | S GMBEG=Y
|
---|
| 105 | I +GMBEG>0 D
|
---|
| 106 | . S X=$P(GMBEG,".") D REGDT4^GMTSU S DEFDT=X
|
---|
| 107 | . S DIR(0)="DO^::EX",DIR("B")=DEFDT
|
---|
| 108 | . S DIR("A")="Please enter the ending Visit or Surgery date"
|
---|
| 109 | . D ^DIR
|
---|
| 110 | . I Y="^^" S DIROUT=1
|
---|
| 111 | . S GMEND=Y
|
---|
| 112 | Q $S(+GMEND>0&(GMEND>GMBEG):GMBEG_U_GMEND,+GMEND>0&(GMEND<GMBEG):GMEND_U_GMBEG,+GMEND>0&(GMEND=GMBEG):GMBEG,1:0)
|
---|
| 113 | CKPAT(LOC) ; Checks for patients at selected location
|
---|
| 114 | N %,%H,%T,LTYPE,X1,X2,X,Y,GMY,GMBEG,GMTSDATE,GMTSCDT,GMTSRES
|
---|
| 115 | S LTYPE=$P(LOC,U,3)
|
---|
| 116 | I LTYPE="W" D
|
---|
| 117 | . S LOC=$P($G(^DIC(42,+$G(^SC(+LOC,42)),0)),U)
|
---|
| 118 | . S GMY=$S($G(LOC)']"":0,$O(^DPT("CN",LOC,0)):1,1:0)
|
---|
| 119 | I $L(LOC,U)=4!($L(LOC,U)=5) D
|
---|
| 120 | . S GMY=0
|
---|
| 121 | . I +$P(LOC,U,5) S X1=$P(LOC,U,5),X2=1 D C^%DTC
|
---|
| 122 | . I +$P(LOC,U,5)'>0 S X1=$P(LOC,U,4),X2=1 D C^%DTC
|
---|
| 123 | . S GMTSCDT=$P(LOC,U,4)
|
---|
| 124 | . D GETPLIST^SDAMA202(+LOC,"1",,GMTSCDT,X,.GMTSRES) Q:GMTSRES=0
|
---|
| 125 | . I GMTSRES<0 D Q
|
---|
| 126 | . . S GMY=-1
|
---|
| 127 | . . N GMTSERR
|
---|
| 128 | . . S GMTSERR=$O(^TMP($J,"SDAMA202","GETPLIST","ERROR",0))
|
---|
| 129 | . . I 'GMTSERR Q
|
---|
| 130 | . . D MAIL^GMTSMAIL($G(^TMP($J,"SDAMA202","GETPLIST","ERROR",GMTSERR)),"Nightly Job to Queue HS Batch Print-by-Loc")
|
---|
| 131 | . . K ^TMP($J,"SDAMA202","GETPLIST")
|
---|
| 132 | . N GMTSI S GMTSI=0,GMTSDATE=0
|
---|
| 133 | . F S GMTSI=$O(^TMP($J,"SDAMA202","GETPLIST",GMTSI)) Q:'GMTSI D
|
---|
| 134 | . . I $G(^TMP($J,"SDAMA202","GETPLIST",GMTSI,1))<X S GMTSDATE=$G(^TMP($J,"SDAMA202","GETPLIST",GMTSI,1))
|
---|
| 135 | . K ^TMP($J,"SDAMA202","GETPLIST")
|
---|
| 136 | . I LTYPE="C",(+GMTSDATE),(+GMTSDATE'>X) S GMY=1
|
---|
| 137 | . I LTYPE="OR" D
|
---|
| 138 | . . N OLOC S GMY=0,OLOC=+$O(^SRS("B",+LOC,0))
|
---|
| 139 | . . I +OLOC,+$P(LOC,U,5)'>0,$O(^SRF("AOR",+OLOC,+$P(LOC,U,4),0)) S GMY=1
|
---|
| 140 | . . I +OLOC,+$P(LOC,U,5) D
|
---|
| 141 | . . . S GMBEG=$P(LOC,U,4)
|
---|
| 142 | . . . F D Q:GMBEG>$P(LOC,U,5)!(GMY>0)
|
---|
| 143 | . . . . I $O(^SRF("AOR",+OLOC,+GMBEG,0)) S GMY=1
|
---|
| 144 | . . . . E S X1=GMBEG,X2=1 D C^%DTC S GMBEG=X
|
---|
| 145 | Q $G(GMY)
|
---|