Skip to content

Commit fcaa28e

Browse files
authored
update
1 parent 8256f9f commit fcaa28e

File tree

5 files changed

+114
-26
lines changed

5 files changed

+114
-26
lines changed

Integration/src/RFT.ERS.Operation.ExecuteQuery.cls

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,30 @@ Property Adapter As EnsLib.SQL.OutboundAdapter;
77

88
Parameter INVOCATION = "Queue";
99

10-
Method UpdateData(pRequest As Ens.StringContainer, Output pResponse As Ens.Response)
10+
Method OnRequest(pRequest As %DynamicObject, Output pResponse As Ens.Response)
1111
{
12-
Set sc = $$$OK
12+
Set tsc = $$$OK
13+
$$$TRACE("Start")
1314
Try {
1415
Set pResponse = ##class(EnsLib.SQL.Snapshot).%New()
15-
Set SQL = pRequest.StringValue
16-
17-
Set sc = ..Adapter.ExecuteUpdate(.pResponse, SQL)
18-
19-
16+
Set Qry = "INSERT INTO TABLE patients" _ pRequest.Identifier _ " " _ pRequest.FamilyName _ " " _ pRequest.GivenName _ " " _ pRequest.Gender _ " " _ pRequest.DOB _ " " _ pRequest.Telecom
17+
$$$TRACE(Qry)
18+
Set tsc = ..Adapter.ExecuteUpdate(.pResponse, Qry)
2019
}
2120
Catch Ex {
22-
Set sc = Ex.AsStatus()
21+
Set tsc = Ex.AsStatus()
2322
}
2423

25-
quit sc
26-
}
27-
28-
XData MessageMap
29-
{
30-
<MapItems>
31-
<MapItem MessageType="Ens.StringContainer">
32-
<Method>UpdateData</Method>
33-
</MapItem>
34-
</MapItems>
24+
quit tsc
25+
26+
//XData MessageMap
27+
//{
28+
//<MapItems>
29+
// <MapItem MessageType="Ens.StringContainer">
30+
// <Method>UpdateData</Method>
31+
// </MapItem>
32+
// </MapItems>
33+
//}
3534
}
3635

3736
}

Integration/src/RFT.ERS.Process.DocumentProcessor.cls

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,19 @@ Method OnRequest(pInput As RFT.ERS.Classes.RequestAttachment, Output pResponse A
6363
}
6464
elseif fileType'="pdf"
6565
{
66-
set cmd=""""_..LibreOffice_""""_" --headless --writer --convert-to pdf "_filePath_" --outdir "_TargetDir
67-
SET runCmd=$ZF(-1,cmd)
66+
If $$IsFileTypeAllowed(fileType)
67+
{
68+
set cmd=""""_..LibreOffice_""""_" --headless --writer --convert-to pdf "_filePath_" --outdir "_TargetDir
69+
SET runCmd=$ZF(-1,cmd)
70+
Quit runCmd
71+
}
72+
Else
73+
{
74+
; File type is not allowed, so just copy the original file to the target directory
75+
Set copyCmd = "cp "_filePath_" "_TargetDir
76+
Set copyResult = $ZF(-1, copyCmd)
77+
Quit copyResult
78+
}
6879
}
6980
//update local list
7081
$$$TRACE("PDF File saved. Attchment ID: "_pInput.attachmentID)
@@ -91,6 +102,14 @@ Method OnRequest(pInput As RFT.ERS.Classes.RequestAttachment, Output pResponse A
91102
quit t
92103
}
93104

