Patient Record (PAS) Lookup

From TMS Support Wiki
Revision as of 12:53, 21 February 2024 by Shieldstromme (talk | contribs) (→‎HL7)
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 in the return message, if applicable. e.g. DN.
  • NATIDQRY
    Set this to the identifier that accompanies the national ID in the return message, if applicable. e.g. NHS.

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

HL7 Example

Following is an example of a Q21/K21 query/response pair of messages. First is the query:

MSH|^~\&|CLINREG|WESTCLIN|HOSPMPI|HOSP|199912121135-0600||QBP^Q21^QBP_Q21|1|D|2.5
QPD|Q21^Get Person Demographics^HL7nnn|111069|112234^^^GOOD HEALTH HOSPITAL|^^^ GOOD HEALTH HOSPITAL~^^^SOUTH LAB|
RCP|I|

This query is asking for demographics for the person identified by the identifier 112234 from the assigning authority GOOD HEALTH HOSPITAL. With the demographics, we want identifiers returned for the person from the assigning authorities GOOD HEALTH HOSPITAL and SOUTH LAB. Here is a sample response:

MSH|^~\&|HOSPMPI|HOSP|CLINREG|WESTCLIN|199912121135-0600||RSP^K21^RSP_K21|1|D|2.5|
MSA|AA|8699|
QAK|111069|OK|Q21^Get Person Demographics^HL7nnn|1|
QPD|Q21^GetPerson Demographics^HL7nnn|111069|112234^^^GOOD HEALTH HOSPITAL|^^^ GOOD HEALTH HOSPITAL~^^^SOUTH LAB|
PID|||112234^^^GOOD HEALTH HOSPITAL~98223^^^SOUTH LAB||Everyman^Adam||19600614|M||C|2101 Webster # 106^^Oakland^CA^94612|
QRI|100|