source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LREPIPH.m@ 1742

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

initial load of FOIAVistA 6/30/08 version

File size: 2.6 KB
Line 
1LREPIPH ;DALOI/RLM-EMERGING PATHOGENS HL7 SEGMENT BUILDER ;1/1/98
2 ;;5.2;LAB SERVICE;**260,281**;Sep 27, 1994
3 ; Reference to ^ICD9 supported by IA #10082
4 ; Reference to ^PXD(811.9 supported by IA #1256
5 ; Reference to ^PSDRUG supported by IA #221-A
6 ; Reference to FIDATA^PXRM supported by IA #2182
7 Q
8RXNT ;Findings Data
9 K FINDINGS S LRNTE1=1,(LRDRSQ1,LRDRSEQ)=0
10 S LRDRSEQ=LRDRSEQ+1
11 M FINDINGS=^TMP("LREPISRCH",$J,DFN,"FIND")
12 S LRFIND=0 F S LRFIND=$O(FINDINGS(LRFIND)) Q:'LRFIND D
13 . ;S LRENDTX=$G(FINDINGS(LRFIND,"DATE"))
14 . ;D PV1
15 . I $D(FINDINGS(LRFIND,"DRUG")) S LRDRSQ1=LRDRSEQ D DRUG
16 . I $D(FINDINGS(LRFIND,"FINDING")) D FIND
17 . S LRDRSQ1=0 Q
18 K FINDINGS,^TMP("LREPISRCH",$J,DFN) S LRPVVV=0 Q
19DRUG ;
20 D PV1
21 S LRDRUG=+FINDINGS(LRFIND,"FINDING")
22 S LRDRGC=$P($G(^PSDRUG(LRDRUG,2)),"^",4)
23 S LRDATA="ZXE"_HLFS_LRDRGC_HLFS_FINDINGS(LRFIND,"DRUG")_LRCS_"NDC"_HLFS_FINDINGS(LRFIND,"DSUP")_HLFS_$$HLDATE^HLFNC($G(FINDINGS(LRFIND,"RDATE")))_HLFS_$$HLDATE^HLFNC($G(FINDINGS(LRFIND,"DATE")))_HLFS
24 S LRDATA=LRDATA_$$HLDATE^HLFNC($G(FINDINGS(LRFIND,"STOPDATE")))_HLFS_+LRDRSQ1
25 ;S LRDATA="RXO"_HLFS_LRDRGC_LRCS_FINDINGS(LRFIND,"DRUG")_LRCS_"NDC"_HLFS_LRDRGC_HLFS_HLFS_FINDINGS(LRFIND,"DSUP")_HLFS_HLFS_HLFS_HLFS_HLFS_HLFS_HLFS_HLFS_HLFS_+LRDRSQ1
26 S LRCNT=LRCNT+1,^TMP("HLS",$J,LRCNT)=$$UP^XLFSTR(LRDATA),LRMSGSZ=LRMSGSZ+$L(LRDATA)
27 S ^TMP("LREPIREP",$J,LRCNT)=$$UP^XLFSTR(LRDATA)
28 K LRDRGC S LRDRSEQ=LRDRSEQ+1 Q ;S LRPVVV=0 Q
29FIND ;
30 ;Q:$D(FINDINGS(LRFIND,"RDATE")) ;Don't send DSP if RX data is sent.
31 D PV1
32 S LRTRM=$P($G(FINDINGS(LRFIND,"TERM")),"^")
33 S LRTOLD=$G(FINDINGS(LRFIND,"ALTTRM")) I LRTOLD'?1.N S LRTOLD="00"
34 S LRDATA="DSP"_HLFS_LRNTE1_HLFS_HLFS_$$HLDATE^HLFNC(FINDINGS(LRFIND,"DATE"),"TS")_LRCS_LRTRM_LRCS_LRTOLD_LRCS_$G(FINDINGS(LRFIND,"RESULT"))_LRCS_$G(FINDINGS(LRFIND,"S/N"))_HLFS_HLFS_+LRDRSQ1
35 S ^TMP($J,"HEP",LRTOLD)=$G(^TMP($J,"HEP",LRTOLD))+1
36 S LRNTE1=LRNTE1+1,LRCNT=LRCNT+1,^TMP("HLS",$J,LRCNT)=$$UP^XLFSTR(LRDATA),LRMSGSZ=LRMSGSZ+$L(LRDATA)
37 S ^TMP("LREPIREP",$J,LRCNT)=$$UP^XLFSTR(LRDATA)
38 Q ;S LRPVVV=0 Q
39PV1 ;Build PV1
40 Q:$G(LRPVVV)
41 S LRPTY=$P(^TMP($J,LRPROT,DFN,LRENDT),U)
42 S:$P(^TMP($J,LRPROT,DFN,LRENDT),U,3)="UPDT" LRPTY="U"
43 I $P($G(FINDINGS(LRFIND)),"^",2)]"",$P($G(FINDINGS(LRFIND)),"^",2)'="U" S LRPTY=$P($G(FINDINGS(LRFIND)),"^",2)
44 I LRPTY'="I",LRPTY'="O",LRPTY'="U" S LRPTY="U"
45 S LRDATA="PV1|"_LRPV1_"|"_LRPTY_"||||||||||||||||||||||||||||||||||||||||||"_$$HLDATE^HLFNC(LRENDT)
46 S LRCNT=LRCNT+1,^TMP("HLS",$J,LRCNT)=$$UP^XLFSTR(LRDATA),LRMSGSZ=LRMSGSZ+$L(LRDATA),LRPV1=LRPV1+1
47 S ^TMP("LREPIREP",$J,LRCNT)=$$UP^XLFSTR(LRDATA)
48 S LRPVVV=1
49 Q
50ZEOR ;LREPIPH
Note: See TracBrowser for help on using the repository browser.