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

AMEROUT1.m

Go to the documentation of this file.
AMEROUT1 ; IHS/ANMC/GIS - SORT CONTROL FOR OUTPUT ; 
 ;;3.0;ER VISIT SYSTEM;**5**;MAR 03, 2009;Build 14
 ;
RUN D SEL I $D(AMERQUIT) Q
 D FSET,PRINT
EXIT K ZTSAVE,ZTSK,ZTIO,ZTDESC,ZTRTN
 Q
 ;
SEL ; SELECT SORT
 W !!
 S DIR("A")="Sort by"
S1 ; SORT BY LOOP REENTRY POINT
 S DIR(0)="N"_$S(AMERRTYP'="A":"O",1:"")_"^1:"_(AMERPTOT+AMERVTOT)_":0"
 S DIR("??")="^D SORT^AMEROUT",DIR("?")="Select an attribute of the patient or the visit.  Enter a number..."
 I $D(AMERNXT) S DIR("A")=AMERNXT K AMERNXT
 D ^DIR K DIR
 I $E(X)=U,X'="" S AMERQUIT="" Q
 D OUT^AMEROUT I $D(AMERQUIT) Q
 I X="",$D(AMERSTAT) Q
 I X="" Q
 I Y?1.2N,$D(^TMP("AMER",$J,7,Y)) S Y=^(Y),AMERATNM=$P(^AMER(2.2,+Y,0),U) W "  (",AMERATNM,")" D MET G LOOP
 S X=Y,DIC="^AMER(2.2,",DIC(0)="EQ",DIC("S")="I $P(^(0),U,2)=AMERRTYP"
 D ^DIC K DIC
 D OUT^AMEROUT I $D(AMERQUIT) Q
 S Y=+Y,AMERATNM=$P(^AMER(2.2,+Y,0),U) D MET
LOOP I $D(AMERQUIT) Q
 I $G(AMERRTYP)="A" Q
 D ADD
 I $G(AMERSTAT) Q
 I AMERRTYP="V"!(AMERRTYP="S") W !! D S1^AMEROUT S DIR("A")="Then sort by" G S1
 Q
 ;
ADD I $D(AMERBY),$D(AMERFR),$D(AMERTO),$D(BY),$D(FR),$D(TO)
 E  S AMERQUIT="" Q
A1 S:BY="'" BY="" S:BY]"" BY=BY_",",FR=FR_",",TO=TO_","
 S BY=BY_AMERBY,FR=FR_AMERFR,TO=TO_AMERTO
 Q
 ;
MET ; METADICTIONARY LOOKUP
 K AMERSCR,AMERBY
 I 'Y S AMERQUIT="" W "  ??",*7 Q
 I '$D(^AMER(2.2,+Y,0)) S AMERQUIT="" W " ??",*7 Q
 S %=^AMER(2.2,+Y,0),AMERCAT=$P(%,U,3),AMERGBL=$P(%,U,4) S:$D(^(2)) AMERSCR=^(2) I $D(^(1)) S AMERBY=^(1)
 I AMERRTYP="V" D @("M"_AMERCAT_"^AMEROUT2") Q
 I AMERRTYP="A" D AGE Q
 Q
 ;
FSET ; FINAL ADJUSTMENTS OF BY,FR,TO
 I AMERRTYP="A" Q
 I $D(AMERSTAT),$G(FLDS)="" S FLDS="!.01"
 I AMERDISP=2,BY="" S BY="'@.01,@.02",FR=AMERD1_",",TO=AMERD2_"," Q
 I AMERDISP=2 D  Q
 .I BY="5,.01" S BY=BY_",5,.01:DIAGNOSIS;N;""DX DESCRIPTION: """
 .S BY=BY_",",FR=FR_",",TO=TO_"," ; FINAL SET OF BY,FR,TO
 .S BY="'@.01,"_BY,FR=AMERD1_","_FR_",",TO=AMERD2_","_TO_","
 .I '$D(AMERSTAT) S BY=BY_",.02"
 .Q
 I AMERDISP=3,BY="" S BY="@.01",FR=AMERD1,TO=AMERD2 Q
 I BY="5,.01" S BY=BY_",5,.01:DIAGNOSIS;N;""DX DESCRIPTION: """
 I AMERDISP=3 S BY="'@.01,"_BY S:'$D(AMERSTAT) BY=BY_",@.01" S FR=AMERD1_","_FR_",",TO=AMERD2_","_TO_"," Q
 I BY="" S BY="@.16",FR=(9999999-AMERD2),TO=(9999999-AMERD1) Q
 S BY="'@.01,"_BY S:'$D(AMERSTAT) BY=BY_",@.16" S FR=AMERD1_","_FR_",",TO=AMERD2_","_TO_","
 Q
 ;
