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

BQIVFTRF.m

Go to the documentation of this file.
BQIVFTRF ;VNGT/HS/BEE - Trigger Family History ; 04 Jun 2008  4:24 PM
 ;;2.4;ICARE MANAGEMENT SYSTEM;;Apr 01, 2015;Build 41
 Q
 ;
EN(DATA,TEXT) ;EP - BQI VFILE TRIGGER FH
 ;
 ; Input
 ;   TEXT  - Narrative Text
 ;
 NEW UID,II,VALUE,NARR,SOURCE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIVFTRF",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIVFTRF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S SOURCE="APCDTNQ",VALUE=""
 S DIC(0)="LX",DIC="^AUTNPOV(",DLAYGO=9999999.27,X=TEXT
 D ^DIC
 S IEN=+Y
 I IEN=-1 K DO,DD D FILE^DICN S IEN=+Y
 S VALUE=IEN_$C(29)_TEXT
 S @DATA@(II)="T00008SOURCE^T00001CODE_TYPE^T01024PARMS"_$C(30)
 S II=II+1,@DATA@(II)=SOURCE_U_"C"_U_VALUE_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
ERR ;
 D ^%ZTER
 NEW Y,ERRDTM
 S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
 S BMXSEC="Recording that an error occurred at "_ERRDTM
 I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
TRGR(DATA,STS,MLTB) ; EP - BQI VFILE TRG FH REL
 ;
 ; Input
 ;   STS - The FHRSTS ("STATUS") CODE value
 ;   MLTB - The FHRMB ("MULTIPLE BIRTH?") CODE value
 ;
 NEW BQIREC,UID,II
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIVFTRF",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIVFTRF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 ;Version check
 I $$VERSION^XPDUTL("BJPC")<2.0 S BMXSEC="RPC Call Failed: IHS PCC SUITE 2.0 must be installed in RPMS" Q
 ;
 ;Define Header
 S @DATA@(II)="T00008SOURCE^T00030VALUE^T00001ABLE_FLAG^T01024CLEAR_FIELDS^T00200HELP_TEXT"_$C(30)
 ;
 ;Initialize Records
 S STS=$G(STS,""),MLTB=$G(MLTB,"")
 S BQIREC("FHRAAD")="FHRAAD"_U_U_"N"_U_"FHRAAD"_U_$C(30)
 S BQIREC("FHRCOD")="FHRCOD"_U_U_"N"_U_"FHRCOD"_U_$C(30)
 S BQIREC("FHRMBT")="FHRMBT"_U_U_"N"_U_"FHRMBT"_U_$C(30)
 ;
 ;Handle Status
 I STS="DECEASED"!(STS="D") D
 . S $P(BQIREC("FHRAAD"),U,3,4)="Y^"
 . S $P(BQIREC("FHRCOD"),U,3,4)="Y^"
 ;
 ;Handle Multiple Birth?
 I MLTB="YES"!(MLTB="Y") D
 . S $P(BQIREC("FHRMBT"),U,3,4)="Y^"
 ;
 S II=II+1,@DATA@(II)=BQIREC("FHRAAD")
 S II=II+1,@DATA@(II)=BQIREC("FHRCOD")
 S II=II+1,@DATA@(II)=BQIREC("FHRMBT")
 S II=II+1,@DATA@(II)=$C(31)
 ;
XTRGR Q
 ;
