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

PXAIHF.m

Go to the documentation of this file.
PXAIHF ;ISL/PKR - Set the HEALTH FACTOR nodes. ;03/18/2022
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**45,211,217**;Aug 12, 1996;Build 134
 ;
HF ;Main entry point.
 ;
 K PXAERR
 S PXAERR(8)=PXAK
 S PXAERR(7)="HEALTH FACTOR"
 ;
 N IND,PXAA
 S IND=""
 F  S IND=$O(@PXADATA@("HEALTH FACTOR",PXAK,IND)) Q:IND=""  D
 . S PXAA(IND)=@PXADATA@("HEALTH FACTOR",PXAK,IND)
 ;
 ;Validate the data.
 N STOP
 D VAL^PXAIHFV
 I $G(STOP) Q
 ;
SETVARA ;Set the after visit variables.
 N AFTER0,AFTER12,AFTER220,AFTER811,AFTER812,MAGNITUDE
 S $P(AFTER0,U,1)=$G(PXAA("HEALTH FACTOR"))
 I $G(PXAA("DELETE")) S $P(AFTER0,U,1)="@"
 S $P(AFTER0,U,2)=$G(PATIENT)
 S $P(AFTER0,U,3)=$G(PXAVISIT)
 S $P(AFTER0,U,4)=$G(PXAA("LEVEL/SEVERITY"))
 S $P(AFTER12,U,1)=$G(PXAA("EVENT D/T"))
 S $P(AFTER12,U,2)=$G(PXAA("ORD PROVIDER"))
 S $P(AFTER12,U,4)=$G(PXAA("ENC PROVIDER"))
 ;
 ;Magnitude and UCUM code
 S MAGNITUDE=$G(PXAA("MAGNITUDE"))
 I MAGNITUDE'="" S $P(AFTER220,U,1)=MAGNITUDE,$P(AFTER220,U,2)=$P($G(^AUTTHF(PXAA("HEALTH FACTOR"),220)),U,4)
 E  S AFTER220=""
 ;
 S $P(AFTER811,U,1)=$G(PXAA("COMMENT"))
 ;
 ;--PACKAGE AND SOURCE
 S $P(AFTER812,"^",2)=$S($G(PXAA("PKG"))'="":PXAA("PKG"),1:$G(PXAPKG))
 S $P(AFTER812,"^",3)=$S($G(PXAA("SOURCE"))'="":PXAA("SOURCE"),1:$G(PXASOURC))
 ;
 S ^TMP("PXK",$J,"HF",PXAK,0,"AFTER")=AFTER0
 S ^TMP("PXK",$J,"HF",PXAK,12,"AFTER")=AFTER12
 S ^TMP("PXK",$J,"HF",PXAK,220,"AFTER")=AFTER220
 S ^TMP("PXK",$J,"HF",PXAK,811,"AFTER")=AFTER811
 S ^TMP("PXK",$J,"HF",PXAK,812,"AFTER")=AFTER812
 ;
SETVARB ;Set the before variables.
 N BEFOR0,BEFOR12,BEFOR220,BEFOR811,BEFOR812
 N IENB,PXAAX,PXBCNT,PXBKY,PXBSKY,PXBSAM
 D HF^PXBGHF(PXAVISIT)
 ;
 S IENB=""
 I PXBCNT>0 D
 . S PXAAX("HEALTH FACTOR")=$P($G(^AUTTHF(PXAA("HEALTH FACTOR"),0)),U,1)
 . S IENB=$O(PXBKY(PXAAX("HEALTH FACTOR"),IENB))
 I $G(IENB) D
 . S BEFOR0=$G(^AUPNVHF(IENB,0))
 . S BEFOR12=$G(^AUPNVHF(IENB,12))
 . S BEFOR220=$G(^AUPNVHF(IENB,220))
 . S BEFOR811=$G(^AUPNVHF(IENB,811))
 . S BEFOR812=$G(^AUPNVHF(IENB,812))
 E  S (BEFOR0,BEFOR11,BEFOR12,BEFOR220,BEFOR811,BEFOR812)=""
 ;
 S ^TMP("PXK",$J,"HF",PXAK,0,"BEFORE")=BEFOR0
 S ^TMP("PXK",$J,"HF",PXAK,12,"BEFORE")=BEFOR12
 S ^TMP("PXK",$J,"HF",PXAK,220,"BEFORE")=BEFOR220
 S ^TMP("PXK",$J,"HF",PXAK,811,"BEFORE")=BEFOR811
 S ^TMP("PXK",$J,"HF",PXAK,812,"BEFORE")=BEFOR812
 S ^TMP("PXK",$J,"HF",PXAK,"IEN")=IENB
 ;
 ;Package and Data Source cannot be edited.
 S BEFOR812=^TMP("PXK",$J,"HF",PXAK,812,"BEFORE")
 I BEFOR812'="" D
 . I AFTER812=BEFOR812 Q
 . I $P(BEFOR812,U,2)'="" S $P(AFTER812,U,2)=$P(BEFOR812,U,2)
 . I $P(BEFOR812,U,3)'="" S $P(AFTER812,U,3)=$P(BEFOR812,U,3)
 . S ^TMP("PXK",$J,"HF",PXAK,812,"AFTER")=AFTER812
 ;
 Q