Patient Record (PAS) Lookup

From TMS Support Wiki
Jump to navigation Jump to search

Your PTS application is likely to be connecting to a patient record database of some sort. This is the facility that looks up the patient details on the booking in screen.

ODBC

For now the most popular choice is to connect PTS to the JAC/WellSky/CMM or Ascribe/EMIS database.

Application Settings

Important Settings

  • PASDSNS
    Patient Lookup DSNs. This can also be set to a direct connection string. You can specify multiple comma-separated entries here which is useful for switchover periods.
  • LOCALIDQRY
    Query used by booking-in screen when searching for a patient using localID.
  • NATIDQRY
    Query used by booking-in screen when searching for a patient using nationalID.

Local ID usually refers to Hospital number, and National ID usually refers to NHS number. More often than not the two queries are near identical save for the WHERE clause.

With regard to server moves and updates, assuming the data structure of the new patient record database remains the same as before, more than likely you'll only need to amend the PASDSNS setting and/or the server data source itself to repoint it to the new database location. However an advanced user could redesign the queries here if necessary.

Optional Settings

  • LOCALIDF
    Format of Local ID. This allows prefix or suffix characters to be added to Local IDs. You could handle this in the query itself but it may be tidier to format it here.
  • NATIDF
    Format of National ID. This allows prefix or suffix characters to be added to National IDs. You could handle this in the query itself but it may be tidier to format it here.

After changing Application Settings

Unlike most other Application Settings, changes to the PAS link may require the PTS application to be restarted for any changes to take effect. If the DNS connection test passes but PTS still cannot find any patients (an error message may be written to the forename or surname fields, or nothing may happen at all), try restarting the web site in IIS, and/or recycle the PTS application pool. If it's easier, restarting the server entirely should also work.

If the problem persists make a note of the error message and request a support ticket.

Query guidelines

Patient ID parameter

Include "{PATIENTID}" (without quotes) in your WHERE clause at the point PTS should pass through what the user entered in the Local or National ID field.

No matter whether the local or national ID is used, the input parameter is always {PATIENTID}.

Output

The query should return values with the following field names. Use aliases to 'rename' fields. You don't have to return fields you don't want to use.

  • NationalID
  • LocalID
  • Title
  • Forename
  • FamilyName
  • Gender
  • Mobile
  • EMail
  • DOB
  • Address

Example JAC/WellSky/CMM Local ID query

SELECT patient_hospital_no.lnkphn LocalID, patient_basic.forenames Forename, patient_basic.surname FamilyName, patient_basic.nhs_no NationalID, CASE patient_demographics.sex WHEN 'Male' THEN 1 WHEN 'Female' THEN 2 ELSE 3 END Gender, CASE patient_demographics.patient_reference WHEN 'MR' THEN 4 WHEN 'MS' THEN 1 WHEN 'MRS' THEN 3 WHEN 'MISS' THEN 2 ELSE 0 END Title, patient_demographics.telephone_no Mobile, TRIM(LEADING ', ' FROM ifnull(patient_demographics.address1,'',UPPER(patient_demographics.address1))||ifnull(patient_demographics.address2,'',', '||UPPER(patient_demographics.address2))||ifnull(patient_demographics.address3,'',', '||UPPER(patient_demographics.address3))||ifnull(patient_demographics.address4,'',', '||UPPER(patient_demographics.address4))||ifnull(patient_demographics.postcode,'',', '||UPPER(patient_demographics.postcode))) Address, patient_demographics.birth_date DOB FROM JAC.patient_basic patient_basic, JAC.patient_demographics patient_demographics, JAC.patient_hospital_no patient_hospital_no WHERE patient_demographics.lnkpid = patient_basic.lnkpid AND patient_hospital_no.lnkpid = patient_basic.lnkpid AND patient_hospital_no.lnkphn = ' {PATIENTID}'

Note the space character preceding {PATIENTID}. This is a quirk of the CMM database, and is an example of something you could handle in the LOCALIDF setting.

Example JAC/WellSky/CMM National ID query

