-
Notifications
You must be signed in to change notification settings - Fork 0
/
patDB.py
39 lines (30 loc) · 1.2 KB
/
patDB.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
from tinydb import TinyDB, where, Query
def createStudyTable():
db = TinyDB('database/db.json')
tableStudy = db.table('Study')
tableStudy.insert({'patName': 'Hasta adı', 'patID': '3333', 'patSex':'Cinsiyet', 'patAge':'Yaş',
'patBirthdate':'Doğum Tarihi', 'procedure':'Protokol', 'examDate':'Çekim Tarihi', 'origFile':'',
'importDatetime':'Yakalama zamanı', 'studyID':'tetkikNo', 'fileSHA':'1234567890', 'modality':'OT',
'operatorName':'Teknisyen', 'refPhys':'Gönderen Doktor', 'importTime':'11/04/2016 11:21:00',
'sentToPacs':'False', 'senTime':'', 'retries':'0'})
db.close()
def exist(SHA):
db = TinyDB('database/db.json')
tableStudy = db.table('Study')
study = Query()
result = tableStudy.contains(study.fileSHA == SHA)
db.close()
return result
def testQuery():
db = TinyDB('database/db.json')
tableStudy = db.table('Study')
study = Query()
pat = tableStudy.search(study.fileSHA == '12345')
res = pat[0]
print(res['examDate'])
db.close()
createStudyTable()
#print exist('123456789') db boşşa hata veriyor, yakala
#testQuery()
#createStudyTable()