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

BQIPLCTX.m

Go to the documentation of this file.
BQIPLCTX ;VNGT/HS/ALA-Create Community Taxonomy ; 13 Feb 2009  4:59 PM
 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
 ;
UPD(DATA,PARMS) ; EP -- BQI UPDATE COMM TAXONOMY
 NEW UID,II,BQICOMM
 NEW ATXFLG,BCOM,BI,BN,BQ,BQFIL,BQFLD,BQIDATA,BQJ,BQN,BQQI,DFIELD,DFILE,ERROR
 NEW IEN,LINK,NAME,PDATA,PFIEN,PTYP,RESULT,VALUE,VFIEN,X,Y
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIPLCTX",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPLCTX D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S @DATA@(II)="I00010RESULT^T01024MSG^I00010CTXIEN"_$C(30)
 ;
 S PARMS=$G(PARMS,"")
 I PARMS="" D
 . S LIST="",BN=""
 . F  S BN=$O(PARMS(BN)) Q:BN=""  S LIST=LIST_PARMS(BN)
 . K PARMS
 . S PARMS=LIST
 . K LIST
 ;
 S VFIEN=$O(^BQI(90506.3,"B","Community Taxonomy",""))
 I VFIEN="" S BMXSEC="RPC Call Failed: Community Taxonomy does not exist." Q
 S DFILE=$P(^BQI(90506.3,VFIEN,0),U,2)
 S LINK=$O(^AMQQ(1,"B","PATIENT;CURRENT COMMUNITY",""))
 K BQWP
 F BQ=1:1:$L(PARMS,$C(28)) D
 . S PDATA=$P(PARMS,$C(28),BQ) Q:PDATA=""
 . S NAME=$P(PDATA,"=",1),VALUE=$P(PDATA,"=",2,99)
 . I VALUE="" S VALUE="@"
 . S PFIEN=$O(^BQI(90506.3,VFIEN,10,"AC",NAME,""))
 . S PTYP=$P($G(^BQI(90506.3,VFIEN,10,PFIEN,1)),U,1)
 . S DFIELD=$P($G(^BQI(90506.3,VFIEN,10,PFIEN,3)),U,1)
 . I PTYP="D",VALUE'="@" S VALUE=$$DATE^BQIUL1(VALUE)
 . I PTYP="W" D  Q
 .. I VALUE="@" S BQIDATA(DFILE,DFIELD)=VALUE Q
 .. F BQQI=1:1  S BQJ=$P(VALUE,$C(10),BQQI) Q:BQJ=""  D
 ... S BQWP(DFILE,DFIELD,BQQI)=BQJ
 . I NAME="AMQQCOMM",VALUE[$C(29) D  Q
 .. F BI=1:1:$L(VALUE,$C(29)) D
 ... S BCOM=$P(VALUE,$C(29),BI) I BCOM="" Q
 ... I BCOM?.N S BCOM=$P($G(^AUTTCOM(BCOM,0)),U,1) I BCOM="" Q
 ... S BQICOMM(9002226.02101,BCOM)=""
 . I DFIELD'=".01" S BQIDATA(DFILE,DFIELD)=VALUE
 . I DFIELD=".01" S X=VALUE
 ;
 S ATXFLG="",DIC="^ATXAX(",DIC(0)="QLX",DLAYGO=9002226
 D ^DIC K DIC,DLAYGO
 I Y=-1 K DO,DD D FILE^DICN
 S IEN=+Y
 S BQIUPD(DFILE,IEN_",",.05)=DUZ,BQIUPD(DFILE,IEN_",",.08)=0
 S BQIUPD(DFILE,IEN_",",.09)=DT,BQIUPD(DFILE,IEN_",",.12)=LINK
 S BQIUPD(DFILE,IEN_",",.13)=0,BQIUPD(DFILE,IEN_",",.15)=9999999.05
 D SAV(.BQIUPD,IEN_",")
 D FILE^DIE("","BQIUPD","ERROR")
 ;
 I $G(^ATXAX(IEN,21,0))="" S ^ATXAX(IEN,21,0)="^9002226.02101^^"
 NEW DA,DIK
 S DA(1)=IEN,DIK="^ATXAX("_DA(1)_",21,",DA=0
 F  S DA=$O(^ATXAX(IEN,21,DA)) Q:'DA  D
 . S BCOM=$P($G(^ATXAX(IEN,21,DA,0)),U) I BCOM]"" K ^ATXAX(IEN,21,"AA",BCOM,BCOM)
 . D ^DIK
 ;
 S BCOM="",DIC(0)="QL",DLAYGO=9002226.02101,DIC="^ATXAX("_DA(1)_",21,"
 F  S BCOM=$O(BQICOMM(9002226.02101,BCOM)) Q:BCOM=""  D
 . S X=BCOM
 . K DO,DD D FILE^DICN
 . S ^ATXAX(IEN,21,"AA",BCOM,BCOM)=""
 ;
 ; Set any extended description
 I $D(BQIWP) D WP^DIE(9002226,IEN_",",1101,"","BQIWP","ERROR")
 ;
 I $D(ERROR) S RESULT=-1_U_$G(ERROR("DIERR","1","TEXT","1"))
 I '$D(ERROR) D
 . S RESULT=1_U_U_IEN
 . ; Set taxonomy into list
 . D UPD^BQITAXX4($P(^ATXAX(IEN,0),U,1),"","CM",7)
 S II=II+1,@DATA@(II)=RESULT_$C(30)
 ;
DONE ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
SAV(BQIUPD,IENS) ;EP - Set the data
 ;
 K BQIWP
 S BQFIL=""
 F  S BQFIL=$O(BQIDATA(BQFIL)) Q:BQFIL=""  D
 . S BQFLD=""
 . F  S BQFLD=$O(BQIDATA(BQFIL,BQFLD)) Q:BQFLD=""  D
 .. S BQIUPD(BQFIL,IENS,BQFLD)=BQIDATA(BQFIL,BQFLD)
 ;
 I $D(BQWP) D WP(IENS)
 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
 ;
WP(WIENS) ;EP - Set up word-processing array
 NEW DIWL,DIWR
 K ^UTILITY($J,"W")
 S DIWL=1,DIWR=70
 S BQFIL=""
 F  S BQFIL=$O(BQWP(BQFIL)) Q:BQFIL=""  D
 . S BQFLD=""
 . F  S BQFLD=$O(BQWP(BQFIL,BQFLD)) Q:BQFLD=""  D
 .. S BQN=""
 .. F  S BQN=$O(BQWP(BQFIL,BQFLD,BQN)) Q:BQN=""  D
 ... ;S BQIWP(BQFIL,WIENS,BQFLD,BQN)=BQWP(BQFIL,BQFLD,BQN)
 ... S X=BQWP(BQFIL,BQFLD,BQN)
 ... D ^DIWP
 ;
 S BQN=""
 F  S BQN=$O(^UTILITY($J,"W",1,BQN)) Q:BQN=""  S BQIWP(BQN)=^UTILITY($J,"W",1,BQN,0)
 K ^UTILITY($J,"W")
 Q