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

BQIPTIMM.m

Go to the documentation of this file.
BQIPTIMM ;PRXM/HC/ALA - PATIENT IMMUNIZATIONS ; 27 Mar 2007  11:00 AM
 ;;2.4;ICARE MANAGEMENT SYSTEM;;Apr 01, 2015;Build 41
 ;
 Q
 ;
IMM(DATA,DFN,DRANGE) ; EP -- BQI PATIENT IMMUNIZATIONS
 ;
 ;Description - all the immunizations that a patient has
 ;
 ;Input
 ;  DFN - Patient internal entry number
 ;
 NEW UID,II,IEN,VISIT,VSDTM,IMMN,SERIES,LOT,REAC,SITE,VOL,VCDTM,ORPHY,ENPHY
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIPTIMM",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPTIMM D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S DRANGE=$$DATE^BQIUL1($G(DRANGE))
 S @DATA@(II)="I00010IMM_IEN^I00010VISIT_IEN^D00030VISIT_DATETIME^T00100IMMUNIZATION^T00006SERIES^T00030REACTION^T00035ORD_PROV^T00035ENC_PROV"_$C(30)
 S IEN=""
 F  S IEN=$O(^AUPNVIMM("AC",DFN,IEN),-1) Q:IEN=""  D
 . S IMMN=$$GET1^DIQ(9000010.11,IEN_",",.01,"E") I IMMN="" Q
 . S VISIT=$$GET1^DIQ(9000010.11,IEN_",",.03,"I") I VISIT="" Q
 . S VSDTM=$$GET1^DIQ(9000010,VISIT_",",.01,"I") I VSDTM=0 Q
 . I DRANGE'="",(VSDTM\1<DRANGE) Q
 . S SERIES=$$GET1^DIQ(9000010.11,IEN_",",.04,"E")
 . S LOT=$$GET1^DIQ(9000010.11,IEN_",",.05,"E")
 . S REAC=$$GET1^DIQ(9000010.11,IEN_",",.06,"E")
 . S SITE=$$GET1^DIQ(9000010.11,IEN_",",.09,"E")
 . S VOL=$$GET1^DIQ(9000010.11,IEN_",",.11,"E")
 . S VCDTM=$$GET1^DIQ(9000010.11,IEN_",",.12,"I")
 . S ORPHY=$$GET1^DIQ(9000010.11,IEN_",",1202,"E")
 . S ENPHY=$$GET1^DIQ(9000010.11,IEN_",",1204,"E")
 . S II=II+1,@DATA@(II)=IEN_U_VISIT_U_$$FMTE^BQIUL1(VSDTM)_U_IMMN_U_SERIES_U_REAC_U_ORPHY_U_ENPHY_$C(30)
 ;
 ; Check for refusals
 D REF
 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
 ;
REF ; Check for refusals
 NEW IMM,RVDT,REVDT,RFIEN,IMMUN,REAC,ORPHY,SERIES,ENPHY
 S IMM=""
 F  S IMM=$O(^AUPNPREF("AA",DFN,9999999.14,IMM)) Q:IMM=""  D
 . S RVDT=""
 . F  S RVDT=$O(^AUPNPREF("AA",DFN,9999999.14,IMM,RVDT)) Q:RVDT=""  D
 .. ; Reverse the reverse date
 .. S REVDT=9999999-RVDT
 .. I DRANGE'="",(REVDT\1)<DRANGE Q
 .. S RFIEN=""
 .. F  S RFIEN=$O(^AUPNPREF("AA",DFN,9999999.14,IMM,RVDT,RFIEN)) Q:RFIEN=""  D
 ... S IMMUN=$$GET1^DIQ(9999999.14,IMM_",",.01,"E")
 ... S REAC=$$GET1^DIQ(9000022,RFIEN_",",.07,"E")
 ... S ORPHY=$$GET1^DIQ(9000022,RFIEN_",",1204,"E")
 ... S SERIES="",ENPHY=""
 ... S II=II+1,@DATA@(II)=U_U_$$FMTE^BQIUL1(REVDT)_U_IMMUN_U_SERIES_U_REAC_U_ORPHY_U_ENPHY_$C(30)
 Q
 ;
GLS(DATA,FAKE) ;EP - BQI GET IMMUNIZATIONS GLOSSARY
 NEW UID,II,TRIEN,CAT,TIT,SORT,RMK,REMARK,CT,NXT,GLIEN,IEN,IIEN
 ;
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIIMGLS",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPTIMM D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="T32767REPORT_TEXT"_$C(30)
 S GLIEN=$O(^BQI(90508.2,"B","Immunizations","")) I GLIEN="" S BMXSEC="Problem with Immunizations glossary in file 90508.2" G DONE
 S IEN=0 F  S IEN=$O(^BQI(90508.2,GLIEN,1,IEN)) Q:'IEN  D
 . S II=II+1,@DATA@(II)=$G(^BQI(90508.2,GLIEN,1,IEN,0))
 ;S GLIEN=$O(^BQI(90506.5,"B","Immunizations","")) I GLIEN="" S BMXSEC="Problem with Immunizations source list" G DONE
 ;S IEN=0 F  S IEN=$O(^BQI(90506.5,GLIEN,10,IEN)) Q:'IEN  D
 ;. S IIEN=$P(^BQI(90506.5,GLIEN,10,IEN,0),U,4)
 ;. S II=II+1,@DATA@(II)="    "_$P(^BQI(90506.5,GLIEN,10,IEN,0),U,3)_" ("_$P($G(^AUTTIMM(IIEN,1)),U,14)_")"
 I II>0 S @DATA@(II)=@DATA@(II)_$C(30)
 ;
DONE S II=II+1,@DATA@(II)=$C(31)
 Q