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

APCDSTGC.m

Go to the documentation of this file.
  1. APCDSTGC ; IHS/CMI/LAB - LIST MANAGER API'S FOR FAMILY HISTORY AND API FOR REP FACTORS ;
  1. ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
  1. ;
  1. ;BJPC v1 patch 1
  1. INPUT ;EP - called from input transform on Stage field
  1. NEW A,T,C,H,L
  1. S C=$P($G(^AUPNVPOV(DA,0)),U)
  1. S A=0 F S A=$O(^APCDSTGC(A)) Q:A'=+A!('$D(X)) D
  1. .S T=$P(^APCDSTGC(A,0),U,2)
  1. .Q:T=""
  1. .Q:'$D(^ATXAX(T))
  1. .Q:'$$ICD^ATXAPI(C,T,9) ;not in this taxonomy
  1. .S L=$P(^APCDSTGC(A,0),U,3)
  1. .S H=$P(^APCDSTGC(A,0),U,4)
  1. .I X<L!(X>H) K X
  1. .Q
  1. Q
  1. ;
  1. HELP ;EP - Executable help from stage field of V POV
  1. NEW A,T,C,H,L,G
  1. S G=0
  1. S C=$P($G(^AUPNVPOV(DA,0)),U)
  1. S A=0 F S A=$O(^APCDSTGC(A)) Q:A'=+A!(G) D
  1. .S T=$P(^APCDSTGC(A,0),U,2)
  1. .Q:'$D(^ATXAX(T))
  1. .Q:'$$ICD^ATXAPI(C,T,9) ;not in this taxonomy
  1. .S G=1
  1. .S H=0 F S H=$O(^APCDSTGC(A,12,H)) Q:H'=+H D
  1. ..D EN^DDIOL($G(^APCDSTGC(A,12,H,0)))
  1. .Q
  1. Q
  1. ;
  1. EP(APCDDFN,APCDV,APCDI,APCDX) ;EP - called from xref on stage field of V POV
  1. ;APCDDFN=PATIENT DFN
  1. ;APCDV=VISIT IEN
  1. ;APCDX=VALUE
  1. ;APCDI=IEN OF V POV
  1. NEW APCDA,APCDC,APCDT,C
  1. S C=$P($G(^AUPNVPOV(APCDI,0)),U)
  1. Q:C=""
  1. S APCDA=0 F S APCDA=$O(^APCDSTGC(APCDA)) Q:APCDA'=+APCDA D
  1. .S APCDT=$P(^APCDSTGC(APCDA,0),U,2)
  1. .Q:'$D(^ATXAX(APCDT))
  1. .Q:'$$ICD^ATXAPI(C,APCDT,9)
  1. .I $G(^APCDSTGC(APCDA,13))]"" X ^APCDSTGC(APCDA,13)
  1. .Q
  1. Q
  1. ;
  1. ASTH ;EP
  1. D EN^XBNEW("ASTH1^APCDSTGC","APCDDFN;APCDV;APCDX;APCDI")
  1. Q
  1. ;
  1. ASTH1 ;EP - called from xbnew
  1. ;Add V Asthma Severity for this stage
  1. ;if V Asthma entry already exists on this day, overlay it
  1. ;if deleted, delete v astHma entry that matches
  1. ;
  1. ;first check to see if stage is blank, if it is find the V ASTHMA created by
  1. ;this pov and delete out the severity value, if there is no V ASTHMA then quit
  1. ;as there is nothing to delete
  1. I $P($G(^AUPNVPOV(APCDI,0)),U,5)="" D Q
  1. .S APCDB=0 F S APCDB=$O(^AUPNVAST("AD",APCDV,APCDB)) Q:APCDB'=+APCDB D
  1. ..Q:'$D(^AUPNVAST(APCDB,0)) ;bad xref
  1. ..Q:$P(^AUPNVAST(APCDB,0),U,13)'=APCDI ;not created by this pov so leave it alone
  1. ..S DA=APCDB,DIE="^AUPNVAST(",DR=".04///@" D ^DIE K DA,DR,DIE,DIU,DIV
  1. ..Q
  1. .Q
  1. ;
  1. ;now find V ASTHMA created by this V POV and edit it, if none exists, add it
  1. S APCDB=0,G=0 F S APCDB=$O(^AUPNVAST("AD",APCDV,APCDB)) Q:APCDB'=+APCDB!(G) D
  1. .Q:'$D(^AUPNVAST(APCDB,0)) ;bad xref
  1. .Q:$P(^AUPNVAST(APCDB,0),U,13)'=APCDI ;not this vpov
  1. .S DA=APCDB,DIE="^AUPNVAST(",DR=".04///"_APCDX D ^DIE K DA,DIE,DIU,DIV
  1. .S G=1
  1. I G Q ;found one, editted it, quit
  1. ;add v asthma entry
  1. ;
  1. ADDVAST ;
  1. K APCDALVR
  1. S APCDALVR("APCDATMP")="[APCDALVR 9000010.41 (ADD)]"
  1. S APCDALVR("APCDPAT")=APCDDFN
  1. S APCDALVR("APCDVSIT")=APCDV
  1. S APCDALVR("APCDTSEV")=APCDX
  1. S APCDALVR("APCDTPOV")="`"_APCDI
  1. D ^APCDALVR
  1. K APCDALVR
  1. ;if it fails, not much I can do but it shouldn't fail
  1. Q
  1. ;
  1. ASKSTG(C) ;EP - called from data entry input templates to determine whether stage should be prompted for this icd diagnosis
  1. ;C is ien of the icd9 entry
  1. I $G(C)="" Q 0
  1. NEW A,T,H
  1. S A=0,H=0 F S A=$O(^APCDSTGC(A)) Q:A'=+A!(H) D
  1. .S T=$P(^APCDSTGC(A,0),U,2)
  1. .Q:T=""
  1. .Q:'$D(^ATXAX(T))
  1. .Q:'$$ICD^ATXAPI(C,T,9) ;not in this taxonomy
  1. .S H=1
  1. .Q
  1. Q H