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

AMEREDTU.m

Go to the documentation of this file.
AMEREDTU ; IHS/OIT/SCR - SUB-ROUTINE FOR ER VISIT EDIT of ADMIT information
 ;;3.0;ER VISIT SYSTEM;;FEB 23, 2009
 ;
TRANSFER(AMERDA)  ;EP from AMEREDTA
 N AMERFACN,AMERNEW,AMEROLD,AMEREDTS,AMERSTRG,AMERDR,DIC
 S (AMERFACN,AMERNEW,AMEROLD,AMEREDTS,AMERSTRG,AMERDR)=""
 S DIC("A")="*Transferred from: " K DIC("B")
 I $G(^AMERVSIT(AMERDA,17))>0 D
 .S AMERFACN=$P($G(^AMERVSIT(AMERDA,17)),U,2)
 .S:AMERFACN>0 (DIC("B"),AMEROLD)=$P($G(^AMER(2.1,AMERFACN,0)),U,1)
 .Q
 S DIC="^AMER(2.1,",DIC(0)="AEQM"
 D ^DIC K DIC
 I $D(DUOUT)!$D(DTOUT) K DUOUT,DTOUT Q 0
 Q:Y<0 0
 S AMERNEW=$P(Y,U,2)
 I AMERNEW'=AMEROLD D
 .S AMERSTRG=$$EDAUDIT^AMEREDAU("17.2",AMEROLD,AMERNEW,"TRANSFERED FROM")
 .S AMERDR=$S($D(AMERDR):AMERDR_";",1:""),AMERDR=AMERDR_"17.2////"_$P(Y,U,1)
 .D DIEREC^AMEREDAU(AMERAIEN,AMERSTRG)
 .D DIE^AMEREDIT(AMERDA,AMERDR)
 .S (AMERDR,Y,AMEROLD,AMERNEW)=""
 .Q
 ;QA8 - TRANSFER TRANSPORTATION
 S DIC("A")="*Mode of TRANSFER transport: " K DIC("B")
 I $P($G(^AMERVSIT(AMERDA,0)),U,25)'="" S (DIC("B"),AMEROLD)=$P(^AMERVSIT(AMERDA,0),U,25)
 S DIC="^AMER(3,"
 S DIC("S")="I $P(^(0),U,2)="_$$CAT^AMER0("TRANSFER DETAILS")
 S DIC(0)="AEQ"
 D ^DIC K DIC
 I $D(DUOUT)!$D(DTOUT) Q
 Q:Y=-1!(Y="")
 S AMERNEW=$$EDDISPL^AMEREDAU($P(Y,U,1),"T")
 S AMEROLD=$$EDDISPL^AMEREDAU(AMEROLD,"T")
 I AMEROLD'=AMERNEW D
 .S AMERSTRG=$$EDAUDIT^AMEREDAU(".25",AMEROLD,AMERNEW,"TRANSFER DETAILS")
 .S AMERDR=$S(AMERDR'="":AMERDR_";",1:""),AMERDR=AMERDR_".25////"_+Y
 .D DIEREC^AMEREDAU(AMERAIEN,AMERSTRG)
 .D DIE^AMEREDIT(AMERDA,AMERDR)
 .S (AMERDR,Y,AMEROLD)=""
 .Q
 I AMERNEW'["AMBULANCE" S AMERDR=$S(AMERDR'="":AMERDR_";",1:""),AMERDR=AMERDR_".14////@;.15////@;.21////@"
 E  D AMBULNCE
 ;QA9 - TRANSFER ATTENDANT
 S (AMEROLD,DIR("B"))="NO" I $P($G(^AMERVSIT(AMERDA,17)),U,4)=1 S (AMEROLD,DIR("B"))="YES"
 S DIR(0)="YO",DIR("A")="*Medical attendant present during transfer"
 D ^DIR K DIR
 I $D(DUOUT)!$D(DTOUT) Q
 Q:Y=-1!(Y="")
 S AMERNEW=Y
 S AMERNEW=$$EDDISPL^AMEREDAU(AMERNEW,"B") ; "BOOLEAN" translates from 0 to NO
 I AMEROLD'=AMERNEW D
 .S AMERSTRG=$$EDAUDIT^AMEREDAU("17.4",AMEROLD,AMERNEW,"TRANSFER ATTENDANT")
 .S AMERDR=$S(AMERDR'="":AMERDR_";",1:""),AMERDR=AMERDR_"17.4////"_Y
 .D DIEREC^AMEREDAU(AMERAIEN,AMERSTRG)
 .D DIE^AMEREDIT(AMERDA,AMERDR)
 .S (AMERDR,Y,AMEROLD)=""
 Q
 ;
AMBULNCE  ; EP from AMEREDTA
 ;
 N AMERFACN,AMERNEW,AMEROLD,AMEREDTS,AMERSTRG
 S (AMERFACN,AMERNEW,AMEROLD,AMEREDTS,AMERSTRG)=""
 S DIR("A")="*Ambulance number"
 K DIR("B"),DIR(0)
 S DIR(0)="FO^1:80"
 S (AMEROLD,DIR("B"))=$P($G(^AMERVSIT(AMERDA,0)),U,14)
 D ^DIR K DIR
 I $D(DUOUT)!$D(DTOUT) Q
 I Y>0 D
 .S AMERNEW=Y
 .I AMEROLD'=AMERNEW D
 ..S AMERSTRG=$$EDAUDIT^AMEREDAU(".14",AMEROLD,AMERNEW,"AMBULANCE NUMBER")
 ..S AMERDR=$S(AMERDR'="":AMERDR_";",1:""),AMERDR=AMERDR_".14////"_Y
 ..S AMEREDTS=$S(AMEREDTS="":AMERSTRG,1:AMEREDTS_"^"_AMERSTRG) ;concatonate edit strings to add to ^AMERAUDT when ^AMERVSIT is actually updated
 ..Q
 .Q
 S (AMERNEW,AMEROLD)=""
 S DIR("A")="*Ambulance HRCN/billing number"
 K DIR("B")
 S DIR(0)="FO^1:80"
 S (AMEROLD,DIR("B"))=$P($G(^AMERVSIT(AMERDA,0)),U,15)
 D ^DIR K DIR
 I $D(DUOUT)!$D(DTOUT) Q
 Q:Y<0
 S AMERNEW=Y
 I AMEROLD'=AMERNEW D
 .S AMERSTRG=$$EDAUDIT^AMEREDAU(".15",AMEROLD,AMERNEW,"AMBULANCE INVOICE NUBMER")
 .S AMERDR=$S(AMERDR'="":AMERDR_";",1:""),AMERDR=AMERDR_".15////"_Y
 .S AMEREDTS=$S(AMEREDTS="":AMERSTRG,1:AMEREDTS_"^"_AMERSTRG)
 .Q
 S (AMERNEW,AMEROLD)=""
 S DIC("A")="*Ambulance company: " K DIC("B"),DIC("S")
 S Y=$P($G(^AMERVSIT(AMERDA,0)),U,21)
 I Y'="" S (AMEROLD,DIC("B"))=Y
 S DIC="^AMER(3,"
 S DIC("S")="I $P(^(0),U,2)="_$$CAT^AMER0("AMBULANCE COMPANY")
 S DIC(0)="AEQO"
 D ^DIC K DIC
 I $D(DUOUT)!$D(DTOUT) Q
 Q:+Y<0
 S AMERNEW=+Y
 I AMEROLD'=AMERNEW D
 .S AMERNEW=$$EDDISPL^AMEREDAU(AMERNEW,"A") ; "AMBULANCE" translates from IEN to company name
 .S AMEROLD=$$EDDISPL^AMEREDAU(AMEROLD,"A")
 .S AMERSTRG=$$EDAUDIT^AMEREDAU(".21",AMEROLD,AMERNEW,"AMBULANCE COMPANY")
 .S AMERDR=$S(AMERDR'="":AMERDR_";",1:""),AMERDR=AMERDR_".21////"_$P(Y,U,1)
 .S AMEREDTS=$S(AMEREDTS="":AMERSTRG,1:AMEREDTS_"^"_AMERSTRG)
 .Q
 I AMERDR'="" D DIE^AMEREDIT(AMERDA,AMERDR)
 D:AMEREDTS'="" MULTAUDT^AMEREDAU(AMEREDTS,AMERAIEN)
 Q