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

BQIVFDEF.m

Go to the documentation of this file.
BQIVFDEF ;PRXM/HC/ALA - PCC V-file definition ; 22 Mar 2007  2:55 PM
 ;;2.6;ICARE MANAGEMENT SYSTEM;;Jul 07, 2017;Build 72
 Q
 ;
EN(DATA,VFILE,TYPE) ;EP -- BQI GET VFILE DISPLAY
 ;
 ;Input
 ;  VFILE - The vfile number or name
 ;
 NEW UID,II,IEN,VFIL,VALUE,ORD,VDATA,VDATA1,VDATA2,BJ,CLEAR,CLRFLD,CN
 NEW HELP,VDATA3,VFILN,VHELP,BN,BQIHELP,BQIHELPW,VFLD,VDATA9
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIVFDEF",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIVFDEF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S VFIEN=$G(VFILE,""),TYPE=$G(TYPE,"V")
 ;
 S HDR="T00030VFILE_NAME^T00015VFILE_NUMBER^T00030DISPLAY_RPC^T00045DISPLAY_RPC_PARAM^T00030EDIT_RPC^T00045EDIT_RPC_PARAM^T00030INIT_TRIGGER_RPC^"
 S HDR=HDR_"T00045INIT_TRIG_PARAM^T00030DELETE_RPC^T00045DELETE_RPC_PARAM^T00001FILTER^T00030VALID_RPC^"
 S HDR=HDR_"T00030DISPLAY_COLUMN^T00030INTERNAL_COLUMN^I00003SIZE^T00001COL_TYPE_PEND^T00001COL_TYPE_VIEW^T00008CODE^T00001GROUP^T00001CODE_TYPE^T00030UPPER^T00030LOWER^"
 S HDR=HDR_"T00030DEFAULT^T00001ACTION^T00001REQ_OPT^T00036EXCLUSION^T00001UNIQUE_VAL^T00003BATCH^T00045VALIDATION^T00030VALID_INPUT^T00020TABLE^T00001TABLE_LOOKUP^T00001PROV_SCREEN^T00150TABLE_SCREEN^"
 ;S HDR=HDR_"T00030DEFAULT^T00001ACTION^T00001REQ_OPT^T00036EXCLUSION^T00045VALIDATION^T00030VALID_INPUT^T00020TABLE^T00001TABLE_LOOKUP^T00001PROV_SCREEN^T00150TABLE_SCREEN^"
 S HDR=HDR_"T00001TRIGGER^T00030TRIG_RPC^T00045TRIG_CODES^T00001TABLE_PRELOAD^T00001TABLE_LOOKUP_TYPE^T00003DEC_PLACES^T00030ALT_DISPLAY^T00030MULT_REF^T00045GROUP_NAME^I00003GRID_ORDER^"
 S HDR=HDR_"T00030LINK_DATA_COL^T00045LINK_RPC^T00030LINK_PARAM^T00250CLEAR_FIELDS^T01024HELP_TEXT"_$C(30)
 S @DATA@(II)=HDR
 ;
 I VFIEN="" D  G DONE
 . S VFIL=0
 . F  S VFIL=$O(^BQI(90506.3,"D",TYPE,VFIL)) Q:'VFIL  D
 .. ; If it is a subdefinition for a multiple, it is retrieved from the
 .. ; Master definition so don't need to retrieve data fields
 .. I $$GET1^DIQ(90506.3,VFIL_",",.07,"I") Q
 .. D VF(VFIL)
 ;
 ; If someone passes the name
 I VFIEN'?.N S VFIEN=$$FIND1^DIC(90506.3,"","MX",VFILE,"","","ERROR")
 ; If someone passes the file number
 I $L(VFIEN)>6 S VFIEN=$$FIND1^DIC(90506.3,"","MX",VFILE,"","","ERROR")
 ;
 I VFIEN=0 S BMXSEC="Passed in file "_VFILE_" is not correct" Q
 ;
 D VF(VFIEN)
 ;
