| [613] | 1 | MDPCE1  ; HOIFO/NCA - Updated Routine For Data Extract ; [05-28-2002 12:55]
 | 
|---|
 | 2 |         ;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
 | 
|---|
 | 3 |         ; Integration Agreements:
 | 
|---|
 | 4 |         ; IA# 1889 [Subscription] Create New Visit
 | 
|---|
 | 5 |         ; IA# 10048 [Supported] FILE 9.4 references
 | 
|---|
 | 6 |         ;
 | 
|---|
 | 7 | EN1(MDINST,MDPDTE,MDPR,MDTYP,MDETYP,MDCLOC)     ; [Function] PCE Visit Creation
 | 
|---|
 | 8 |         ; Input parameters
 | 
|---|
 | 9 |         ;  1. MDINST [Literal/Required] Transaction IEN
 | 
|---|
 | 10 |         ;  2. MDPDT [Literal/Optional] Procedure Date/Time
 | 
|---|
 | 11 |         ;  3. MDPR [Literal/Required] CP Definition
 | 
|---|
 | 12 |         ;  4. MDTYP [Literal/Required] Type of Visit (Ambulatory or Hospitalization or Event (Historical))
 | 
|---|
 | 13 |         ;  5. MDETYP [Literal/Required] Encounter Type (Primary or Ancillary)
 | 
|---|
 | 14 |         ;  6. MDCLOC [Literal/Required] Workload Reporting hospital location
 | 
|---|
 | 15 |         ;
 | 
|---|
 | 16 |         N DATA,MDPERR,MDJ,MDPKG,MDRES,MDSTR,MDVISIT,MDDRES K ^TMP("MDPXAPI",$J)
 | 
|---|
 | 17 |         S MDOUT=""
 | 
|---|
 | 18 |         S MDPKG=$$FIND1^DIC(9.4,"","MX","CLINICAL PROCEDURES")
 | 
|---|
 | 19 |         I 'MDPKG Q "-1^CLINICAL PROCEDURES does not exist in Package File."
 | 
|---|
 | 20 |         I '$D(^MDD(702,MDINST,0)) Q "-1^No Study Record."
 | 
|---|
 | 21 |         S MDSTR=$G(^MDD(702,MDINST,0))
 | 
|---|
 | 22 |         S MDJ=0,MDJ=MDJ+1
 | 
|---|
 | 23 |         I '$G(MDCLOC) S:MDPR["^" MDCLOC=$P(MDPR,"^",2)
 | 
|---|
 | 24 |         I '$G(MDCLOC) S MDCLOC=$$GET1^DIQ(702.01,+MDPR_",",.05,"I") I 'MDCLOC Q "-1^No Hospital Location for CP Definition."
 | 
|---|
 | 25 |         S ^TMP("MDPXAPI",$J,"ENCOUNTER",MDJ,"ENC D/T")=MDPDTE
 | 
|---|
 | 26 |         S ^TMP("MDPXAPI",$J,"ENCOUNTER",MDJ,"PATIENT")=$P(MDSTR,"^",1)
 | 
|---|
 | 27 |         S ^TMP("MDPXAPI",$J,"ENCOUNTER",MDJ,"HOS LOC")=MDCLOC
 | 
|---|
 | 28 |         S ^TMP("MDPXAPI",$J,"ENCOUNTER",MDJ,"SERVICE CATEGORY")=MDTYP
 | 
|---|
 | 29 |         S ^TMP("MDPXAPI",$J,"ENCOUNTER",MDJ,"ENCOUNTER TYPE")=MDETYP
 | 
|---|
 | 30 |         S MDRES=$$DATA2PCE^PXAPI("^TMP(""MDPXAPI"",$J)",MDPKG,"CLINICAL PROCEDURES",.MDVISIT,"","",1,"",.MDPERR)
 | 
|---|
 | 31 |         I MDRES S MDOUT=MDVISIT_"^"_MDCLOC_";"_MDPDTE_";"_MDTYP S MDFDA(702,MDINST_",",.07)=MDTYP_";"_MDPDTE_";"_MDCLOC D FILE^DIE("K","MDFDA") K ^TMP("MDPXAPI",$J) Q MDOUT
 | 
|---|
 | 32 |         K ^TMP("MDPXAPI",$J)
 | 
|---|
 | 33 |         S MDOUT="-1^PCE Visit Creation Error."
 | 
|---|
 | 34 |         Q MDOUT
 | 
|---|
 | 35 |         ;
 | 
|---|