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