DONE ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
VF(VFIL) ;EP
 ; Parameters
 ;   VFILN - File Number
 ;   ORD   - Display Order number
 ;   
 NEW VFDATA,VFSDATA,MULTR,SFIL,VFSDATA2,FILTER,VALID,LINK,LRPC,LINP
 NEW BQN,BQP,BQPARM,VFDATA2,PRMND,PNAM,PTYP,PORD
 ;
 S VFDATA=^BQI(90506.3,VFIL,0)
 S VFDATA2=$G(^BQI(90506.3,VFIL,2))
 S FILTER=$S($D(^BQI(90506.3,VFIL,7)):"Y",1:"N")
 S VALID=$P($G(^BQI(90506.3,VFIL,8)),U,1)
 I $P(VFDATA,U,6)="D" Q
 ;
 D PRMS(VFIL)
 ;
 S VFILN=$P(VFDATA,U,2)
 S VALUE=$P(VFDATA,U,1)_U_VFILN_U_$P(VFDATA,U,4)_U_BQPARM(3)_U_$P(VFDATA,U,12)_U_BQPARM(4)_U_$P(VFDATA,U,13)_U_BQPARM(5)_U_$P(VFDATA2,U)_U_BQPARM(6)_U_FILTER_U_VALID
 S ORD=""
 F  S ORD=$O(^BQI(90506.3,VFIL,10,"C",ORD)) Q:ORD=""  D
 . S IEN=""
 . F  S IEN=$O(^BQI(90506.3,VFIL,10,"C",ORD,IEN)) Q:IEN=""  D
 .. D RET(VFIL,IEN)
 ;
 ;Check for subdefinitions
 S SFIL=""
 F  S SFIL=$O(^BQI(90506.3,"ASUB",VFIL,SFIL)) Q:SFIL=""  D
 . ;S VFILN=$$GET1^DIQ(90506.3,SFIL_",",.02,"E")
 . ;S VALUE=$$GET1^DIQ(90506.3,SFIL_",",.01,"E")_U_VFILN
 . S VFSDATA=^BQI(90506.3,SFIL,0)
 . I $P(VFSDATA,U,3)=1 Q
 . S VFSDATA2=$G(^BQI(90506.3,VFIL,2))
 . S FILTER=$S($D(^BQI(90506.3,VFIL,7)):"Y",1:"N")
 . S VALID=$P($G(^BQI(90506.3,VFIL,8)),U,1)
 . S VFILN=$P(VFSDATA,U,2)
 . D PRMS(SFIL)
 . ;S VALUE=$P(VFSDATA,U,1)_U_VFILN_U_$P(VFSDATA,U,4)_U_$P(VFSDATA,U,12)_U_$P(VFSDATA,U,13)
 . S VALUE=$P(VFSDATA,U,1)_U_VFILN_U_$P(VFSDATA,U,4)_U_BQPARM(3)_U_$P(VFSDATA,U,12)_U_BQPARM(4)_U_$P(VFSDATA,U,13)_U_BQPARM(5)_U_$P(VFSDATA2,U)_U_BQPARM(6)_U_FILTER_U_VALID
 . S ORD=""
 . F  S ORD=$O(^BQI(90506.3,SFIL,10,"C",ORD)) Q:ORD=""  D
 .. S IEN=""
 .. F  S IEN=$O(^BQI(90506.3,SFIL,10,"C",ORD,IEN)) Q:IEN=""  D RET(SFIL,IEN)
 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
 ;