SELECT patient_basic.hospital_no LocalID, patient_basic.forenames Forename, patient_basic.surname FamilyName, patient_basic.nhs_no NationalID, CASE patient_demographics.sex WHEN 'Male' THEN 1 WHEN 'Female' THEN 2 ELSE 3 END Gender, CASE patient_demographics.patient_reference WHEN 'MR' THEN 4 WHEN 'MS' THEN 1 WHEN 'MRS' THEN 3 WHEN 'MISS' THEN 2 ELSE 0 END Title, patient_demographics.telephone_no Mobile, TRIM(LEADING ', ' FROM ifnull(patient_demographics.address1,'',UPPER(patient_demographics.address1))||ifnull(patient_demographics.address2,'',', '||UPPER(patient_demographics.address2))||ifnull(patient_demographics.address3,'',', '||UPPER(patient_demographics.address3))||ifnull(patient_demographics.address4,'',', '||UPPER(patient_demographics.address4))||ifnull(patient_demographics.postcode,'',', '||UPPER(patient_demographics.postcode))) Address, patient_demographics.birth_date DOB FROM JAC.patient_basic patient_basic, JAC.patient_demographics patient_demographics, JAC_System.PatientName patient_name WHERE patient_basic.lnkpid = patient_name.PatientId AND patient_demographics.lnkpid = patient_basic.lnkpid AND patient_name.NationalNo = '{PATIENTID}'

PTS 5.0.3.0 and older

If you are running a slightly older version of PTS the data source name will be hardcoded - PTSPAS - so you should locate this data source on the PTS server and either modify it, or replace it with a new data source while retaining the PTSPAS name. You are not able to modify the query yourself prior to PTS 5.0.3.1.

Much older versions of PTS had the patient record connection information embedded in a DLL file that cannot be modified. If this is the case you should contact us to arrange a PTS software update.

HL7

Patient lookup via HL7 message is also possible with a QBP Q21/K21 query/response as per the HL7 Specification (see pages 46 & 47).

PTS sends a QPD Q21 query, and expects a PID in the K21 response.

Application Settings

  • PASDSNS
    Set this to "HL7," followed by a list of listener IP addresses and ports in the format IP;PORT. e.g. HL7,192.168.1.0;1000,192.168.1.1;1000.
  • LOCALIDQRY
    Set this to the identifier that accompanies the local ID, if applicable. e.g. DN.
  • NATIDQRY
    Set this to the identifier that accompanies the national ID, if applicable. e.g. NHS.
  • COMPANY
    The organisation name gets included in the MSH. You can adjust this if your TIE requires it to be something specific.

Local ID usually refers to Hospital number, and National ID usually refers to NHS number.

HL7 Examples

Following are two examples of a Q21 query that might be sent by PTS to lookup a patient.

Local ID/Hospital Number

In this example, the user searched for Hospital Number "123456789". The Local ID Identifier has been configured to "DN" and the organisation name is "My NHS Trust" (see above):

MSH|^~\&|PTSWeb|Dispensary|PAS|My NHS Trust|20240221140617||QBP^Q21|381b7131-c9bf-4c43-ae08-bb6aec0ae438|P|2.4
QPD|Q21^Get Patient||123456789^^^DN^DN
RCP||1^RD

National ID/NHS Number

In this example, the user searched for NHS Number "123456789". The National ID Identifier has been configured to "NHS" and the organisation name is "My NHS Trust" (see above):

MSH|^~\&|PTSWeb|Dispensary|PAS|My NHS Trust|20240221142737||QBP^Q21|396236dd-ea41-4048-a328-10223a2c5912|P|2.4
QPD|Q21^Get Patient||123456789^^^NHS^NHS
RCP||1^RD

Example Response

A typical response may look like this:

MSH|^~\&|PAS|My NHS Trust|PTSWeb|Dispensary|20240321103803||RSP^K21^RSP_K21|0b0efc65-a100-41f1-1585-f7b02e6d6c87|P|2.4|||NE|NE|
MSA|AA|f1fe8462-a884-4e89-af9f-0b3c9e80353f|
QAK||OK|Q21^Get Patient|1|
QPD|Q21^Get Patient||CB02190122|
PID|1||CB02190122^^^REN^MRN||TIE^TESTING01^^^MS^^L||19490101000000|1|||PALM GROVE^^PRENTON^MERSEYSIDE^CH43 1TE^^H||01512222222^PRN^PH~07777777779^PRN^CP~CCCCCCCC@CCC.NHS^NET||||D|||||N||||||||N|
PD1|1||ABBEY SURGERY^^L83101|G9213263^RODGERS^PJ|