[613] | 1 | TIUPUTU ; SLC/JER - Utilities for Filer/Router ;1/16/04
|
---|
| 2 | ;;1.0;TEXT INTEGRATION UTILITIES;**3,100,120,113**;Jun 20, 1997
|
---|
| 3 | LOOKUP ; Look-up code used by router/filer
|
---|
| 4 | ; Required: TIUSSN, TIUADT
|
---|
| 5 | N DA,DFN,TIU,TIUDAD,TIUDPRM,TIUEDIT,TIUEDT,TIULDT,TIUXCRP S TIUXCRP=1
|
---|
| 6 | I $S('$D(TIUSSN):1,'$D(TIUADT):1,$G(TIUSSN)?4N:1,$G(TIUSSN)']"":1,1:0) S Y=-1 G LOOKUPX
|
---|
| 7 | I TIUSSN?3N1P2N1P4N.E S TIUSSN=$TR(TIUSSN,"-/","")
|
---|
| 8 | I TIUSSN["?" S Y=-1 G LOOKUPX
|
---|
| 9 | S TIUEDT=$$IDATE^TIULC(TIUADT),TIULDT=$$FMADD^XLFDT(TIUEDT,1)
|
---|
| 10 | I +TIUEDT'>0 S Y=-1 Q
|
---|
| 11 | D MAIN^TIUMOVE(.TIU,.DFN,TIUSSN,TIUEDT,TIULDT,1,"LAST",0)
|
---|
| 12 | I $S($D(TIU)'>9:1,+$G(DFN)'>0:1,1:0) S Y=-1 G LOOKUPX
|
---|
| 13 | S TIUINST=+$$DIVISION^TIULC1(TIU("LOC"))
|
---|
| 14 | I $P(+$G(TIU("EDT")),".")'=$P($$IDATE^TIULC(TIUADT),".") S Y=-1 G LOOKUPX
|
---|
| 15 | I '+$G(TIU("LDT")),($G(TIUDICDT)]""),(+$$IDATE^TIULC(TIUDICDT)=-1) S Y=-1 Q
|
---|
| 16 | D DOCPRM^TIULC1(RECORD("TYPE"),.TIUDPRM)
|
---|
| 17 | S TIUTYP(1)=1_U_RECORD("TYPE")_U_$$PNAME^TIULC1(RECORD("TYPE"))
|
---|
| 18 | S Y=$$GETRECNW^TIUEDI3(DFN,.TIU,TIUTYP(1),.TIUNEW,.TIUDPRM)
|
---|
| 19 | I +Y'>0 G LOOKUPX
|
---|
| 20 | S TIUEDIT=$$CANEDIT(+Y)
|
---|
| 21 | ; If record has text and can be edited, then replace existing text
|
---|
| 22 | I +TIUEDIT>0,$D(^TIU(8925,+Y,"TEXT")) D DELTEXT(+Y)
|
---|
| 23 | I +TIUEDIT'>0 S TIUDAD=+Y,Y=$$MAKEADD
|
---|
| 24 | I +Y'>0 G LOOKUPX
|
---|
| 25 | K TIUHDR(.07)
|
---|
| 26 | D STUFREC(Y,+$G(TIUDAD))
|
---|
| 27 | I +$G(TIUDAD) D SENDADD^TIUALRT(+Y)
|
---|
| 28 | LOOKUPX Q
|
---|
| 29 | CANEDIT(DA) ; Check whether or not document is released
|
---|
| 30 | Q $S(+$P($G(^TIU(8925,+DA,13)),U,4):0,+$P($G(^(13)),U,5)>0:0,+$G(^(15)):0,1:1)
|
---|
| 31 | MAKEADD() ; Create an addendum record
|
---|
| 32 | N DIE,DR,DA,DIC,X,Y,DLAYGO,TIUATYP,TIUFPRIV S TIUFPRIV=1
|
---|
| 33 | S TIUATYP=+$$WHATITLE("ADDENDUM")
|
---|
| 34 | S (DIC,DLAYGO)=8925,DIC(0)="L",X=""""_"`"_TIUATYP_""""
|
---|
| 35 | D ^DIC
|
---|
| 36 | S DA=+Y
|
---|
| 37 | I +DA>0 S DIE=DIC,DR=".04////"_$$DOCCLASS^TIULC1(TIUATYP) D ^DIE
|
---|
| 38 | Q +DA
|
---|
| 39 | STUFREC(DA,PARENT) ; Stuff fixed field data
|
---|
| 40 | N FDA,FDARR,IENS,FLAGS,TIUMSG,TIURDT
|
---|
| 41 | S IENS=""""_DA_",""",FDARR="FDA(8925,"_IENS_")",FLAGS="K"
|
---|
| 42 | I +$G(PARENT)'>0 D
|
---|
| 43 | . S @FDARR@(.02)=$G(DFN),@FDARR@(.03)=$P($G(TIU("VISIT")),U)
|
---|
| 44 | . S @FDARR@(.05)=3
|
---|
| 45 | . S @FDARR@(.07)=$P(TIU("EDT"),U)
|
---|
| 46 | . S @FDARR@(.08)=$P(TIU("LDT"),U),@FDARR@(1401)=TIU("AD#")
|
---|
| 47 | . S @FDARR@(1402)=$P($G(TIU("TS")),U),@FDARR@(1201)=$$NOW^TIULC
|
---|
| 48 | I +$G(PARENT)>0 D
|
---|
| 49 | . S @FDARR@(.02)=+$P(^TIU(8925,+PARENT,0),U,2)
|
---|
| 50 | . S @FDARR@(.03)=+$P(^TIU(8925,+PARENT,0),U,3),@FDARR@(.05)=3
|
---|
| 51 | . S @FDARR@(.06)=PARENT,@FDARR@(.08)=$P(TIU("LDT"),U)
|
---|
| 52 | . S @FDARR@(1401)=$P(^TIU(8925,+PARENT,14),U)
|
---|
| 53 | . S @FDARR@(1402)=$P(^TIU(8925,+PARENT,14),U,2)
|
---|
| 54 | . S @FDARR@(1201)=$$NOW^TIULC
|
---|
| 55 | S @FDARR@(1205)=$P($G(TIU("LOC")),U)
|
---|
| 56 | S @FDARR@(1212)=$P($G(TIU("INST")),U)
|
---|
| 57 | I +$G(TIU("LDT")) S TIURDT=+$G(TIU("LDT"))
|
---|
| 58 | I +$G(TIU("LDT"))'>0 D
|
---|
| 59 | . S TIUDICDT=+$$IDATE^TIULC($G(TIUDICDT))
|
---|
| 60 | . S TIURDT=$S(+$G(TIUDICDT)>0:+$G(TIUDICDT),1:+$$NOW^TIULC)
|
---|
| 61 | . S TIU("LDT")=TIURDT_U_$$DATE^TIULS(TIURDT,"AMTH DD, CCYY@HR:MIN:SEC")
|
---|
| 62 | . S @FDARR@(.12)=1
|
---|
| 63 | S @FDARR@(1301)=TIURDT,@FDARR@(1303)="U"
|
---|
| 64 | D FILE^DIE(FLAGS,"FDA","TIUMSG") ; File record
|
---|
| 65 | Q
|
---|
| 66 | DELTEXT(DA) ; Delete existing text in preparation for replacement
|
---|
| 67 | N DIE,DR,X,Y
|
---|
| 68 | S DIE=8925,DR="2///@" D ^DIE
|
---|
| 69 | Q
|
---|
| 70 | WHATYPE(X) ; Identify document type
|
---|
| 71 | ; Receives: X=Document Definition Name
|
---|
| 72 | ; Returns: Y=Document Definition IFN
|
---|
| 73 | N DIC,Y,TIUFPRIV S TIUFPRIV=1
|
---|
| 74 | S DIC=8925.1,DIC(0)="M"
|
---|
| 75 | S DIC("S")="I +$O(^TIU(8925.1,+Y,""HEAD"",0))!+$O(^TIU(8925.1,+Y,""ITEM"",0))"
|
---|
| 76 | D ^DIC K DIC("S")
|
---|
| 77 | Q Y
|
---|
| 78 | WHATYPE2(X) ; Identify document type
|
---|
| 79 | ; Receives: X=Document Definition Name
|
---|
| 80 | ; Returns: Y=Document Definition IFN
|
---|
| 81 | N DIC,Y,TIUFPRIV S TIUFPRIV=1
|
---|
| 82 | S DIC=8925.1,DIC(0)="M"
|
---|
| 83 | S DIC("S")="I +$O(^TIU(8925.1,+Y,""HEAD"",0))!+$O(^TIU(8925.1,+Y,""ITEM"",0))"
|
---|
| 84 | D ^DIC K DIC("S")
|
---|
| 85 | Q Y
|
---|
| 86 | WHATITLE(X) ; Identify document type
|
---|
| 87 | ; Receives: X=Document Definition Name
|
---|
| 88 | ; Returns: Y=Document Definition IFN
|
---|
| 89 | N DIC,Y,TIUFPRIV S TIUFPRIV=1
|
---|
| 90 | S DIC=8925.1,DIC(0)="M"
|
---|
| 91 | S DIC("S")="I $P(^TIU(8925.1,+Y,0),U,4)=""DOC"""
|
---|
| 92 | D ^DIC K DIC("S")
|
---|
| 93 | Q Y
|
---|
| 94 | FOLLOWUP(TIUDA) ; Post-filing code for Discharge Summaries
|
---|
| 95 | N FDA,FDARR,IENS,FLAGS,TIUMSG,TIU
|
---|
| 96 | S IENS=""""_TIUDA_",""",FDARR="FDA(8925,"_IENS_")",FLAGS="K"
|
---|
| 97 | D GETTIU^TIULD(.TIU,TIUDA)
|
---|
| 98 | I $L($G(TIU("EDT"))) S @FDARR@(.07)=$P($G(TIU("EDT")),U)
|
---|
| 99 | S @FDARR@(1204)=$$WHOSIGNS^TIULC1(TIUDA)
|
---|
| 100 | S @FDARR@(1208)=$$WHOCOSIG^TIULC1(TIUDA)
|
---|
| 101 | D FILE^DIE(FLAGS,"FDA","TIUMSG")
|
---|
| 102 | I +$P($G(^TIU(8925,+TIUDA,12)),U,4)'=+$P($G(^(12)),U,9) D
|
---|
| 103 | . S @FDARR@(1506)=1 D FILE^DIE(FLAGS,"FDA","TIUMSG")
|
---|
| 104 | D ENQ^TIUPXAP1 ; In-line call to get/file the visit
|
---|
| 105 | D RELEASE^TIUT(TIUDA,1),UPDTIRT^TIUDIRT(.TIU,TIUDA)
|
---|
| 106 | D AUDIT^TIUEDI1(TIUDA,0,$$CHKSUM^TIULC("^TIU(8925,"_+TIUDA_",""TEXT"")"))
|
---|
| 107 | Q
|
---|