source: FOIAVistA/trunk/r/SURGERY-SR/SRHLU.m@ 1611

Last change on this file since 1611 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1SRHLU ;B'HAM ISC/DLR - Surgery HL7 Utility routine ; [ 05/06/98 7:14 AM ]
2 ;;3.0; Surgery ;**41**;24 Jun 93
3 ; Per VHA Directive 10-93-142, this routine SHOULD NOT be modified.
4DNAME(NAME) ;identifies an incoming CN data type to a record in file 200
5 N X,CNT
6 I '$D(NAME)!(($P(NAME,HLCOMP)="")&($P(NAME,HLCOMP,2="")!$P(NAME,HLCOMP,3=""))) S HLERR="Invalid Name." Q ""
7 I NAME="" Q ""
8 I $P(NAME,HLCOMP)'="" S NAME=$O(^VA(200,"SSN",$P(NAME,HLCOMP),0))
9 E S X="",CNT=0 S NAME=$$FMNAME^HLFNC($P(NAME,HLCOMP,2,3)) F S X=$O(^VA(200,"B",NAME,X)) Q:'X S CNT=CNT+1 S NAME=$S(CNT=1:X,CNT>1:"")
10 Q NAME
11HNAME(IEN) ;converts an file 200 internal entry number into an HL7 CN data type
12 I IEN="" Q ""
13 I '$D(^VA(200,IEN,0)) W !,"Not a valid entry in file 200." Q ""
14 Q $P(^VA(200,IEN,1),U,9)_HLCOMP_$P($P(^VA(200,IEN,0),U),",")_HLCOMP_$P($P(^VA(200,IEN,0),U),",",2)
15SETDSC(HL,DSC,SRHL) ;Create discrepancy ^XTMP global
16 N SRMID S SRMID=HL("MID")
17 I '$D(^XTMP("SRHLERR^"_SRMID_"^"_HL("DTM"),0)) S ^XTMP("SRHLERR^"_SRMID_"^"_HL("DTM"),0)=$$FMADD^XLFDT(DT,3)_"^"_HL("DTM")_"^Surgery Interface Error Log."
18 S ^XTMP("SRHLERR^"_SRMID_"^"_HL("DTM"),SRHL("E"))=DSC
19 S SRHL("E")=SRHL("E")+1
20 Q
21DSCPANCY(HL) ;Discrepancy message builder
22 N SRMID S SRMID=HL("MID")
23 S XMSUB="HL7 Message #"_SRMID_" contains Surgery application discrepancies."
24 S XMY("G.SRHL DISCREPANCY")=""
25 S XMTEXT="^XTMP(""SRHLERR^""_SRMID_""^""_HL(""DTM""),"
26 D ^XMD K XMTEXT,XMY,XMSUB
27 Q
28DIV() ; return division associated with default institution
29 N SITE,SRDIV S SRDIV="",SITE=$P($G(^XMB(1,1,"XUS")),"^",17) I SITE S SRDIV=$O(^SRO(133,"B",SITE,0)) I SRDIV S SRDIV=$O(^SRO(133,0))
30 Q SRDIV
31V() ;check HL7 package compatibility level
32 N SRDIV,SR15 S SR15="",SRDIV=$$DIV S:SRDIV SR15=$P($G(^SRO(133,SRDIV,0)),"^",20)
33 Q SR15
34CHNG ; entry to update VisA HL7 compatibility level
35 N SR15,SRDIV,SRY
36 S SRDIV=$$DIV I 'SRDIV W !!,?5,"Default institution must be defined as a Surgery site in the SURGERY",!,?5,"SITE PARAMETERS file (#133) before this parameter can be updated.",!! Q
37 S SR15=$P($G(^SRO(133,SRDIV,0)),"^",20)
38 W !!,"This option may be used to edit the site parameter that determines which",!,"Surgery HL7 interface will be used, the interface compatible with VISTA HL7",!,"V. 1.6 or the older one compatible with VISTA HL7 V. 1.5."
39 W !!,"If applications communicating with the Surgery HL7 interface must use the",!,"interface designed for HL7 V. 1.5, enter YES. Otherwise, enter NO or leave",!,"this field blank.",!
40 K DA,DIE,DR S DA=SRDIV,DIE=133,DR="34T" D ^DIE K DA,DIE,DR
41 Q
Note: See TracBrowser for help on using the repository browser.