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

BQIPTDDG.m

Go to the documentation of this file.
BQIPTDDG ;APTIV/HC/ALA-Patient Detail Demographics ; 03 Mar 2008  1:32 PM
 ;;2.2;ICARE MANAGEMENT SYSTEM;;Jul 28, 2011;Build 37
 ;
 Q
 ;
EN(DATA,DFN) ; EP -- BQI PATIENT DETAIL DEMOG
 ; 
 ; Input
 ;  DFN    - Patients DFN or internal entry number
 ;
 NEW UID,II,HDR
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIPTDDG",UID))
 K @DATA
 ;
 S II=0
 ;
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPTDDG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S HDR="T00015MARITAL_STATUS^T00030CLASS^T00012ENROLL_NO^T00042TRIBE^T00030TRIBE_QUANTUM^T00030INDIAN_BLOOD^"
 ;
 NEW MSTAT,CLASS,ENROLL,TRIBE,TQUANT,IQUANT,RETURN,POBC,POBS,POB,DLEN,LENGTH
 NEW RACE,BN,ETHN,OTRIB,IEN,POBSI,HMLOC
 S IEN=DFN_","
 S MSTAT=$$GET1^DIQ(2,IEN,.05,"E")
 S CLASS=$$GET1^DIQ(9000001,IEN,1111,"E")
 S ENROLL=$$GET1^DIQ(9000001,IEN,.07,"E")
 S TRIBE=$$GET1^DIQ(9000001,IEN,1108,"E")
 S TQUANT=$$GET1^DIQ(9000001,IEN,1109,"E")
 S IQUANT=$$GET1^DIQ(9000001,IEN,1110,"E")
 S RETURN=MSTAT_U_CLASS_U_ENROLL_U_TRIBE_U_TQUANT_U_IQUANT_U
 S POBC=$$GET1^DIQ(2,IEN,.092,"E"),POBS=""
 ;S POBSI=$$GET1^DIQ(2,IEN,.093,"I") I POBSI'="" S POBS=$$GET1^DIQ(5,IEN,1,"E")
 S POBS=$$GET1^DIQ(5,$$GET1^DIQ(2,IEN,.093,"I"),1,"E")
 S POB=POBC_" "_POBS,LENGTH=$L(POB),DLEN=$E("00000",$L(LENGTH)+1,5)_LENGTH
 S HDR=HDR_"T"_DLEN_"PLACE_OF_BIRTH"_U,RETURN=RETURN_POB_U
 ;
 S BN=0,RACE=""
 F  S BN=$O(^DPT(DFN,.02,BN)) Q:'BN  D
 . NEW DA,IENS
 . S DA(1)=DFN,DA=BN,IENS=$$IENS^DILF(.DA)
 . S RACE=RACE_$$GET1^DIQ(2.02,IENS,.01,"E")_";"
 S RACE=$$TKO^BQIUL1(RACE,";"),LENGTH=$L(RACE)
 S:LENGTH=""!(LENGTH=0) LENGTH=45
 S DLEN=$E("00000",$L(LENGTH)+1,5)_LENGTH
 S HDR=HDR_"T"_DLEN_"RACE"_U,RETURN=RETURN_RACE_U
 ;
 S BN=0,ETHN=""
 F  S BN=$O(^DPT(DFN,.06,BN)) Q:'BN  D
 . NEW DA,IENS
 . S DA(1)=DFN,DA=BN,IENS=$$IENS^DILF(.DA)
 . S ETHN=ETHN_$$GET1^DIQ(2.06,IENS,.01,"E")_";"
 S ETHN=$$TKO^BQIUL1(ETHN,";"),LENGTH=$L(ETHN)
 S:LENGTH=""!(LENGTH=0) LENGTH=30
 S DLEN=$E("00000",$L(LENGTH)+1,5)_LENGTH
 S HDR=HDR_"T"_DLEN_"ETHNICITY"_U,RETURN=RETURN_ETHN_U
 ;
 S BN=0,OTRIB=""
 F  S BN=$O(^AUPNPAT(DFN,43,BN)) Q:'BN  D
 . NEW DA,IENS
 . S DA(1)=DFN,DA=BN,IENS=$$IENS^DILF(.DA)
 . S OTRIB=OTRIB_$$GET1^DIQ(9000001.43,IENS,.01,"E")_";"
 S OTRIB=$$TKO^BQIUL1(OTRIB,";"),LENGTH=$L(OTRIB)
 S:LENGTH=""!(LENGTH=0) LENGTH=42
 S DLEN=$E("00000",$L(LENGTH)+1,5)_(LENGTH+1)
 S HDR=HDR_"T"_DLEN_"OTHER_TRIBES"_U,RETURN=RETURN_OTRIB_U
 ;
 ;Location of Home
 S HMLOC=$$HMLOC(DFN)
 S HDR=HDR_"T01024HMLOC",RETURN=RETURN_HMLOC
 ;
 S @DATA@(II)=HDR_$C(30)
 S II=II+1,@DATA@(II)=RETURN_$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
 ;
HMLOC(DFN) ;EP - Return Patient Location of Home Value (Panel View field HMLOC)
 ;
 N IEN,LIEN,HMLOC,FLDS,GDDATA
 S IEN=DFN_","
 S FLDS="1201"
 D GETS^DIQ(9000001,IEN,FLDS,"E","GDDATA")
 ;
 ;Patient Location
 S (HMLOC,LIEN)="" F  S LIEN=$O(GDDATA(9000001,IEN,1201,LIEN)) Q:'LIEN  D
 . S HMLOC=$G(HMLOC)_$S($G(HMLOC)]"":" ",1:"")_$G(GDDATA(9000001,IEN,1201,LIEN))
 K LIEN
 ;
 Q HMLOC