Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: APCHSM

APCHSM.m

Go to the documentation of this file.
APCHSM ; IHS/CMI/LAB - HEALTH SUMMARY (MULTIPLE PATIENTS) ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ; IHS/TUCSON/VJM - SELPT sub-rtn:  change READ to a DIR call.  Added
 ; the LIST sub-rtn which is called from SELPT 
 ;
 W !!,"* * *  B A T C H  H E A L T H  S U M M A R Y  P R O G R A M  * * *",!!
 S ^DISV($I,"^%ZIS(1,")=$O(^%ZIS(1,"C",$I,"")) ; SET DEFAULT OUTPUT DEVICE
 ;
SELTYP K DIC S DIC=9001015,DIC("A")="Select health summary type: ",DIC(0)="AEQM"
 S X="ADULT REGULAR"
 I $D(^DISV(DUZ,"^APCHSCTL(")) S Y=^("^APCHSCTL(") I $D(^APCHSCTL(Y,0)) S X=$P(^(0),U,1)
 S DIC("B")=X
 D ^DIC I Y>0 S APCHSTYP=+Y,APCHSMI=0 K APCHSPAT D SELPT W ! G SELTYP
 G END
 ;
SELPT ;
 F  D  Q:U[X
 .S DIR(0)="FOU",DIR("A")="Select patient(s)"
 .S DIR("?",1)="     Enter a patient's HRN or name (HORSECHIEF,JOHN DOE or HORSECHIEF,JOHN).",DIR("?",2)=""
 .S DIR("?",3)="     A template can also be selected by typing a ""["" followed by",DIR("?",4)="     the template name."
 .S DIR("?",5)="",DIR("?")="     ""[??"" will list your templates.",DIR("??")="^D LIST^APCHSM"
 .D ^DIR K DIR
 .S:X[U X=U
 .I $E(X)="[" D  Q
 .. S X=$E(X,2,$L(X))
 ..; K DIC S DIC=.401,DIC(0)=$S(X="":"AEMQ",1:"EMQ"),DIC("S")="I ($P(^(0),U,5)=$G(DUZ))!(DUZ(0)=""@"")" D ^DIC
 .. K DIC S DIC=.401,DIC(0)=$S(X="":"AEMQ",1:"EMQ"),DIC("S")="I $P(^(0),U,4)=2!($P(^(0),U,4)=9000001),($P(^(0),U,5)=$G(DUZ))!(DUZ(0)=""@"")" D ^DIC
 .. I Y>0 D
 ... S APCHSPAT=0,Y=+Y F APCHMJ=0:1 S APCHSPAT=$O(^DIBT(Y,1,APCHSPAT)) Q:'APCHSPAT  S APCHSMI=APCHSMI+1,APCHSPAT(APCHSMI)=APCHSPAT
 ... W !,APCHMJ,$S(APCHMJ=1:" entry",1:" entries")," added."
 .K DIC S DIC=9000001,DIC(0)="EQM" D ^DIC
 .I Y>0 S APCHSPAT=+Y,APCHSMI=APCHSMI+1,APCHSPAT(APCHSMI)=APCHSPAT
 W !
 I X=U K APCHSPAT W !,$C(7),"All selections cancelled!"
 Q:'$O(APCHSPAT(""))
 D SELDEV I APCHSMF="POP" S IO=IO(0) Q
 I APCHSMF="QUE" D QUE D ^%ZISC Q
 K ZTSK
 ;
SUMLOOP ;ENTRY POINT
 S APCHSMI=0 F APCHSMQ=0:0 S APCHSMI=$O(APCHSPAT(APCHSMI)) Q:'APCHSMI  S APCHSPAT=APCHSPAT(APCHSMI) D EN^APCHS
 D ^%ZISC
 ;
END K APCHSPAT,APCHSTYP,APCHSM,APCHSMQ,APCHSMI,APCHSMF,APCHSMK,APCHMJ
 K APCHSALL,APCHSTAT,G,X,Y
 D EOJ^APCHS
 K AUPNPAT,AUPNDOB,AUPNDOD,AUPNSEX,AUPNDAYS
 K DIC
 Q
 ;
SELDEV ; SELECT OUTPUT DEVICE
 K IOP,%ZIS S %ZIS="PQ" D ^%ZIS S APCHSMF=$S(POP:"POP",$D(IO("Q")):"QUE",1:"")
 I APCHSMF="" S ^DISV($I,"^%ZIS(1,")=$O(^%ZIS(1,"C",IO,""))
 Q
 ;
QUE ;
 K ZTSAVE F G="APCHSPAT(","APCHSTYP" S ZTSAVE(G)=""
 S ZTRTN="SUMLOOP^APCHSM",ZTDESC="BATCH HEALTH SUMMARY",ZTIO=ION,ZTDTH="" ;IHS/CMI/LAB - ION
 D ^%ZTLOAD
 K ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
 Q
 ;
LIST ;"??" help list
 S APCHMK=0,APCHMJ=IOSL-3 F  S APCHMK=$O(APCHSPAT(APCHMK)) Q:'APCHMK  S APCHSPAT=APCHSPAT(APCHMK),X=$P(^AUPNPAT(APCHSPAT,0),U) D  Q:APCHMJ<0  W !,?2,X
 . S APCHMJ=APCHMJ-1 Q:APCHMJ>0  S APCHMJ=IOSL-2
 . K DIR S DIR(0)="E" D ^DIR I 'Y K DIRUT,DUOUT,DTOUT S APCHMJ=-1
 . S X=" " K DIR Q
 K APCHMK
 Q