105+
ClassMethod IsFileTypeAllowed(fileType As %String) As %Boolean
106+
{
107+
Set fileType = $ZCONVERT(fileType, "U") ; Convert to uppercase for case-insensitive comparison
108+
;Set allowedFiles = $LISTBUILD("DOCX", "DOC", "TXT", "RTF", "TIF", "JPEG")
109+
Set allowedFiles = $LISTFROMSTRING(..AllowedFiles)
110+
Quit $LISTFIND(allowedFiles, fileType)
111+
}
112+
94113
Storage Default
95114
{
96115
<Data name="DocumentProcessorDefaultData">

Integration/src/RFT.ERS.Process.RefToDB.cls

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Method OnRequest(pInput As Ens.Request, Output pResponse As Ens.Response) As %St
2222
{
2323
//Insert referral into external DB
2424
;set refQry="INSERT INTO ersdocs_workflow.ersRefReq_Details "
25-
set refQry="INSERT INTO dbo.ersRefReq_Details "
25+
;set refQry="INSERT INTO dbo.ersRefReq_Details "
26+
set refQry="INSERT INTO ers_database.dbo.ersRefReq_Details "
2627
set refQry=refQry_"(RefReq_UniqueID,RefReq_NHSNo,RefReq_UBRN,RefReq_TrustNACS,Appt_StDttm,Appt_EndDttm,RefReq_Specialty,RefReq_Status,"
2728
set refQry=refQry_"RefReq_intent,RefReq_Priority,RefReq_Noofdocs,RefReq_FullURL,rec_UpdatedBy,rec_insertedBy) "
2829
set refQry=refQry_"VALUES ('"_ubrn_"','"_referral.patientID_"','"_referral.ubrn_"','RFR','"_referral.apptStart_"','"_referral.apptEnd_"','"_referral.specialty_"','"
@@ -53,7 +54,8 @@ Method OnRequest(pInput As Ens.Request, Output pResponse As Ens.Response) As %St
5354
$$$LOGINFO("here")
5455

5556
QUIT:SQLCODE
56-
set attchQry="INSERT INTO dbo.ersdoc_attachments "
57+
;set attchQry="INSERT INTO dbo.ersdoc_attachments "
58+
set attchQry="INSERT INTO ers_database.dbo.ersdoc_attachments "
5759
set attchQry=attchQry_"(RefDoc_UniqueID,RefDocStatus,Attach_ID,Attach_InsertedBy,Attach_ContentType,Attach_URL,Attach_Size,Attach_Title,Attach_CrtdDTTM,"
5860
set attchQry=attchQry_"DocDownloadURL,DocLocationURI,rec_Updated) "
5961
set attchQry=attchQry_"VALUES ('"_ubrn_"','"_docStatus_"','"_attachmentID_"','"_insertedBy_"','"
@@ -82,22 +84,26 @@ Method OnRequest(pInput As Ens.Request, Output pResponse As Ens.Response) As %St
8284

8385
// Build query to fetch patientID (NHS Number)
8486
//Check if nhs number and DOB exist
85-
Set Qry = "SELECT COUNT(*) FROM dbo.patients WHERE pat_nhs = '"_PatientDetails.NHSnumber_"' and pat_dob = '"_PatientDetails.dob_"';"
87+
;Set Qry = "SELECT COUNT(*) FROM dbo.patients WHERE pat_nhs = '"_PatientDetails.NHSnumber_"' and pat_dob = '"_PatientDetails.dob_"';"
88+
Set Qry = "SELECT COUNT(*) FROM ers_database.dbo.patients WHERE pat_nhs = '"_PatientDetails.NHSnumber_"' and pat_dob = '"_PatientDetails.dob_"';"
8689
//update if nhs number exists
8790
$$$TRACE("MPI:"_PatientDetails.MPI)
88-
Set Qry = Qry_"UPDATE dbo.patients SET pat_mrn = '"_PatientDetails.MPI
91+
;Set Qry = Qry_"UPDATE dbo.patients SET pat_mrn = '"_PatientDetails.MPI
92+
Set Qry = Qry_"UPDATE ers_database.dbo.patients SET pat_mrn = '"_PatientDetails.MPI
8993
Set Qry = Qry_"', pat_familyName = '"_PatientDetails.FamilyName_"', pat_givenName = '"_PatientDetails.GivenName_"', pat_sex = '"_PatientDetails.Gender
9094
Set Qry = Qry_"', pat_addressOne = '"_PatientDetails.Address1_"', pat_addressTwo = '"_PatientDetails.Address2_"', pat_addressThree = '"_PatientDetails.Address3
9195
Set Qry = Qry_"', pat_PostCode = '"_PatientDetails.postalCode
9296
Set Qry = Qry_"', pat_contactNumber = '"_PatientDetails.phone
9397
Set Qry = Qry_"' WHERE pat_nhs = '"_PatientDetails.NHSnumber_"' and rec_UpdatedBy = 'TIE'; "
9498
//Insert if nhs number is new
95-
Set Qry = Qry_"INSERT INTO dbo.patients (pat_mrn, pat_nhs, pat_familyName, pat_givenName, pat_sex, pat_dob, pat_addressOne, pat_addressTwo, pat_addressThree, "
99+
;Set Qry = Qry_"INSERT INTO dbo.patients (pat_mrn, pat_nhs, pat_familyName, pat_givenName, pat_sex, pat_dob, pat_addressOne, pat_addressTwo, pat_addressThree, "
100+
Set Qry = Qry_"INSERT INTO ers_database.dbo.patients (pat_mrn, pat_nhs, pat_familyName, pat_givenName, pat_sex, pat_dob, pat_addressOne, pat_addressTwo, pat_addressThree, "
96101
Set Qry = Qry_"pat_PostCode, pat_contactNumber, rec_UpdatedBy) "
97102
Set Qry = Qry_"SELECT '"_PatientDetails.MPI_"', '"_PatientDetails.NHSnumber_"', '"_PatientDetails.FamilyName_"', '"_PatientDetails.GivenName_"', '"_PatientDetails.Gender
98103
Set Qry = Qry_"', '"_PatientDetails.dob_"', '"_PatientDetails.Address1_"', '"_PatientDetails.Address2_"', '"_PatientDetails.Address3_"', '"_PatientDetails.postalCode
99104
Set Qry = Qry_"', '"_PatientDetails.phone_"', 'TIE'"
100-
Set Qry = Qry_" WHERE NOT EXISTS (SELECT * FROM dbo.patients WHERE pat_nhs = '"_PatientDetails.NHSnumber_"' and pat_dob = '"_PatientDetails.dob_"');"
105+
;Set Qry = Qry_" WHERE NOT EXISTS (SELECT * FROM dbo.patients WHERE pat_nhs = '"_PatientDetails.NHSnumber_"' and pat_dob = '"_PatientDetails.dob_"');"
106+
Set Qry = Qry_" WHERE NOT EXISTS (SELECT * FROM ers_database.dbo.patients WHERE pat_nhs = '"_PatientDetails.NHSnumber_"' and pat_dob = '"_PatientDetails.dob_"');"
101107

102108
// Send query to ODBC operation
103109
set insertAttachment=##class(Ens.StringContainer).%New()

Integration/src/RFT.ERS.Process.ReferralProcessor.cls

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ Method OnRequest(pInput As RFT.ERS.Classes.RequestReferralDetails, Output pRespo
4646
{
4747
set workList.clinicalInfoLastUpdate = ersLastUpdate
4848
}
49+
// Case workList.clinicalInfoLastUpdate got a value
50+
//if $LENGTH(ersLastUpdate) '= 0
51+
//{
52+
53+
//set dateDiff=##class(%SYSTEM.SQL).DATEDIFF("ss",localLastUpdated,ersLastUpdate)
54+
//if $G(dateDiff)'=0
4955

5056
if localLastUpdated '= ersLastUpdate
5157
{
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
Class RFT.Utility.ExportClassesUtil Extends %RegisteredObject
2+
{
3+
4+
// Method to export classes from the given package name
5+
6+
ClassMethod UDLExport(packageName As %String) As %Status
7+
{
8+
set tsc =$$$OK
9+
// Construct SQL query to retrieve class names from the given package
10+
set Qry= "SELECT Name FROM %Library.RoutineMgr_StudioOpenDialog('"_packageName_"',1,1,0,1,0,0)"
11+
Set ST=##class(%SQL.Statement).%New()
12+
// Create a new %SQL.Statement object and prepare the query
13+
set tsc = ST.%Prepare(Qry)
14+
// Execute the prepared query to obtain a result set
15+
set rset = ST.%Execute()
16+
17+
// Loop through each result in the result set
18+
while rset.%Next()
19+
{
20+
// Get the class name from the result set
21+
set ClassName = rset.%Get("Name")
22+
// Export the class in the form of a UDL file using the $System.OBJ.ExportUDL method
23+
set tsc = $System.OBJ.ExportUDL(ClassName,ClassName,,,)
24+
write ClassName,!
25+
}
26+
quit tsc
27+
}
28+
29+
// Method to export production classes as xml for a specific IRIS/Cache version
30+
31+
ClassMethod ExportProd(version As %String, packageName As %String, ProductionExportFile As %String) As %Status
32+
{
33+
set tsc =$$$OK
34+
// Set the export version qualifier
35+
set tsc = $SYSTEM.OBJ.SetQualifiers("/exportversion="_version)
36+
// Export the package classes using the $System.OBJ.Export method and store the exported data in the specified production export file
37+
do $System.OBJ.Export(.packageName,.ProductionExportFile)
38+
39+
quit tsc
40+
}
41+
42+
/*
43+
44+
Run in terminal:
45+
46+
Class method 1: to export classes and lookup tables
47+
do ##class("RFT.Utility.ExportClassesUtil").UDLExport("RFT.*.cls,*.LUT")
48+
49+
Class method 2: to export an entire production
50+
// Use to export PROD to be deployed on Cache systems
51+
do ##class("RFT.Utility.ExportClassesUtil").ExportProd("cache2017.2.1","RFT.*.cls,*.LUT","ProductionToDeploy.xml")
52+
53+
// Use to export PROD to be deployed on IRIS systems
54+
do ##class("RFT.Utility.ExportClassesUtil").ExportProd("iris2022.3","RFT.*.cls,*.LUT,*.PTD","ProductionToDeploy.xml")
55+
56+
*/
57+
}
58+

0 commit comments

Comments
 (0)