TRGC(DATA,FHCDX,TEXT) ; EP - BQI VFILE TRG FH CND
 ;
 ; Input
 ;   FHCDX - Diagnosis Code IEN
 ;   TEXT  - Narrative Text
 ;
 NEW BQIREC,UID,II
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIVFTRF",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIVFTRF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 ;Version check
 I $$VERSION^XPDUTL("BJPC")<2.0 S BMXSEC="RPC Call Failed: IHS PCC SUITE 2.0 must be installed in RPMS" Q
 ;
 ;Define Header
 S @DATA@(II)="T00008SOURCE^T00030VALUE^T00001ABLE_FLAG^T01024CLEAR_FIELDS^T00200HELP_TEXT"_$C(30)
 ;
 S FHCDX=$G(FHCDX,""),TEXT=$G(TEXT,"")
 S BQIREC("APCDTNQ")="APCDTNQ"_U_U_"N"_U_"APCDTNQ"_U_$C(30)
 S BQIREC("FHCNAR")="FHCNAR"_U_TEXT_U_"Y"_U_U_$C(30)
 ;
 ;If TEXT is blank plug in DX description
 I FHCDX]"",TEXT="" D
 . I $$VERSION^XPDUTL("BCSV") S TEXT=$P($$ICDDX^ICDCODE(FHCDX,DT),U,4) ;Adapted from COND^APCDFH (APCD FAMILY HISTORY ADD/EDIT option)
 ;
 ;If TEXT present, file entry in 9999999.27
 I TEXT]"" D
 .N DIC,DLAYGO,SOURCE,VALUE,X,Y,IEN
 .S SOURCE="APCDTNQ"
 .S DIC(0)="LX",DIC="^AUTNPOV(",DLAYGO=9999999.27,X=TEXT
 .D ^DIC
 .S IEN=+Y
 .I IEN=-1 K DO,DD D FILE^DICN S IEN=+Y
 .S $P(BQIREC("APCDTNQ"),U,2)=IEN_$C(29)_TEXT
 .S $P(BQIREC("APCDTNQ"),U,4)=""
 .S $P(BQIREC("FHCNAR"),U,2)=TEXT
 ;
 S II=II+1,@DATA@(II)=BQIREC("APCDTNQ")
 S II=II+1,@DATA@(II)=BQIREC("FHCNAR")
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
INIT(DATA,FHRIEN) ; EP - BQI VFILE INITIAL FH REL
 ;
 ;Input
 ; FHRIEN - FAMILY HISTORY FAMILY MEMBER IEN (NULL FOR NEW)
 ; 
 NEW BQIREC,II,UID
 ;
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIVFTRF",UID))
 K @DATA
 S FHRIEN=$G(FHRIEN,"")
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIVFTRF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S @DATA@(II)="T00008SOURCE^T00030VALUE^T00001ABLE_FLAG^T01024CLEAR_FIELDS^T00200HELP_TEXT"_$C(30)
 ;
 ;Version check
 I $$VERSION^XPDUTL("BJPC")<2.0 S BMXSEC="RPC Call Failed: IHS PCC SUITE 2.0 must be installed in RPMS" Q
 ;
 ;Initialize Records
 S BQIREC("FHRAAD")="FHRAAD"_U_U_"N"_U_"FHRAAD"_U_$C(30)
 S BQIREC("FHRCOD")="FHRCOD"_U_U_"N"_U_"FHRCOD"_U_$C(30)
 S BQIREC("FHRMBT")="FHRMBT"_U_U_"N"_U_"FHRMBT"_U_$C(30)
 ;
 I FHRIEN'="" D
 . N BQIREL,FHRMB,FHRSTS
 . D GETS^DIQ(9000014.1,FHRIEN_",",".04;.07","","BQIREL")
 . ;
 . ;Age At Death/Cause Of Death
 . S FHRSTS=$G(BQIREL(9000014.1,FHRIEN_",",".04"))
 . I FHRSTS="DECEASED" D
 .. S $P(BQIREC("FHRAAD"),U,3,4)="Y^"
 .. S $P(BQIREC("FHRCOD"),U,3,4)="Y^"
 . ;
 . ;Multiple Birth Type
 . S FHRMB=$G(BQIREL(9000014.1,FHRIEN_",",".07"))
 . I FHRMB="YES" S $P(BQIREC("FHRMBT"),U,3,4)="Y^"
 ;
 S II=II+1,@DATA@(II)=BQIREC("FHRAAD")
 S II=II+1,@DATA@(II)=BQIREC("FHRCOD")
 S II=II+1,@DATA@(II)=BQIREC("FHRMBT")
 S II=II+1,@DATA@(II)=$C(31)
 Q