RET(VFIL,IEN) ; Retrieve data
 S VDATA=^BQI(90506.3,VFIL,10,IEN,0)
 I $P(VDATA,U,11)=1 Q
 S VDATA1=$G(^BQI(90506.3,VFIL,10,IEN,1))
 S VDATA2=$G(^BQI(90506.3,VFIL,10,IEN,2))
 S VDATA3=$G(^BQI(90506.3,VFIL,10,IEN,3))
 S VDATA9=$G(^BQI(90506.3,VFIL,10,IEN,9))
 NEW DA,IENS
 S DA(1)=VFIL,DA=IEN,IENS=$$IENS^DILF(.DA)
 S MULTR=$$GET1^DIQ(90506.31,IENS,1.08,"E")
 ;
 ; Check for batch editable flag in 90506.1
 NEW CODE,LIEN,BATCH,LINK,LRPC,LINP
 S CODE=$P(VDATA,U,7),BATCH="NO",LINK=$P(VDATA1,U,10)
 S LRPC=$P(VDATA9,U,1),LINP=$P(VDATA9,U,2)
 S LIEN=$O(^BQI(90506.1,"B",CODE,""))
 I LIEN'="" D
 . S BATCH=+$$GET1^DIQ(90506.1,LIEN_",",.17,"I")
 . S BATCH=$S(BATCH=1:"YES",1:"NO")
 ;
 ;Check default field for API - $P(VDATA1,U,4)
 S DEF=$P(VDATA1,U,4)
 I DEF["$$" D
 . NEW DVAL
 . I DEF["~" S DEF=$TR(DEF,"~","^")
 . X DEF
 . S $P(VDATA1,U,4)=DVAL
 ;
 ; Check for patch requirement
 NEW PATCH,CHNG
 S PATCH=$P(VDATA2,U,10),CHNG=$P(VDATA2,U,11)
 I PATCH'="" D
 . I '$$PATCH^XPDUTL(PATCH) Q
 . I CHNG["~" S CHNG=$TR(CHNG,"~","^")
 . X CHNG
 ; Set the clear fields
 S CLEAR="",CN=0,CLRFLD=""
 F  S CN=$O(^BQI(90506.3,VFIL,10,IEN,10,CN)) Q:'CN  D
 . S CLEAR=CLEAR_$P(^BQI(90506.3,VFIL,10,IEN,10,CN,0),"^",1)_";"
 . S CLRFLD=$$TKO^BQIUL1(CLEAR,";")
 ;
 ; Set up the data fields
 S II=II+1,@DATA@(II)=VALUE_U_$P(VDATA,U,1,4)_U_$P(VDATA,U,12)_U_$P(VDATA,U,7)_U_$P(VDATA,U,14)_U
 F BJ=1:1:7,9 S @DATA@(II)=@DATA@(II)_$P(VDATA1,U,BJ)_U
 S @DATA@(II)=@DATA@(II)_BATCH_U
 F BJ=1:1:5 S @DATA@(II)=@DATA@(II)_$P(VDATA2,U,BJ)_U
 S @DATA@(II)=@DATA@(II)_$G(^BQI(90506.3,VFIL,10,IEN,6))_U_$P(VDATA,U,8)_U
 S @DATA@(II)=@DATA@(II)_$P(VDATA,U,9)_U_$P(VDATA,U,10)_U_$P(VDATA2,U,6)_U_$P(VDATA2,U,9)_U
 S @DATA@(II)=@DATA@(II)_$P(VDATA2,U,7)_U_$P(VDATA2,U,8)_U_MULTR_U_$P(VDATA3,U,4)_U
 S @DATA@(II)=@DATA@(II)_$P(VDATA3,U,5)_U_LINK_U_LRPC_U_LINP_U_CLRFLD_U
 ;
 ;Check for HELP text
 K BQIHELPW,BQIHELP
 S VFLD=$P(VDATA3,U,1),VHELP=""
 I VFLD'="" D
 . D FIELD^DID(VFILN,VFLD,"","HELP-PROMPT","BQIHELP")
 . S VHELP=$G(BQIHELP("HELP-PROMPT"))
 . I VHELP="" D
 .. D FIELD^DID(VFILN,VFLD,"Z","DESCRIPTION","BQIHELPW")
 .. I $G(BQIHELPW("DESCRIPTION"))="" Q
 .. S BN=0,VHELP=""
 .. F  S BN=$O(BQIHELPW("DESCRIPTION",BN)) Q:BN=""  D
 ... S VHELP=VHELP_BQIHELPW("DESCRIPTION",BN,0)_$C(10)
 I $P(VDATA3,U,6)'="" S VHELP=$P(VDATA3,U,6)
 S @DATA@(II)=@DATA@(II)_VHELP_$C(30)
 Q
 ;
VST() ;EP - Get default visit type
 NEW VAL
 I $G(DUZ(2))="" Q "IHS"
 ;S VAL=$$GET1^DIQ(9001001.2,DUZ(2)_",",.17,"E")
 S VAL=$$GET1^DIQ(9001001.2,DUZ(2)_",",.17,"I")
 S VAL=$$STC^BQIUL2(9000010,.03,VAL)
 I VAL="" Q "IHS"
 Q VAL
 ;
HSD() ; EP - Get Health Summary Default
 NEW VAL,AVAL
 S AVAL=$$FIND1^DIC(9001015,,"X","ADULT REGULAR")
 I $G(DUZ(2))="" Q AVAL
 S VAL=$$GET1^DIQ(9001000,DUZ(2)_",",.03,"I")
 I VAL="" Q AVAL
 Q VAL
 ;
PWHD() ; EP - Get Patient Wellness Handout Default
 NEW VAL,AVAL
 I $$VERSION^XPDUTL("BJPC")<2.0 Q ""
 S AVAL=$$FIND1^DIC(9001026,,"X","ADULT REGULAR")
 I $G(DUZ(2))="" Q AVAL
 S VAL=$$GET1^DIQ(9001000,DUZ(2)_",",.16,"I")
 I VAL="" Q AVAL
 Q VAL
 ;
NMBR(PBLIEN) ; EP - Get default problem notes number
 ; Input
 ;   PBLIEN - Problem IEN
 ;   Assumes DUZ(2) for the facility
 NEW FACN
 I PBLIEN="" Q 1
 S FACN=$O(^AUPNPROB(PBLIEN,11,"B",DUZ(2),""))
 I FACN="" Q 1
 Q $O(^AUPNPROB(PBLIEN,11,FACN,11,"B",""),-1)+1
 ;
HPRV(BKMDFN) ; EP - Get the default HIV Provider
 NEW VAL,BKMIEN,BKMHIV,BKMIENS,ARRAY
 S BKMHIV=$$HIVIEN^BKMIXX3()
 S BKMIEN=$$BKMIEN^BKMIXX3(BKMDFN)
 S BKMIENS=BKMHIV_","_BKMIEN_","
 S VAL=""
 I BKMIEN="" D
 . D ALLDP^BDPAPI(BKMDFN,"HIV PROVIDER",.ARRAY)
 . I ARRAY="" S VAL="" Q
 . S VAL=$P(ARRAY,U,2)
 ;
 I BKMIEN'="" D
 . S VAL=$$GET1^DIQ(90451.01,BKMIENS,6,"I")
 Q VAL
 ;
HCSM(BKMDFN) ; EP - Get the default HIV Case Manager
 NEW VAL,BKMIEN,BKMHIV,BKMIENS,ARRAY
 S BKMHIV=$$HIVIEN^BKMIXX3()
 S BKMIEN=$$BKMIEN^BKMIXX3(BKMDFN)
 S BKMIENS=BKMHIV_","_BKMIEN_","
 S VAL=""
 I BKMIEN="" D
 . D ALLDP^BDPAPI(BKMDFN,"HIV CASE MANAGER",.ARRAY)
 . I ARRAY="" S VAL="" Q
 . S VAL=$P(ARRAY,U,2)
 ;
 I BKMIEN'="" D
 . S VAL=$$GET1^DIQ(90451.01,BKMIENS,6.5,"I")
 Q VAL
 ;
USR() ;EP - Get the default user
 Q DUZ_$C(28)_$P($G(^VA(200,DUZ,0)),U,1)
 ;
STAT() ;EP = Get the CMET status
 Q "T"_$C(28)_"TRACKED"
 ;
TBL(FILE,VALUE) ; EP - Get a default for a specific table value
 NEW IEN
 S IEN=$$FIND1^DIC(FILE,"","MX",VALUE,"","","ERROR")
 Q IEN_$C(28)_VALUE
 ;
CLNCR() ; EP - Get the default for Chart Review
 NEW IEN
 S IEN=$$FIND1^DIC(40.7,"","MX","CHART REV/REC MOD","","","ERROR")
 Q $$GET1^DIQ(40.7,IEN_",",1,"E")_$C(28)_"CHART REV/REC MOD"
 ;
PRMS(VFIL) ;EP - Pull RPC parameters
 F BQN=3:1:6 D
 .S BQPARM(BQN)=""
 .N IDT,PRM,TIDT,TPRM
 .S BQP=0 F  S BQP=$O(^BQI(90506.3,VFIL,BQN,BQP)) Q:'BQP  D
 ..S PRMND=$G(^BQI(90506.3,VFIL,BQN,BQP,0))
 ..S PNAM=$P(PRMND,U)
 ..S PTYP=$P(PRMND,U,2) S:PTYP="" PTYP=$S(PNAM["=":"P",1:"I")
 ..S PORD=$P(PRMND,U,3) S:PORD="" PORD=BQP_PNAM
 ..;
 ..;Temp Store of Unique Identifiers
 ..I PTYP="I" D
 ...S TIDT(PORD)=PRMND
 ..;
 ..;Temp Store of Regular Parameters
 ..I PTYP="P" D
 ...S TPRM(PORD)=PRMND
 .;
 .;Form Parameter String
 .S IDT="",BQP="" F  S BQP=$O(TIDT(BQP)) Q:BQP=""  S IDT=IDT_$S(IDT]"":";",1:"")_$P(TIDT(BQP),U)
 .S PRM="",BQP="" F  S BQP=$O(TPRM(BQP)) Q:BQP=""  S PRM=PRM_$S(PRM]"":$C(28),1:"")_$P(TPRM(BQP),U)
 .S BQPARM(BQN)=IDT_$S(IDT]"":";",1:"")_PRM
 .S BQPARM(BQN)=$$TKO^BQIUL1(BQPARM(BQN),";")
 Q
 ;
EVT(EVIEN,POS) ;EP - Event Default
 NEW EVTYPE,EVVALUE,IVALIEN,EIEN,TY
 S EVTYPE="",EVVALUE="",IVALIEN="",EIEN=""
 I $G(EVIEN)="" Q ""
 S TY=$$GET1^DIQ(90621,EVIEN_",",.12,"I")
 I TY'="" S EVTYPE=$$GET1^DIQ(90621.1,TY_",",.09,"E")
 I TY'="" S EIEN=$O(^BTPW(90621,EVIEN,1,"C",TY,""))
 I $G(EIEN)'="" D
 . S EVVALUE=$P(^BTPW(90621,EVIEN,1,EIEN,0),"^",5),IVALIEN=$P(^(0),"^",6),TAXIEN=$P(^(0),U,2)
 I POS=1 Q $G(EVTYPE)
 I POS=2 Q $G(EVVALUE)
 I POS=3 Q $G(IVALIEN)
 I POS=4 Q $G(TAXIEN)