source: WorldVistAEHR/trunk/r/SURGERY-SR/SROCVER.m@ 1259

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

initial load of WorldVistAEHR

File size: 5.2 KB
Line 
1SROCVER ;BIR/SJA - CODE SET VERSIONING UTILITY ; [ 01/29/03 08:18 AM ]
2 ;;3.0; Surgery ;**116**;24 Jun 93
3 ;
4 ;Reference to $$ICDDX^ICDCODE supported by DBIA #3990
5 ;Reference to $$CPT^ICPTCOD supported by DBIA #1995
6 ;Reference to ^TMP("CSLSUR1" supported by DBIA #3498
7 ;
8VALIDAT N ATTD,SRBB,SRCC,DLN,SRII,SRJJ,SLN,OCOD,SRAA,SRCODE,SRDATE,SRMOD,SRND0,SRND1,SRND34,SRNON,SRJ,SROP,SRPD,SRT,SRY,SRX,SRX1,SRYY,XMY,Y
9 K ^TMP("SRCVER",$J) S $P(DLN,"-",78)=""
10 S SRTN=$S($D(SRTN):SRTN,1:DA),SRND0=$G(^SRF(SRTN,0)),SROP=$G(^SRF(SRTN,"OP")),SRND1=$G(^SRF(SRTN,.1)),SRNON=$G(^SRF(SRTN,"NON"))
11 S SRPD=$S($D(^SRF(SRTN,"NON")):$P(SRNON,"^",6),1:$P(SRND1,"^",4)),ATTD=$S($D(^SRF(SRTN,"NON")):$P(SRNON,"^",7),1:$P(SRND1,"^",13)),SRND34=$G(^SRF(SRTN,34))
12 S SRDATE=$S($P(SRND0,"^",9):$P(SRND0,"^",9),1:DT)
13 ;
14 S SRCODE=$P(SROP,"^",2) I SRCODE S SRT=$$CPT^ICPTCOD(SRCODE,SRDATE) I $P(SRT,"^",7)=0 S ^TMP("SRCVER",$J,"1;!;PRINCIPAL CPT CODE",$P(SRT,"^",2))=SRCODE D
15 .S (SRJJ,SRII)=0 F S SRII=$O(^SRF(SRTN,"OPMOD",SRII)) Q:'SRII S SRMOD="" S (Y,SRT)=$P($G(^SRF(SRTN,"OPMOD",SRII,0)),"^") D DISPLAY^SROMOD S SRMOD=$S($G(SRMOD):SRMOD_","_Y,1:Y) D
16 ..S ^TMP("SRCVER",$J,"1_1;; CPT MODIFIER",SRMOD)=SRT_"^"_SRII
17 ;
18 S (SRT,SRAA)=0 F S SRAA=$O(^SRF(SRTN,13,SRAA)) Q:'SRAA S OCOD=+$G(^(SRAA,2)) I OCOD S SRT=$$CPT^ICPTCOD(OCOD,SRDATE) I $P(SRT,"^",7)=0 S ^TMP("SRCVER",$J,"2;!;OTHER PROCEDURE CPT CODE",$P(SRT,"^",2))=OCOD_"^"_SRAA D
19 .S SRBB=0 F S SRBB=$O(^SRF(SRTN,13,SRAA,"MOD",SRBB)) Q:'SRBB S SRMOD="" S (SRT,Y)=$P($G(^SRF(SRTN,13,SRAA,"MOD",SRBB,0)),"^") D DISPLAY^SROMOD S SRMOD=$S($G(SRMOD):SRMOD_","_Y,1:Y) D
20 ..S ^TMP("SRCVER",$J,"2_1;; CPT MODIFIER",SRMOD)=$P(SRT,"^")_"^"_SRAA
21 ;
22 I $P(SRND34,"^",2)'="" S SRT=$$ICDDX^ICDCODE($P(SRND34,"^",2),SRDATE) I $P(SRT,"^",10)=0 S ^TMP("SRCVER",$J,"3;!;PRIN DIAGNOSIS CODE",$P(SRT,"^",2))=$P(SRND34,"^",2)
23 ;
24 S SRAA=0 F S SRAA=$O(^SRF(SRTN,14,SRAA)) Q:'SRAA S OCOD=$P(^SRF(SRTN,14,SRAA,0),"^",3) I OCOD S SRT=$$ICDDX^ICDCODE(OCOD,SRDATE) I $P(SRT,"^",10)=0 S ^TMP("SRCVER",$J,"4;!;OTHER PREOP DIAGNOSIS",$P(SRT,"^",2))=OCOD_"^"_SRAA
25 ;
26DISP Q:'$D(^TMP("SRCVER",$J))
27 W !!,DLN
28 D EN^DDIOL("The following codes are no longer active and will be deleted for case #:"_SRTN,,"!")
29 S SRAA="" F S SRAA=$O(^TMP("SRCVER",$J,SRAA)) Q:SRAA="" W:SRAA["!" ! S (SRBB,SRCC)="" F S SRBB=$O(^TMP("SRCVER",$J,SRAA,SRBB)) Q:SRBB="" S SRCC=SRCC+1 D
30 .W:SRCC=1 !,?10,$P(SRAA,";",3)_": ",?40,SRBB W:SRCC>1 !,?40,SRBB
31 D EN^DDIOL("New active codes must be re-entered. A MailMan message will be sent to",,"!!")
32 D EN^DDIOL("the "_$S(SRNON'="":"provider and attending provider",1:"surgeon and attending surgeon")_" of record and to the user who edited",,"!")
33 D EN^DDIOL("the record with case details for follow-up.",,"!")
34 W !!,DLN
35 W !!,"Press RETURN to continue " R SRX:DTIME
36 D SENDMSG
37 Q
38SENDMSG ;Send mail message when check is complete.
39 Q:'$D(^TMP("SRCVER",$J))
40 K SR,XMY S XMDUZ="SURGERY PACKAGE",XMSUB="ICD-9 OR CPT CODE DELETION",XMY(DUZ)="",SLN=0 D NOW^%DTC S Y=% X ^DD("DD")
41 F SRJJ=SRPD,ATTD,DUZ S:$G(SRJJ) XMY(SRJJ)=""
42 S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT
43 S SR(1)="Patient: "_$E(VADM(1),1,20)_$J("",30-$L(VADM(1)))_" Case #: "_SRTN
44 S Y=SRDATE D DD^%DT
45 S SR(2)=$S(SRNON'="":"Procedure Date: ",1:"Operation Date: ")_Y_" "_$P(SROP,"^"),SR(3)=""
46 S SR(5)="The following codes are no longer active and were deleted for this"
47 S SR(6)="case when the "_$S(SRNON'="":"Time Procedure Began",1:"Time Patient in OR")_" was entered."
48 S SR(7)="",SLN=8
49 S SRX=$J("",8),SRX1=$J("",40)
50 ;
51PCPT S SRAA=0,SRAA=$O(^TMP("SRCVER",$J,"1;!;PRINCIPAL CPT CODE",SRAA)) I SRAA S SR(SLN)=SRX_"PRINCIPAL CPT CODE: "_SRAA D
52 .K SRY S SRY(130,SRTN_",",27)="@" D FILE^DIE("","SRY")
53 .S SRMOD="",SRJJ=0 F S SRMOD=$O(^TMP("SRCVER",$J,"1_1;; CPT MODIFIER",SRMOD)) Q:SRMOD="" D
54 ..S SRJJ=SRJJ+1,SLN=SLN+1 S:SRJJ=1 SR(SLN)=SRX_" CPT MODIFIER:"_$J("",14)_SRMOD S:SRJJ>1 SR(SLN)=$J("",36)_SRMOD
55 ..K SRY S SRY(130,SRTN_",",28)="@" D FILE^DIE("","SRY")
56 S SLN=SLN+1,SR(SLN)=""
57 ;
58OCPT S SRAA=0,SLN=SLN+1 F S SRAA=$O(^TMP("SRCVER",$J,"2;!;OTHER PROCEDURE CPT CODE",SRAA)) Q:'SRAA S SR(SLN)=SRX_"OTHER PROCEDURE CPT CODE: "_SRAA,SRJ=$P($G(^(SRAA)),"^",2) D
59 .K SRY S SRY(130.16,SRJ_","_SRTN_",",3)="@" D FILE^DIE("","SRY")
60 .S SRMOD="",SRJJ=0 F S SRMOD=$O(^TMP("SRCVER",$J,"2_1;; CPT MODIFIER",SRMOD)) Q:SRMOD="" S SRJ=$G(^(SRMOD)) D
61 ..S SRJJ=SRJJ+1,SLN=SLN+1 S:SRJJ=1 SR(SLN)=SRX_" CPT MODIFIER:"_$J("",14)_SRMOD S:SRJJ>1 SR(SLN)=$J("",36)_SRMOD
62 ..K SRY S SRY(130.16,SRJ_","_SRTN_",",4)="@" D FILE^DIE("","SRY")
63 ;
64PD S SRAA=0,SLN=SLN+1,SRAA=$O(^TMP("SRCVER",$J,"3;!;PRIN DIAGNOSIS CODE",SRAA)) I SRAA S SR(SLN)=SRX_"PRIN DIAGNOSIS CODE:"_SRX_SRAA K SRY S SRY(130,SRTN_",",66)="@" D FILE^DIE("","SRY")
65 ;
66OPD S (SRJJ,SRAA)=0 F S SRAA=$O(^TMP("SRCVER",$J,"4;!;OTHER PREOP DIAGNOSIS",SRAA)) Q:'SRAA S SLN=SLN+1,SRJJ=SRJJ+1 S SRYY=$P($G(^(SRAA)),"^",2) D
67 .S:SRJJ=1 SR(SLN)=SRX_"OTHER PREOP DIAGNOSIS:"_$J("",6)_SRAA S:SRJJ>1 SR(SLN)=$J("",36)_SRAA
68 .K SRY S SRY(130.17,SRYY_","_SRTN_",",3)="@" D FILE^DIE("","SRY")
69 S (SR(SLN+1),SR(SLN+2))=""
70 S SR(SLN+3)="New active codes must be re-entered."
71 S XMTEXT="SR(" D ^XMD
72 ;
73CFLS ;This line of code to update Surgery-CoreFLS changes
74 Q:'$D(^TMP("CSLSUR1",$J))
75 S SRSITE=$S($D(SRSITE):SRSITE,1:$$SITE^SROUTL0(SRTN))
76 S SROERR=SRTN D ^SROERR0
77 Q
Note: See TracBrowser for help on using the repository browser.