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

GMPLBLD2.m

Go to the documentation of this file.
  1. GMPLBLD2 ; SLC/MKB,JFR -- Bld PL Selection Lists cont ;09/21/11 16:33
  1. ;;2.0;Problem List;**3,28,36**;Aug 25, 1994;Build 65
  1. ;
  1. ; This routine invokes IA #3991
  1. ;
  1. NEWGRP ; Change problem groups
  1. N NEWGRP D FULL^VALM1
  1. I $D(GMPLSAVE),$$CKSAVE D SAVE
  1. NG1 S NEWGRP=$$GROUP("L") G:+NEWGRP'>0 NGQ G:+NEWGRP=+GMPLGRP NGQ
  1. L +^GMPL(125.11,+NEWGRP,0):1 I '$T D G NG1
  1. . W $C(7),!!,"This category is currently being edited by another user!",!
  1. L -^GMPL(125.11,+GMPLGRP,0) S GMPLGRP=NEWGRP
  1. D GETLIST^GMPLBLDC,BUILD^GMPLBLDC("^TMP(""GMPLIST"",$J)",GMPLMODE),HDR^GMPLBLDC
  1. NGQ S VALMBCK="R",VALMSG=$$MSG^GMPLX
  1. Q
  1. ;
  1. GROUP(L) ; Lookup into Problem Selection Group file #125.11
  1. N DIC,X,Y,DLAYGO ; L = "" or "L", if LAYGO is [not] allowed
  1. S DIC="^GMPL(125.11,",DIC(0)="AEQMZ"_L,DIC("A")="Select CATEGORY NAME: "
  1. S:DIC(0)["L" DLAYGO=125.11
  1. D ^DIC S:Y'>0 Y="^" S:Y'="^" Y=+Y_U_Y(0)
  1. Q Y
  1. ;
  1. NEWLST ; Change selection lists
  1. N NEWLST D FULL^VALM1
  1. I $D(GMPLSAVE),$$CKSAVE D SAVE
  1. NL1 S NEWLST=$$LIST("L") G:+NEWLST'>0 NLQ G:+NEWLST=+GMPLSLST NLQ
  1. L +^GMPL(125,+NEWLST,0):1 I '$T D G NL1
  1. . W $C(7),!!,"This list is currently being edited by another user!",!
  1. L -^GMPL(125,+GMPLSLST,0) S GMPLSLST=NEWLST
  1. D GETLIST^GMPLBLD,BUILD^GMPLBLD("^TMP(""GMPLIST"",$J)",GMPLMODE),HDR^GMPLBLD
  1. NLQ S VALMBCK="R",VALMSG=$$MSG^GMPLX
  1. Q
  1. ;
  1. LIST(L) ; Lookup into Problem Selection List file #125
  1. N DIC,X,Y,DLAYGO ; L="" or "L" if LAYGO [not] allowed
  1. S DIC="^GMPL(125,",DIC(0)="AEQMZ"_L,DIC("A")="Select LIST NAME: "
  1. S:DIC(0)["L" DLAYGO=125
  1. D ^DIC S:Y'>0 Y="^" S:Y'="^" Y=+Y_U_Y(0)
  1. Q Y
  1. ;
  1. LAST(ROOT) ; Returns last subscript
  1. N I,J S (I,J)=""
  1. F S I=$O(@(ROOT_"I)")) Q:I="" S J=I
  1. Q J
  1. ;
  1. CKSAVE() ; Save [changes] ??
  1. N DIR,X,Y,TEXT S TEXT=$S($D(GMPLGRP):"category",1:"list")
  1. S DIR("A")="Save the changes to this "_TEXT_"? ",DIR("B")="YES"
  1. S DIR("?",1)="Enter YES to save the changes that have been made to this "_TEXT,DIR("?")="before exiting it; NO will leave this "_TEXT_" unchanged."
  1. S DIR(0)="YA" D ^DIR
  1. Q +Y
  1. ;
  1. SAVE ; Save changes to group/list
  1. N GMPLQT,LABEL,DA
  1. S GMPLQT=0
  1. I $D(GMPLGRP) D I GMPLQT Q
  1. . N ITM,CODE
  1. . S ITM=0
  1. . F S ITM=$O(^TMP("GMPLIST",$J,ITM)) Q:'ITM!(GMPLQT) D
  1. .. N GMI
  1. .. S CODE=$P(^TMP("GMPLIST",$J,ITM),U,4) Q:'$L(CODE)
  1. .. F GMI=1:1:$L(CODE,"/") I '$$STATCHK^ICDAPIU($P(CODE,"/",GMI),DT) S GMPLQT=1 Q
  1. . I 'GMPLQT Q ;no inactive codes in the category
  1. . D FULL^VALM1
  1. . W !!,$C(7),"This Group contains problems with inactive ICD9 codes associated with them."
  1. . W !,"The codes must be edited and corrected before the group can be saved."
  1. . N DIR,DUOUT,DTOUT,DIRUT
  1. . S DIR(0)="E" D ^DIR
  1. . S VALMBCK="R",GMPLQT=1
  1. . Q
  1. ;
  1. I '$D(GMPLGRP),$D(GMPLSLST) D I GMPLQT Q
  1. . N GRP
  1. . S GRP=0
  1. . F S GRP=$O(^TMP("GMPLIST",$J,"GRP",GRP)) Q:'GRP!(GMPLQT) D
  1. .. I $$VALGRP(GRP) Q ;no inactive codes in the GROUP
  1. .. S GMPLQT=1
  1. . I 'GMPLQT Q ; all groups and problems OK
  1. . D FULL^VALM1
  1. . W !!,$C(7),"This Selection List contains problems with inactive ICD9 codes associated with"
  1. . W !,"them. The codes must be edited and corrected before the list can be saved."
  1. . N DIR,DUOUT,DTOUT,DIRUT
  1. . S DIR(0)="E" D ^DIR
  1. . S VALMBCK="R",GMPLQT=1
  1. . Q
  1. W !!,"Saving ..."
  1. S DA=0,LABEL=$S($D(GMPLGRP):"SAVGRP",1:"SAVLST")
  1. F S DA=$O(^TMP("GMPLIST",$J,DA)) Q:+DA'>0 D @LABEL
  1. K GMPLSAVE S:$D(GMPLGRP) GMPSAVED=1
  1. S VALMBCK="Q" W " done." H 1
  1. Q
  1. SAVGRP ; Save changes to existing group
  1. N DIK,DIE,DR,ITEM,TMPITEM
  1. S DIK="^GMPL(125.12,"
  1. I +DA'=DA D Q
  1. . Q:"@"[$G(^TMP("GMPLIST",$J,DA)) ; nothing to save
  1. . S TMPITEM=^TMP("GMPLIST",$J,DA) D NEW(DIK,+GMPLGRP,TMPITEM)
  1. I "@"[$G(^TMP("GMPLIST",$J,DA)) D ^DIK Q
  1. S ITEM=$P($G(^GMPL(125.12,DA,0)),U,2,7)
  1. I ITEM'=^TMP("GMPLIST",$J,DA) D
  1. . S DR="",DIE=DIK
  1. . F I=1:1:6 D
  1. .. S:$P(^TMP("GMPLIST",$J,DA),U,I)'=$P(ITEM,U,I) DR=DR_";"_I_"////"_$S($P(^TMP("GMPLIST",$J,DA),U,I)="":"@",1:$P(^TMP("GMPLIST",$J,DA),U,I))
  1. . S:$E(DR)=";" DR=$E(DR,2,999) D ^DIE
  1. Q
  1. ;
  1. SAVLST ; Save changes to existing list
  1. N DIK,DIE,DR,ITEM,TMPLST
  1. S DIK="^GMPL(125.1,"
  1. I +DA'=DA D Q ; new link
  1. . Q:"@"[$G(^TMP("GMPLIST",$J,DA)) ; nothing to save
  1. . S TMPLST=^TMP("GMPLIST",$J,DA) D NEW(DIK,+GMPLSLST,TMPLST)
  1. I "@"[$G(^TMP("GMPLIST",$J,DA)) D ^DIK Q
  1. S ITEM=$P($G(^GMPL(125.1,DA,0)),U,2,5)
  1. I ITEM'=^TMP("GMPLIST",$J,DA) D
  1. . S DR="",DIE=DIK
  1. . F I=1,2,3,4 D
  1. .. S:$P(^TMP("GMPLIST",$J,DA),U,I)'=$P(ITEM,U,I) DR=DR_";"_I_"////"_$S($P(^TMP("GMPLIST",$J,DA),U,I)="":"@",1:$P(^TMP("GMPLIST",$J,DA),U,I))
  1. . S:$E(DR)=";" DR=$E(DR,2,999) D ^DIE
  1. Q
  1. ;
  1. NEW(DIK,LIST,ITEM) ; Create new entry in Contents file #125.1 or #125.12
  1. N I,HDR,LAST,TOTAL,DA
  1. S HDR=$G(@(DIK_"0)")),LAST=$P(HDR,U,3),TOTAL=$P(HDR,U,4)
  1. F I=(LAST+1):1 Q:'$D(@(DIK_"I,0)"))
  1. S DA=I,@(DIK_"DA,0)")=LIST_U_ITEM
  1. S $P(@(DIK_"0)"),U,3,4)=DA_U_(TOTAL+1)
  1. D IX1^DIK ; set Xrefs
  1. Q
  1. ;
  1. DELETE ; Delete problem group
  1. N DIR,X,Y,DA,DIK,IFN S VALMBCK=$S(VALMCC:"",1:"R")
  1. I $D(^GMPL(125.1,"G",+GMPLGRP)) W $C(7),!!,">>> This category belongs to at least one problem selection list!",!," CANNOT DELETE" H 2 Q
  1. S DIR(0)="YA",DIR("B")="NO",DIR("A")="Are you sure you want to delete the entire '"_$P(GMPLGRP,U,2)_"' category? "
  1. S DIR("?")="Enter YES to completely remove this category and all its items."
  1. D ^DIR Q:'Y
  1. DEL1 ; Ok, go for it ...
  1. W !!,"Deleting category items ..."
  1. F IFN=0:0 S IFN=$O(^GMPL(125.12,"B",+GMPLGRP,IFN)) Q:IFN'>0 S DA=IFN,DIK="^GMPL(125.12," D ^DIK W "."
  1. S DA=+GMPLGRP,DIK="^GMPL(125.11," D ^DIK W "."
  1. L -^GMPL(125.11,+GMPLGRP,0) S GMPLGRP=0 K GMPLSAVE W " <done>"
  1. D NEWGRP S:+GMPLGRP'>0 VALMBCK="Q"
  1. Q
  1. ;
  1. VALGRP(GMPLCAT) ; check all problems in the category for inactive codes
  1. ; Input:
  1. ; GMPLCAT = ien from file 125.11
  1. ;
  1. ; Output:
  1. ; 1 = category has no problems with inactive codes
  1. ; 0 = category has one or more problems with inactive codes
  1. ; O^ERR = category is invalid^error message
  1. ;
  1. I '$G(GMPLCAT) Q "0^No category selected"
  1. N PROB,GMPLVALC
  1. S GMPLVALC=1,PROB=0
  1. F S PROB=$O(^GMPL(125.12,"B",GMPLCAT,PROB)) Q:'PROB!('GMPLVALC) D
  1. . N GMPLCOD,GMI
  1. . S GMPLCOD=$P(^GMPL(125.12,PROB,0),U,5)
  1. . Q:'$L(GMPLCOD) ; no code there
  1. . F GMI=1:1:$L(GMPLCOD,"/") I '$$STATCHK^ICDAPIU($P(GMPLCOD,"/",GMI),DT) S GMPLVALC=0
  1. . Q
  1. Q GMPLVALC
  1. ;
  1. VALLIST(LIST) ;check all categories in list for probs w/ inactive codes
  1. ; Input:
  1. ; LIST = ien from file 125
  1. ;
  1. ; Output:
  1. ; 1 = list has no problems with inactive codes
  1. ; 0 = list has one or more problems with inactive codes
  1. ; O^ERR = list is invalid^error message
  1. ;
  1. N GMPLIEN,GMPLVAL
  1. I '$G(LIST) Q 0
  1. S GMPLIEN=0,GMPLVAL=1
  1. F S GMPLIEN=$O(^GMPL(125.1,"B",LIST,GMPLIEN)) Q:'GMPLIEN!('GMPLVAL) D
  1. . N GMPLCAT
  1. . S GMPLCAT=$P(^GMPL(125.1,GMPLIEN,0),U,3) I 'GMPLCAT Q
  1. . I '$$VALGRP(GMPLCAT) S GMPLVAL=0
  1. . Q
  1. Q GMPLVAL
  1. ;
  1. ASSIGN ; allow lookup of PROB SEL LIST and assign to users
  1. ;
  1. N DIC,X,Y,DUOUT,DTOUT,GMPLSLST
  1. S DIC="^GMPL(125,",DIC(0)="AEQMZ",DIC("A")="Select LIST NAME: "
  1. D ^DIC
  1. Q:$D(DTOUT)!($D(DUOUT))
  1. Q:Y<0
  1. I '$$VALLIST(+Y) D G ASSIGN
  1. . W !!,$C(7),"This Selection List contains problems with inactive ICD9 codes associated with"
  1. . W !,"them. The codes must be edited and corrected before the list can be assigned to",!,"users.",!!
  1. ;
  1. S GMPLSLST=+Y
  1. D USERS^GMPLBLD3("1")
  1. Q