Mercurial > hgweb > health
changeset 3219:f600a8a3db44
Task #15167: Only update unset local patient
| author | Chris Zimmerman <chris@teffalump.com> |
|---|---|
| date | Wed, 20 Feb 2019 09:36:28 -0800 |
| parents | eb0ea4b8b795 |
| children | 48c32daa1a49 |
| files | tryton/health_orthanc/health_orthanc.py |
| diffstat | 1 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health_orthanc/health_orthanc.py +++ b/tryton/health_orthanc/health_orthanc.py @@ -241,14 +241,17 @@ patient.name = entry["name"] patient.bd = entry["bd"] patient.ident = entry["ident"] - try: - g_patient = Patient.search( - [("puid", "=", entry["ident"])], limit=1 - )[0] - patient.patient = g_patient - logger.info("New Matching PUID found for {}".format(entry["uuid"])) - except: - pass + if not patient.patient: # don't update unless no patient attached + try: + g_patient = Patient.search( + [("puid", "=", entry["ident"])], limit=1 + )[0] + patient.patient = g_patient + logger.info( + "New Matching PUID found for {}".format(entry["uuid"]) + ) + except: + pass updates.append(patient) logger.info("Updating {}".format(entry["ident"])) except:
