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

BQIMTCR1.m

Go to the documentation of this file.
BQIMTCR1 ;GDIT/HS/ALA-Definition Detail results ; 20 Feb 2013  4:48 PM
 ;;2.3;ICARE MANAGEMENT SYSTEM;**3,4**;Apr 18, 2012;Build 66
 ;
IN(RIEN,FIELD,RESULT) ;EP - Inpatient
 NEW FSPC,NURSE,TFAC
 S RESULT=0
 I FIELD="ADTM"!(FIELD="ATYP")!(FIELD="DIAG") D
 . I $$GET1^DIQ(405,RIEN_",",.02,"E")'="ADMISSION" Q
 . I FIELD="ADTM" S RESULT=1_U_$$GET1^DIQ(405,RIEN_",",.01,"I") Q
 . I FIELD="ATYP" S RESULT=1_U_$$GET1^DIQ(405,RIEN_",",.04,"E") Q
 . I FIELD="DIAG" S RESULT=1_U_$$GET1^DIQ(405,RIEN_",",.1,"E") Q
 I FIELD="DDTM"!(FIELD="DTYP") D
 . S NXN=""
 . F  S NXN=$O(^DGPM("CA",RIEN,NXN)) Q:NXN=""  D
 .. I $$GET1^DIQ(405,NXN_",",.02,"E")'="DISCHARGE" Q
 .. I FIELD="DDTM" S RESULT=1_U_$$GET1^DIQ(405,NXN_",",.01,"I") Q
 .. I FIELD="DTYP" S RESULT=1_U_$$GET1^DIQ(405,NXN_",",.04,"E") Q
 ;
 I FIELD="APROV" D
 . S NXN=""
 . F  S NXN=$O(^DGPM("CA",RIEN,NXN)) Q:NXN=""  D
 .. S PROV=$$GET1^DIQ(405,NXN_",",.19,"E") I PROV="" Q
 .. S RESULT=RESULT_PROV_$C(10)_$C(13)
 . S:$E(RESULT,1,1)=0 RESULT=$E(RESULT,2,$L(RESULT))
 . S RESULT=1_U_$$TKO^BQIUL1(RESULT,$C(10)_$C(13))
 I FIELD="WARD" D
 . S NXN=""
 . F  S NXN=$O(^DGPM("CA",RIEN,NXN)) Q:NXN=""  D
 .. S WARD=$$GET1^DIQ(405,NXN_",",.06,"E") I WARD="" Q
 .. S RESULT=RESULT_WARD_$C(10)_$C(13)
 . S:$E(RESULT,1,1)=0 RESULT=$E(RESULT,2,$L(RESULT))
 . S RESULT=1_U_$$TKO^BQIUL1(RESULT,$C(10)_$C(13))
 I FIELD="TFAC" D
 . S NXN=""
 . F  S NXN=$O(^DGPM("CA",RIEN,NXN)) Q:NXN=""  D
 .. S TFAC=$$GET1^DIQ(405,NXN_",",.05,"E") I TFAC="" Q
 .. S RESULT=RESULT_TFAC_$C(10)_$C(13)
 . S:$E(RESULT,1,1)=0 RESULT=$E(RESULT,2,$L(RESULT))
 . S RESULT=1_U_$$TKO^BQIUL1(RESULT,$C(10)_$C(13))
 I FIELD="FSPEC" D
 . S NXN=""
 . F  S NXN=$O(^DGPM("CA",RIEN,NXN)) Q:NXN=""  D
 .. S FSPC=$$GET1^DIQ(405,NXN_",",.09,"E") I FSPC="" Q
 .. S RESULT=RESULT_FSPC_$C(10)_$C(13)
 . S:$E(RESULT,1,1)=0 RESULT=$E(RESULT,2,$L(RESULT))
 . S RESULT=1_U_$$TKO^BQIUL1(RESULT,$C(10)_$C(13))
 ;
 I FIELD="NURSE" D
 . NEW BQIMT
 . S VISIT=$P(^DGPM(RIEN,0),U,27) I VISIT="" Q
 . S TIEN=""
 . F  S TIEN=$O(^TIU(8925,"V",VISIT,TIEN)) Q:TIEN=""  D
 .. I $$GET1^DIQ(8925,TIEN_",",.01,"E")'["NURSE" Q
 .. S NURSE=$$GET1^DIQ(8925,TIEN_",",1202,"E")
 .. S BQIMT(NURSE)=""
 . S NURSE=""
 . F  S NURSE=$O(BQIMT(NURSE)) Q:NURSE=""  S RESULT=RESULT_NURSE_$C(10)_$C(13)
 . S:$E(RESULT,1,1)=0 RESULT=$E(RESULT,2,$L(RESULT))
 . S RESULT=1_U_$$TKO^BQIUL1(RESULT,$C(10)_$C(13))
 Q RESULT
 ;
RM(RIEN,FIELD,RESULT) ; EP - Reminder Notifications
 S RESULT=0
 I FIELD="CODE" D  Q RESULT
 . NEW DUE
 . S RN=$O(^BQIPAT(DFN,40,"B",RIEN,"")) Q:RN=""
 . S DUE=$P($G(^BQIPAT(DFN,40,RN,0)),U,4) I DUE="" S DUE=DT
 . S DUE=$$FMTMDY^BQIUL1(DUE)
 . S RESULT=1_U_DUE
 S RN="",RN=$O(^BQI(90509.4,"C",DFN,RIEN,RN),-1) I RN'=""  D
 . I FIELD=.04 I $P(^BQI(90509.4,RN,0),U,4)'="" S RESULT=1_U_$P(^BQI(90509.4,RN,0),U,4) Q
 . I FIELD=.05 S RESULT=$$GET1^DIQ(90509.4,RN_",",FIELD,"E") I RESULT'="" S RESULT=1_U_RESULT Q
 . I FIELD=.03 S RESULT=$$GET1^DIQ(90509.4,RN_",",FIELD,"E") I RESULT'="" S RESULT=1_U_RESULT Q
 . I FIELD=.08 S RESULT=$$GET1^DIQ(90509.4,RN_",",FIELD,"E") I RESULT'="" S RESULT=1_U_RESULT Q
 . I FIELD=.11 I $P(^BQI(90509.4,RN,0),U,11)'="" S RESULT=1_U_$P(^BQI(90509.4,RN,0),U,11)
 Q RESULT