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.

By far the most popular choice is to connect PTS to the JAC/WellSky/CMM or Ascribe/EMIS database, and our technician will have created this link for you during installation if the option was available to them.

When the patient record database is moved or modified (e.g. as part of an upgrade or server decommission) the link between PTS and the patient record database will be broken.

It's worth pointing out that PTS remains usable even if the patient lookup goes down - users can just enter patient details manually.

PTS 5.0.3.1 and newer

Starting in PTS 5.0.3.1, the PAS link information is stored in Application Settings and is modifiable by a system administrator. The relevant settings are as follows:

  • 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.
  • LOCALIDQRY
    Query used by booking-in screen when searching for a patient using localID.
  • 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.
  • NATIDQRY
    Query used by booking-in screen when searching for a patient using nationalID.
  • 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.

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

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.

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. With T-SQL use an "AS" command to rename columns with an alias; with InterSystems SQL simply type the alias after the field name. 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.

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.