PRINT ; GENERATE OUTPUT - ENTRY POINT FROM AMEROUT
 I AMERRTYP'="A" S DIC="^AMERVSIT(",DIOBEG="S AMERNOTE="""",^UTILITY($J,2)=""D:$D(AMERNOTE) NOTE^AMEROUT1 ""_^UTILITY($J,2)"
 S Y=AMERD1 D DD^%DT S AMERD1=Y
 S Y=AMERD2 D DD^%DT S AMERD2=Y
 I $G(AMERHDR)'="" S DHD=$$AMERDHD^AMERREPT(AMERHDR,AMERD1,AMERD2)
 E  S DHD="ER REPORT"
ENDIP D EN1^DIP
 ;
 ;AMER*3.0*5
 D LOG^AMERBUSA("P","Q","AMEROUT1","AMER: Printed "_AMERHDR_" for "_AMERD1_" to "_$P(AMERD2,"@"),"")
 ;
 I $D(IOST),IOST["C-",'$D(DIRUT),'$D(DTOUT) W ! S DIR(0)="E",DIR("A")="Press 'Return to continue" D ^DIR
 Q
 ;
TASK ; BACKGROUND JOB ENTRY POINT
 ;
 Q
 ;
NOTE ;
 K AMERNOTE N I,X
 I '$D(^TMP("AMER",$J,8)) Q
 W "Please note: the following criteria were used to screen entries:",!
 S X="" F I=1:1 S X=$O(^TMP("AMER",$J,8,X)) Q:X=""  W !,?3,I,") ",X," = """,^(X),""""
 W !!!
 Q
 ;
AGE ; ENTRY POINT
 S DIC="^AMERVSIT(",FR=AMERD1,TO=AMERD2
 S FLDS="!.02:NUMBER,"_AMERBY_",!D ^AMERBIN"
 S BY="'@.01,.02:NUMBER"
 S DHD="@"
 Q
 ;
EN1 ; ENTRY POINT FORM OPTION AMER LOG
 ; PRINT RECENT VISITS
 N BY,FR,TO,FLDS,DIC,%,AMERRTYP,AMERHDR,AMERD1,AMERD2,AMERDATE
 S AMERRTYP="V"
 D NOW^%DTC
 S X1=X   ;THE DATE THAT X2 WILL BE SUBTRACTED FROM IN FILEMAN FORMAT
 S X2=-1  ;TO GET THE DAY BEFORE...
 D C^%DTC
 S AMERDATE=X
 S FR=$P(X,".",1)
 S TO=FR
 S FLDS="[AMER BRIEF",BY="@.01"
 S DIC="^AMERVSIT("
 S Y=FR D DD^%DT S AMERD1=Y
 S Y=TO D DD^%DT S AMERD2=Y
 D SYNCHERS^AMERERS(AMERD1,AMERD2)
 S AMERHDR="ER DAILY LOG REPORT"
 S DHD=$$AMERDHD^AMERREPT(AMERHDR,AMERD1,AMERD2)
 D EN1^DIP
 ;
 ;AMER*3.0*5
 D LOG^AMERBUSA("P","Q","AMEROUT1","AMER: Printed ER Daily Log Report","")
 ; 
 I $D(IOST),IOST["C-",'$D(DIRUT),'$D(DTOUT) W ! S DIR(0)="E",DIR("A")="Press 'Return to continue" D ^DIR
 Q