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

VENPCCG4.m

Go to the documentation of this file.
VENPCCG4 ; IHS/OIT/GIS - EXPORT ICD PREFERENCES FROM EXCEL BACK TO THE USER PREFERENCE FILES ;
 ;;2.6;PCC+;;NOV 12, 2007
 ;
 ;
 ;
IMP ; IMPORT CODES FROM A STD ICD TXT FILE
 NEW I,X,Y,TMP,DIC,DIE,DA,DR,ICD,TXT,TEXT,IIEN,TYPE,POP,STG,NUM,FILE,TAB,CLASS,FREQ,PRV,STOP,CFIGIEN,PATH,TIEN,DLAYGO
 S CFIGIEN=$$CFG^VENPCCU I 'CFIGIEN Q
 S PATH=$G(^VEN(7.5,CFIGIEN,12)) I '$L(PATH) Q
 S TMP="^TMP(""VEN SAVE"",$J)" K @TMP
 S (DIC,DIE)="^VEN(7.1,",DIC(0)="L",FILE="ILC_ICD2.TXT",TAB=$C(9),DLAYGO=19707.1
 D OPEN^%ZISH("",PATH,FILE,"R")
 I POP=1 S FILE="ilc_icd2.txt" D OPEN^%ZISH("",PATH,FILE,"R")
 I POP=1 S FILE="ILC_ICD2.txt" D OPEN^%ZISH("",PATH,FILE,"R")
 I POP=1 S STOP=1 W !!,"Unable to locate the preferences file!  Request terminated...",!! Q
 F NUM=1:1 R X:30 Q:$$STATUS^%ZISH  S @TMP@(NUM)=X
 D CLOSE^%ZISH("")
SET ;
 S PRV=$$PRV I 'PRV W !,"You must specify a provider!  Request terminated..." Q
 N PGRP,STOP,PFLAG,%
 F NUM=1:1 S STG=$G(@TMP@(NUM)) Q:$G(STOP)  Q:STG=""  D  I 'CLASS W !,"UNKNOWN CLASS TYPE: ",TYPE Q
 . S %=$E(STG,1,4) I %?1"***"1A S TYPE=$P(STG,"*",4),CLASS=$$CLASS(TYPE) Q
 . S ICD=$P(STG,TAB,1),TXT=$P(STG,TAB,2),FREQ=+$P(STG,TAB,4)
 . S X="""`"_PRV_""""
 . S @TMP@("FREQ",CLASS,FREQ,NUM)=X_U_ICD_U_TXT
 . Q
UPDATE ; 
 S CLASS=0
 F  S CLASS=$O(@TMP@("FREQ",CLASS)) Q:'CLASS  S (TOT,STOP)=0,FREQ=9999999 F  Q:STOP  S FREQ=$O(@TMP@("FREQ",CLASS,FREQ),-1) Q:FREQ=""  S NUM=0 F  S NUM=$O(@TMP@("FREQ",CLASS,FREQ,NUM)) Q:'NUM  D  I STOP Q
 . S TOT=TOT+1 I TOT>60 S STOP=1 Q
 . S STG=@TMP@("FREQ",CLASS,FREQ,NUM)
 . S X=$P(STG,U,1),IIEN=$P(STG,U,2),TXT=$P(STG,U,3),TXT=$TR(TXT,$C(34),"")
 . S Y=$$CK(PRV,IIEN,CLASS,TXT)
 . I 'Y D ^DIC I Y=-1 Q
 . S DA=+Y,DR=".02////"_IIEN_";.03////^S X=TXT;.04////"_CLASS
 . L +^VEN(7.1):0 I $T D ^DIE L -^VEN(7.1)
 . Q
 K @TMP
 Q
 ; 
CK(PRV,IIEN,CLASS,TXT) ; CK FOR OLD ENTRY
 N OK,IEN,PIEN,TYPE
 S (OK,IEN)=0
 F  S IEN=$O(^VEN(7.1,"AC",IIEN,IEN)) Q:'IEN  D  I OK Q
 . S PIEN=$P($G(^VEN(7.1,IEN,0)),U,1) I PIEN'=PRV Q
 . S TYPE=$P($G(^VEN(7.1,IEN,0)),U,4) I TYPE'=CLASS Q
 . S TEXT=$P($G(^VEN(7.1,IEN,0)),U,3) I TEXT'=TXT Q
 . S OK=IEN
 . Q
 Q OK
 ; 
PRV() ;
 N DIC,X,Y
 S DIC("A")="Assign these preferences to which provider: "
 S DIC="^VA(200,",DIC(0)="AEQ"
 D ^DIC I Y=-1 Q 0
 Q +Y
 ;
CLASS(X) ;
 I '$L(X) Q ""
 S X=$S(X="INFANT":1,X="PEDIATRIC":2,X="ADOLESCENT MALE":3,X="ADOLESCENT FEMALE":4,X="ADULT MALE":5,X="ADULT FEMALE":6,X="SENIOR MALE":7,X="SENIOR FEMALE":8,1:"")
 Q X
 ;