VENPCCKG ; IHS/OIT/GIS - KNOWLEDGEBASE RPCS FOR GUI EDITOR ;
;;2.6;PCC+;**1,3**;APR 03, 2012;Build 24
;
;
;
;
PRVLKUP(OUT,IN) ; EP - RPC: VEN WCM LIST PROVIDERS
S OUT="BMX ADO SS^VEN WCM LIST PROVIDERS^^~~~~~APRV~BMXADOV2"
Q
;
PTED(OUT,IN) ; EP - RPC: VEN KB EDIT PT ED TOPICS
; INCLUDES BOTH AG AND NUTRITION TOPICS
S OUT=$$CKKEY I $L(OUT) Q
S OUT="BMX ADO SS^VEN KB PT ED ITEMS^^AC~CH~CHZ~9999~~"
Q
;
DEV(OUT,IN) ; EP - RPC: VEN KB EDIT DEV ITEMS
S OUT=$$CKKEY I $L(OUT) Q
S OUT="BMX ADO SS^VEN KB PT ED ITEMS^^B~34~37~9999"
Q
;
EXAM(OUT,IN) ; EP - RPC: VEN KB EDIT EXAM ITEMS
S OUT=$$CKKEY I $L(OUT) Q
S OUT="BMX ADO SS^VEN KB PT ED ITEMS^^B~27~30~9999"
Q
;
AUT(OUT,IN) ; EP - RPC: VEN KB EDIT AUTISM SCREENING ITEMS
S OUT=$$CKKEY I $L(OUT) Q
S OUT="BMX ADO SS^VEN KB PT ED ITEMS^^B~9~9~9999"
Q
;
CKKEY() ; EP - KEY CHECK
I '$G(DUZ) Q ""
I $D(^XUSEC("VENZKBEDIT",DUZ)) Q ""
Q "You do not hold the required VENZKBEDIT key. Request denied..."
;
TXPOP ; ---------------------------------------
;
WCPEP(OUT,IN) ; EP - RPC: VEN WCM PT ED TX POP
; WELL CHILD PATIENT ED - GIVEN A VISIT IEN, POPULATE THE TRANSACTION FILE
; OUT = TX TABLE GEN STRING
N VIEN
S VIEN=+$G(IN)
I '$D(^AUPNVSIT(VIEN,0)) S OUT="" Q
S IN=VIEN_"|1"
D PEPOP^VENPCCKT(IN)
Q
;
WCNP(OUT,IN) ; EP - RPC: VEN WCM NUTRITION TX POP
; WELL CHILD PATIENT ED - GIVEN A VISIT IEN, POPULATE THE TRANSACTION FILE
; OUT = TX TABLE GEN STRING
N VIEN
S VIEN=+$G(IN)
I '$D(^AUPNVSIT(VIEN,0)) S OUT="" Q
S IN=VIEN_"|6"
D PEPOP^VENPCCKT(IN)
Q
;
WCEXP(OUT,IN) ; EP - RPC: VEN WCM EXAM TX POP
; WELL CHILD EXAMS - GIVEN A VISIT IEN, POPULATE THE TRANSACTION FILE
; OUT = TX TABLE GEN STRING
N VIEN
S VIEN=+$G(IN)
I '$D(^AUPNVSIT(VIEN,0)) S OUT="" Q
S IN=IN_"|3"
D EXPOP^VENPCCKT(IN)
Q
;
WCDBP(OUT,IN) ; EP - RPC: VEN WCM DEV BENCHMARKS TX POP
; WELL CHILD DEVEL BENCHMARKS - GIVEN A VISIT IEN, POPULATE THE TRANSACTION FILE
; OUT = TX TABLE GEN STRING
N VIEN
S VIEN=+$G(IN)
I '$D(^AUPNVSIT(VIEN,0)) S OUT="" Q
S IN=VIEN_"|2"
D POP^VENPCCKD(IN)
Q
;
WCDCP(OUT,IN) ; EP - RPC: VEN WCM DEV COMMENTS TX POP
; WELL CHILD DEVEL COMMENTS - GIVEN A VISIT IEN, POPULATE THE TRANSACTION FILE
; OUT = TX TABLE GEN STRING
N VIEN
S VIEN=+$G(IN)
I '$D(^AUPNVSIT(VIEN,0)) S OUT="" Q
S IN=VIEN_"|9"
D POP^VENPCCKD(IN)
Q
;
TXFLUSH ; --------------------------------------
;
WCPEF(OUT,IN) ; EP - RPC: VEN WCM PT ED TX FLUSH
; FLUSH THE PT ED TOPICS FROM TX FILE TO V FILES
; IN = VISIT IEN|LOU|TIME|EDUCATOR IEN
I '$L($G(IN)) S OUT="" Q
S IN="1|"_IN
D PEFLUSH^VENPCCKT(IN)
Q
;
WCNF(OUT,IN) ; EP - RPC: VEN WCM NUTRITION TX FLUSH
; FLUSH THE NUTRITION TOPICS FROM TX FILE TO V FILES
; IN = VISIT IEN|LOU|TIME|EDUCATOR IEN|INFANT FEEDING CHOICE
I '$L($G(IN)) S OUT="" Q
S IN="6|"_IN
D PEFLUSH^VENPCCKT(IN)
Q
;
WCEXF(OUT,IN) ; EP - RPC: VEN WCM EXAM TX FLUSH
; FLUSH EXAM RESULTS FROM TX FILE TO V FILES
S OUT=""
I '$D(^AUPNVSIT(+$D(IN),0)) Q
D EXFLUSH^VENPCCKT(IN)
Q
;
WCDF(OUT,IN) ; EP - RPC: VEN WCM DEVEL TX FLUSH
; FLUSH DEVEL COMMENTS FROM TX FILE TO V FILES
S OUT=""
I '$D(^AUPNVSIT(+$D(IN),0)) Q
D FLUSH^VENPCCKD(IN)
Q
;
; ----------------------------------------
;
PETODAY(OUT,IN) ; EP - RPC: VEN WCM PTED TODAY
; IN = DFN, OUT = VISIT IEN|PROVIDER NAME|PROVIDER IEN|LOU|TIME
N DFN
S DFN=+$G(IN)
I '$D(^DPT(DFN,0)) S OUT="" Q
D TODAY^VENPCCKT(DFN,"P")
Q
;
NTODAY(OUT,IN) ; EP - RPC: VEN WCM NUTR TODAY
; IN = DFN, OUT = VISIT IEN|PROVIDER NAME|PROVIDER IEN|LOU|TIME|INFANT FEEDING CHOICE
N DFN
S DFN=+$G(IN)
I '$D(^DPT(DFN,0)) S OUT="" Q
D TODAY^VENPCCKT(DFN,"N")
Q
;
GG(OUT,IN) ; EP - RPC: VEN WCM GG POP ; RETURN THE GROWTH GRID DATA STRING
N ICIEN,GCIEN,CIEN,EIEN,MM,PCE,HIEN,HDR,TAG,VAL,X,DFN,Z,%
S DFN=+$G(IN) I '$D(^DPT(DFN,0)) Q
S OUT=""
S ICIEN=$O(^VEN(7.62,"B","PEDS GROWTH CHART",0)) I 'ICIEN Q
S GCIEN=$O(^VEN(7.62,"B","IMMUNIZATION REPORT",0)) I 'GCIEN Q
F CIEN=ICIEN,GCIEN S EIEN=0 F S EIEN=$O(^VEN(7.62,CIEN,3,"B",EIEN)) Q:'EIEN D
. S TAG=$G(^VEN(7.61,EIEN,1)) I '$L(TAG) Q
. S X=$G(^VEN(7.61,EIEN,0)) I X="" Q
. S HIEN=$P(X,U,2) I 'HIEN Q
. S PCE=$P(X,U,3) I 'PCE Q
. S HDR=$P($G(^VEN(7.42,HIEN,0)),U) I HDR="" Q
. X ("S VAL=$$"_TAG_"(DFN)")
. S X=$G(Z)
. S $P(X,"\",PCE)=VAL
. S Z=X
. Q
S OUT=$G(Z)
S X="BI" F S X=$O(@X) Q:$E(X,1,2)'="BI" K @X ; CLEANUP BI VARIABLES
Q
;
TV(OUT,IN) ; EP - RPC: VEN GEN TEST WCM VISIT AND RETURN PATIENT DFN|VISIT IEN
; GIVEN A CHART NUMBER, GENERATE A TEST VISIT FOR TODAY
; IN = HRN OR HRN;1 ; IF HRN;1 THEN THE V PATIENT ED AND V WELL CHILD FILES WILL BE POPULATED AS WELL
N AUPNPAT,VIEN,CSIEN,CLIEN,PRV,PRVIEN,CL,X,Y,Z,DIC,DIE,DA,DR,%,GBL,NIEN,PFLAG
S OUT=""
I $P($G(IN),";",2) S PFLAG=1,IN=+IN
S AUPNPAT=$$CHART^VENPCCU(+$G(IN),+$G(DUZ(2))) I '$D(^DPT(+AUPNPAT,0)) Q
S X=+$O(^AUPNVSIT("AA",AUPNPAT,0))
I (9999999-X)=(DT_".08") D I $L(OUT) G TVPOV ; VISIT ALREADY EXISTS
. S VIEN=+$O(^AUPNVSIT("AA",AUPNPAT,X,0))
. I $D(^AUPNVSIT(VIEN,0)) S OUT=AUPNPAT_"|"_VIEN
. Q
S CSIEN=$O(^DIC(40.7,"C","01",0)) I 'CSIEN Q ; CLINIC STOP
S VIEN=$$VISIT^VENPCC3(AUPNPAT,(DT_".08"),DUZ(2),CSIEN) I 'VIEN Q
S OUT=AUPNPAT_"|"_VIEN ; AT THIS POINT A VALID VISIT STUB HAS BEEN CREATED
; ADD A V POV AND V PRV ENTRY TO MAKE IT "OFFICIAL"
TVPOV S DIC="^AUTNPOV(",DIC(0)="L",DLAYGO=9999999.27,X="WELL CHILD EXAM"
D ^DIC I Y=-1 G TVPRV
S NIEN=+Y ; GET IEN FOR 'WELL CHILD EXAM' PROVIDER NARRATIVE
S X=$$ICD^VENPCCU("V20.2") I 'X G TVX ; GET THE ICD9
S DIC="^AUPNVPOV(",DIC(0)="L",X="""`"_X_"""",DLAYGO=9000010.07
D ^DIC I Y=-1 G TVPRV
S DA=+Y,DIE=DIC,DR=".02////^S X=AUPNPAT;.03////^S X=VIEN;.04////^S X=NIEN;.12////P"
L +^AUPNVPOV(DA):1 I D ^DIE L -^AUPNVPOV(DA)
TVPRV S GBL="^VA(200)"
I $P($G(^DD(9000010.06,.01,0)),U,2)[6 S GBL=U_$C(68)_"IC(16)"
S PRV=$O(@GBL@("B","SHORR,GR"))
I '$L(PRV) G TVX
S PRVIEN=$O(@GBL@("B",PRV,0))
I 'PRVIEN G TVX
S DIC="^AUPNVPRV(",DIC(0)="L",X="""`"_PRVIEN_"""",DLAYGO=9000010.06
D ^DIC I Y=-1 G TVX
S DA=+Y,DIE=DIC,DR=".02////^S X=AUPNPAT;.03////^S X=VIEN;.04////P"
L +^AUPNVPOV(DA):1 I D ^DIE L -^AUPNVPOV(DA)
I '$G(PFLAG) G TVX ; PT ED ENTRIIES NOT REQUIRED
TVPED S PRVIEN=$O(^VA(200,"B",PRV,0)) I 'PRVIEN Q
S NTIEN=$O(^AUTTEDT("B","CHT-NUTRITION",999999),-1) I 'NTIEN G TVX
S ETIEN=$O(^AUTTEDT("B","CHT-PARENTING",999999),-1) I 'ETIEN G TVX
S DIC="^AUPNVPED(",DIC(0)="L",X="""`"_NTIEN_""""
D ^DIC I Y=-1 Q
S DA=+Y,DIE=DIC,DR=".02////^S X=AUPNPAT;.03////^S X=VIEN;.05////^S X=PRVIEN;.06////^S X=2;.08////^S X=22"
L +^AUPNVPOV(DA):1 I D ^DIE L -^AUPNVPOV(DA)
S ^AUPNVPED(DA,1,0)="^9000010.161^2^2"
S ^AUPNVPED(DA,1,1,0)="Offer variety of health foods"
S ^AUPNVPED(DA,1,"B","Offer variety of health foods",1)=""
S ^AUPNVPED(DA,1,2,0)="Do not force eating"
S ^AUPNVPED(DA,1,"B","Do not force eating",2)=""
S DIC="^AUPNVPED(",DIC(0)="L",X="""`"_ETIEN_""""
D ^DIC I Y=-1 Q
S DA=+Y,DIE=DIC,DR=".02////^S X=AUPNPAT;.03////^S X=VIEN;.05////^S X=PRVIEN;.06////^S X=3;.08////^S X=33"
L +^AUPNVPED(DA):1 I D ^DIE L -^AUPNVPED(DA)
S ^AUPNVPED(DA,1,0)="^9000010.161^2^2"
S ^AUPNVPED(DA,1,1,0)="Read books together 30 minutes a day"
S ^AUPNVPED(DA,1,"B","Read books together 30 minutes",1)=""
S ^AUPNVPED(DA,1,2,0)="Do not expect child to share all toys"
S ^AUPNVPED(DA,1,"B","Do not expect child to share a",2)=""
TVWC S DIC="^AUPNVWC(",DIC(0)="L",X=""""_0_""""
D ^DIC I Y=-1 Q
S DA=+Y,DIE=DIC,DR=".02////^S X=AUPNPAT;.03////^S X=VIEN;.04////^S X=PRVIEN;.06////^S X=3;.05////^S X=33"
S DR=DR_";.09////^S X=PRVIEN;.08////^S X=2;.07////^S X=22"
L +^AUPNVWC(DA):1 I D ^DIE L -^AUPNVWC(DA)
S ^AUPNVWC(DA,1,0)="^9000010.461^2^2"
S ^AUPNVWC(DA,1,1,0)="Read books together 30 minutes a day"
S ^AUPNVWC(DA,1,"B","Read books together 30 minutes",1)=""
S ^AUPNVWC(DA,1,2,0)="Do not expect child to share all toys"
S ^AUPNVWC(DA,1,"B","Do not expect child to share a",2)=""
S ^AUPNVWC(DA,1,0)="^9000010.465^2^2"
S ^AUPNVWC(DA,5,1,0)="Offer variety of health foods"
S ^AUPNVWC(DA,1,"B","Offer variety of health foods",1)=""
S ^AUPNVWC(DA,5,2,0)="Do not force eating"
S ^AUPNVWC(DA,1,"B","Do not force eating",2)=""
TVX D ^XBFMK
Q
;
VENPCCKG ; IHS/OIT/GIS - KNOWLEDGEBASE RPCS FOR GUI EDITOR ;
+1 ;;2.6;PCC+;**1,3**;APR 03, 2012;Build 24
+2 ;
+3 ;
+4 ;
+5 ;
PRVLKUP(OUT,IN) ; EP - RPC: VEN WCM LIST PROVIDERS
+1 SET OUT="BMX ADO SS^VEN WCM LIST PROVIDERS^^~~~~~APRV~BMXADOV2"
+2 QUIT
+3 ;
PTED(OUT,IN) ; EP - RPC: VEN KB EDIT PT ED TOPICS
+1 ; INCLUDES BOTH AG AND NUTRITION TOPICS
+2 SET OUT=$$CKKEY
IF $LENGTH(OUT)
QUIT
+3 SET OUT="BMX ADO SS^VEN KB PT ED ITEMS^^AC~CH~CHZ~9999~~"
+4 QUIT
+5 ;
DEV(OUT,IN) ; EP - RPC: VEN KB EDIT DEV ITEMS
+1 SET OUT=$$CKKEY
IF $LENGTH(OUT)
QUIT
+2 SET OUT="BMX ADO SS^VEN KB PT ED ITEMS^^B~34~37~9999"
+3 QUIT
+4 ;
EXAM(OUT,IN) ; EP - RPC: VEN KB EDIT EXAM ITEMS
+1 SET OUT=$$CKKEY
IF $LENGTH(OUT)
QUIT
+2 SET OUT="BMX ADO SS^VEN KB PT ED ITEMS^^B~27~30~9999"
+3 QUIT
+4 ;
AUT(OUT,IN) ; EP - RPC: VEN KB EDIT AUTISM SCREENING ITEMS
+1 SET OUT=$$CKKEY
IF $LENGTH(OUT)
QUIT
+2 SET OUT="BMX ADO SS^VEN KB PT ED ITEMS^^B~9~9~9999"
+3 QUIT
+4 ;
CKKEY() ; EP - KEY CHECK
+1 IF '$GET(DUZ)
QUIT ""
+2 IF $DATA(^XUSEC("VENZKBEDIT",DUZ))
QUIT ""
+3 QUIT "You do not hold the required VENZKBEDIT key. Request denied..."
+4 ;
TXPOP ; ---------------------------------------
+1 ;
WCPEP(OUT,IN) ; EP - RPC: VEN WCM PT ED TX POP
+1 ; WELL CHILD PATIENT ED - GIVEN A VISIT IEN, POPULATE THE TRANSACTION FILE
+2 ; OUT = TX TABLE GEN STRING
+3 NEW VIEN
+4 SET VIEN=+$GET(IN)
+5 IF '$DATA(^AUPNVSIT(VIEN,0))
SET OUT=""
QUIT
+6 SET IN=VIEN_"|1"
+7 DO PEPOP^VENPCCKT(IN)
+8 QUIT
+9 ;
WCNP(OUT,IN) ; EP - RPC: VEN WCM NUTRITION TX POP
+1 ; WELL CHILD PATIENT ED - GIVEN A VISIT IEN, POPULATE THE TRANSACTION FILE
+2 ; OUT = TX TABLE GEN STRING
+3 NEW VIEN
+4 SET VIEN=+$GET(IN)
+5 IF '$DATA(^AUPNVSIT(VIEN,0))
SET OUT=""
QUIT
+6 SET IN=VIEN_"|6"
+7 DO PEPOP^VENPCCKT(IN)
+8 QUIT
+9 ;
WCEXP(OUT,IN) ; EP - RPC: VEN WCM EXAM TX POP
+1 ; WELL CHILD EXAMS - GIVEN A VISIT IEN, POPULATE THE TRANSACTION FILE
+2 ; OUT = TX TABLE GEN STRING
+3 NEW VIEN
+4 SET VIEN=+$GET(IN)
+5 IF '$DATA(^AUPNVSIT(VIEN,0))
SET OUT=""
QUIT
+6 SET IN=IN_"|3"
+7 DO EXPOP^VENPCCKT(IN)
+8 QUIT
+9 ;
WCDBP(OUT,IN) ; EP - RPC: VEN WCM DEV BENCHMARKS TX POP
+1 ; WELL CHILD DEVEL BENCHMARKS - GIVEN A VISIT IEN, POPULATE THE TRANSACTION FILE
+2 ; OUT = TX TABLE GEN STRING
+3 NEW VIEN
+4 SET VIEN=+$GET(IN)
+5 IF '$DATA(^AUPNVSIT(VIEN,0))
SET OUT=""
QUIT
+6 SET IN=VIEN_"|2"
+7 DO POP^VENPCCKD(IN)
+8 QUIT
+9 ;
WCDCP(OUT,IN) ; EP - RPC: VEN WCM DEV COMMENTS TX POP
+1 ; WELL CHILD DEVEL COMMENTS - GIVEN A VISIT IEN, POPULATE THE TRANSACTION FILE
+2 ; OUT = TX TABLE GEN STRING
+3 NEW VIEN
+4 SET VIEN=+$GET(IN)
+5 IF '$DATA(^AUPNVSIT(VIEN,0))
SET OUT=""
QUIT
+6 SET IN=VIEN_"|9"
+7 DO POP^VENPCCKD(IN)
+8 QUIT
+9 ;
TXFLUSH ; --------------------------------------
+1 ;
WCPEF(OUT,IN) ; EP - RPC: VEN WCM PT ED TX FLUSH
+1 ; FLUSH THE PT ED TOPICS FROM TX FILE TO V FILES
+2 ; IN = VISIT IEN|LOU|TIME|EDUCATOR IEN
+3 IF '$LENGTH($GET(IN))
SET OUT=""
QUIT
+4 SET IN="1|"_IN
+5 DO PEFLUSH^VENPCCKT(IN)
+6 QUIT
+7 ;
WCNF(OUT,IN) ; EP - RPC: VEN WCM NUTRITION TX FLUSH
+1 ; FLUSH THE NUTRITION TOPICS FROM TX FILE TO V FILES
+2 ; IN = VISIT IEN|LOU|TIME|EDUCATOR IEN|INFANT FEEDING CHOICE
+3 IF '$LENGTH($GET(IN))
SET OUT=""
QUIT
+4 SET IN="6|"_IN
+5 DO PEFLUSH^VENPCCKT(IN)
+6 QUIT
+7 ;
WCEXF(OUT,IN) ; EP - RPC: VEN WCM EXAM TX FLUSH
+1 ; FLUSH EXAM RESULTS FROM TX FILE TO V FILES
+2 SET OUT=""
+3 IF '$DATA(^AUPNVSIT(+$DATA(IN),0))
QUIT
+4 DO EXFLUSH^VENPCCKT(IN)
+5 QUIT
+6 ;
WCDF(OUT,IN) ; EP - RPC: VEN WCM DEVEL TX FLUSH
+1 ; FLUSH DEVEL COMMENTS FROM TX FILE TO V FILES
+2 SET OUT=""
+3 IF '$DATA(^AUPNVSIT(+$DATA(IN),0))
QUIT
+4 DO FLUSH^VENPCCKD(IN)
+5 QUIT
+6 ;
+7 ; ----------------------------------------
+8 ;
PETODAY(OUT,IN) ; EP - RPC: VEN WCM PTED TODAY
+1 ; IN = DFN, OUT = VISIT IEN|PROVIDER NAME|PROVIDER IEN|LOU|TIME
+2 NEW DFN
+3 SET DFN=+$GET(IN)
+4 IF '$DATA(^DPT(DFN,0))
SET OUT=""
QUIT
+5 DO TODAY^VENPCCKT(DFN,"P")
+6 QUIT
+7 ;
NTODAY(OUT,IN) ; EP - RPC: VEN WCM NUTR TODAY
+1 ; IN = DFN, OUT = VISIT IEN|PROVIDER NAME|PROVIDER IEN|LOU|TIME|INFANT FEEDING CHOICE
+2 NEW DFN
+3 SET DFN=+$GET(IN)
+4 IF '$DATA(^DPT(DFN,0))
SET OUT=""
QUIT
+5 DO TODAY^VENPCCKT(DFN,"N")
+6 QUIT
+7 ;
GG(OUT,IN) ; EP - RPC: VEN WCM GG POP ; RETURN THE GROWTH GRID DATA STRING
+1 NEW ICIEN,GCIEN,CIEN,EIEN,MM,PCE,HIEN,HDR,TAG,VAL,X,DFN,Z,%
+2 SET DFN=+$GET(IN)
IF '$DATA(^DPT(DFN,0))
QUIT
+3 SET OUT=""
+4 SET ICIEN=$ORDER(^VEN(7.62,"B","PEDS GROWTH CHART",0))
IF 'ICIEN
QUIT
+5 SET GCIEN=$ORDER(^VEN(7.62,"B","IMMUNIZATION REPORT",0))
IF 'GCIEN
QUIT
+6 FOR CIEN=ICIEN,GCIEN
SET EIEN=0
FOR
SET EIEN=$ORDER(^VEN(7.62,CIEN,3,"B",EIEN))
IF 'EIEN
QUIT
Begin DoDot:1
+7 SET TAG=$GET(^VEN(7.61,EIEN,1))
IF '$LENGTH(TAG)
QUIT
+8 SET X=$GET(^VEN(7.61,EIEN,0))
IF X=""
QUIT
+9 SET HIEN=$PIECE(X,U,2)
IF 'HIEN
QUIT
+10 SET PCE=$PIECE(X,U,3)
IF 'PCE
QUIT
+11 SET HDR=$PIECE($GET(^VEN(7.42,HIEN,0)),U)
IF HDR=""
QUIT
+12 XECUTE ("S VAL=$$"_TAG_"(DFN)")
+13 SET X=$GET(Z)
+14 SET $PIECE(X,"\",PCE)=VAL
+15 SET Z=X
+16 QUIT
End DoDot:1
+17 SET OUT=$GET(Z)
+18 ; CLEANUP BI VARIABLES
SET X="BI"
FOR
SET X=$ORDER(@X)
IF $EXTRACT(X,1,2)'="BI"
QUIT
KILL @X
+19 QUIT
+20 ;
TV(OUT,IN) ; EP - RPC: VEN GEN TEST WCM VISIT AND RETURN PATIENT DFN|VISIT IEN
+1 ; GIVEN A CHART NUMBER, GENERATE A TEST VISIT FOR TODAY
+2 ; IN = HRN OR HRN;1 ; IF HRN;1 THEN THE V PATIENT ED AND V WELL CHILD FILES WILL BE POPULATED AS WELL
+3 NEW AUPNPAT,VIEN,CSIEN,CLIEN,PRV,PRVIEN,CL,X,Y,Z,DIC,DIE,DA,DR,%,GBL,NIEN,PFLAG
+4 SET OUT=""
+5 IF $PIECE($GET(IN),";",2)
SET PFLAG=1
SET IN=+IN
+6 SET AUPNPAT=$$CHART^VENPCCU(+$GET(IN),+$GET(DUZ(2)))
IF '$DATA(^DPT(+AUPNPAT,0))
QUIT
+7 SET X=+$ORDER(^AUPNVSIT("AA",AUPNPAT,0))
+8 ; VISIT ALREADY EXISTS
IF (9999999-X)=(DT_".08")
Begin DoDot:1
+9 SET VIEN=+$ORDER(^AUPNVSIT("AA",AUPNPAT,X,0))
+10 IF $DATA(^AUPNVSIT(VIEN,0))
SET OUT=AUPNPAT_"|"_VIEN
+11 QUIT
End DoDot:1
IF $LENGTH(OUT)
GOTO TVPOV
+12 ; CLINIC STOP
SET CSIEN=$ORDER(^DIC(40.7,"C","01",0))
IF 'CSIEN
QUIT
+13 SET VIEN=$$VISIT^VENPCC3(AUPNPAT,(DT_".08"),DUZ(2),CSIEN)
IF 'VIEN
QUIT
+14 ; AT THIS POINT A VALID VISIT STUB HAS BEEN CREATED
SET OUT=AUPNPAT_"|"_VIEN
+15 ; ADD A V POV AND V PRV ENTRY TO MAKE IT "OFFICIAL"
TVPOV SET DIC="^AUTNPOV("
SET DIC(0)="L"
SET DLAYGO=9999999.27
SET X="WELL CHILD EXAM"
+1 DO ^DIC
IF Y=-1
GOTO TVPRV
+2 ; GET IEN FOR 'WELL CHILD EXAM' PROVIDER NARRATIVE
SET NIEN=+Y
+3 ; GET THE ICD9
SET X=$$ICD^VENPCCU("V20.2")
IF 'X
GOTO TVX
+4 SET DIC="^AUPNVPOV("
SET DIC(0)="L"
SET X="""`"_X_""""
SET DLAYGO=9000010.07
+5 DO ^DIC
IF Y=-1
GOTO TVPRV
+6 SET DA=+Y
SET DIE=DIC
SET DR=".02////^S X=AUPNPAT;.03////^S X=VIEN;.04////^S X=NIEN;.12////P"
+7 LOCK +^AUPNVPOV(DA):1
IF $TEST
DO ^DIE
LOCK -^AUPNVPOV(DA)
TVPRV SET GBL="^VA(200)"
+1 IF $PIECE($GET(^DD(9000010.06,.01,0)),U,2)[6
SET GBL=U_$CHAR(68)_"IC(16)"
+2 SET PRV=$ORDER(@GBL@("B","SHORR,GR"))
+3 IF '$LENGTH(PRV)
GOTO TVX
+4 SET PRVIEN=$ORDER(@GBL@("B",PRV,0))
+5 IF 'PRVIEN
GOTO TVX
+6 SET DIC="^AUPNVPRV("
SET DIC(0)="L"
SET X="""`"_PRVIEN_""""
SET DLAYGO=9000010.06
+7 DO ^DIC
IF Y=-1
GOTO TVX
+8 SET DA=+Y
SET DIE=DIC
SET DR=".02////^S X=AUPNPAT;.03////^S X=VIEN;.04////P"
+9 LOCK +^AUPNVPOV(DA):1
IF $TEST
DO ^DIE
LOCK -^AUPNVPOV(DA)
+10 ; PT ED ENTRIIES NOT REQUIRED
IF '$GET(PFLAG)
GOTO TVX
TVPED SET PRVIEN=$ORDER(^VA(200,"B",PRV,0))
IF 'PRVIEN
QUIT
+1 SET NTIEN=$ORDER(^AUTTEDT("B","CHT-NUTRITION",999999),-1)
IF 'NTIEN
GOTO TVX
+2 SET ETIEN=$ORDER(^AUTTEDT("B","CHT-PARENTING",999999),-1)
IF 'ETIEN
GOTO TVX
+3 SET DIC="^AUPNVPED("
SET DIC(0)="L"
SET X="""`"_NTIEN_""""
+4 DO ^DIC
IF Y=-1
QUIT
+5 SET DA=+Y
SET DIE=DIC
SET DR=".02////^S X=AUPNPAT;.03////^S X=VIEN;.05////^S X=PRVIEN;.06////^S X=2;.08////^S X=22"
+6 LOCK +^AUPNVPOV(DA):1
IF $TEST
DO ^DIE
LOCK -^AUPNVPOV(DA)
+7 SET ^AUPNVPED(DA,1,0)="^9000010.161^2^2"
+8 SET ^AUPNVPED(DA,1,1,0)="Offer variety of health foods"
+9 SET ^AUPNVPED(DA,1,"B","Offer variety of health foods",1)=""
+10 SET ^AUPNVPED(DA,1,2,0)="Do not force eating"
+11 SET ^AUPNVPED(DA,1,"B","Do not force eating",2)=""
+12 SET DIC="^AUPNVPED("
SET DIC(0)="L"
SET X="""`"_ETIEN_""""
+13 DO ^DIC
IF Y=-1
QUIT
+14 SET DA=+Y
SET DIE=DIC
SET DR=".02////^S X=AUPNPAT;.03////^S X=VIEN;.05////^S X=PRVIEN;.06////^S X=3;.08////^S X=33"
+15 LOCK +^AUPNVPED(DA):1
IF $TEST
DO ^DIE
LOCK -^AUPNVPED(DA)
+16 SET ^AUPNVPED(DA,1,0)="^9000010.161^2^2"
+17 SET ^AUPNVPED(DA,1,1,0)="Read books together 30 minutes a day"
+18 SET ^AUPNVPED(DA,1,"B","Read books together 30 minutes",1)=""
+19 SET ^AUPNVPED(DA,1,2,0)="Do not expect child to share all toys"
+20 SET ^AUPNVPED(DA,1,"B","Do not expect child to share a",2)=""
TVWC SET DIC="^AUPNVWC("
SET DIC(0)="L"
SET X=""""_0_""""
+1 DO ^DIC
IF Y=-1
QUIT
+2 SET DA=+Y
SET DIE=DIC
SET DR=".02////^S X=AUPNPAT;.03////^S X=VIEN;.04////^S X=PRVIEN;.06////^S X=3;.05////^S X=33"
+3 SET DR=DR_";.09////^S X=PRVIEN;.08////^S X=2;.07////^S X=22"
+4 LOCK +^AUPNVWC(DA):1
IF $TEST
DO ^DIE
LOCK -^AUPNVWC(DA)
+5 SET ^AUPNVWC(DA,1,0)="^9000010.461^2^2"
+6 SET ^AUPNVWC(DA,1,1,0)="Read books together 30 minutes a day"
+7 SET ^AUPNVWC(DA,1,"B","Read books together 30 minutes",1)=""
+8 SET ^AUPNVWC(DA,1,2,0)="Do not expect child to share all toys"
+9 SET ^AUPNVWC(DA,1,"B","Do not expect child to share a",2)=""
+10 SET ^AUPNVWC(DA,1,0)="^9000010.465^2^2"
+11 SET ^AUPNVWC(DA,5,1,0)="Offer variety of health foods"
+12 SET ^AUPNVWC(DA,1,"B","Offer variety of health foods",1)=""
+13 SET ^AUPNVWC(DA,5,2,0)="Do not force eating"
+14 SET ^AUPNVWC(DA,1,"B","Do not force eating",2)=""
TVX DO ^XBFMK
+1 QUIT
+2 ;