notebook
This commit is contained in:
227
Testy/14 Testy updateat.py
Normal file
227
Testy/14 Testy updateat.py
Normal file
@@ -0,0 +1,227 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import requests
|
||||
from pathlib import Path
|
||||
import json
|
||||
|
||||
TOKEN_PATH = Path("token.txt")
|
||||
CLINIC_SLUG = "mudr-buzalkova"
|
||||
BATCH_SIZE = 100
|
||||
|
||||
# přesně tvůj původní dotaz, beze změn
|
||||
# GRAPHQL_QUERY = r"""
|
||||
# query ClinicRequestGrid_ListPatientRequestsForClinic2(
|
||||
# $clinicSlug: String!,
|
||||
# $queueId: String,
|
||||
# $queueAssignment: QueueAssignmentFilter!,
|
||||
# $pageInfo: PageInfo!,
|
||||
# $locale: Locale!,
|
||||
# $state: PatientRequestState
|
||||
# ) {
|
||||
# requestsResponse: listPatientRequestsForClinic2(
|
||||
# clinicSlug: $clinicSlug,
|
||||
# queueId: $queueId,
|
||||
# queueAssignment: $queueAssignment,
|
||||
# pageInfo: $pageInfo,
|
||||
# state: $state
|
||||
# ) {
|
||||
# count
|
||||
# patientRequests {
|
||||
# id
|
||||
# displayTitle(locale: $locale)
|
||||
# createdAt
|
||||
# updatedAt
|
||||
# doneAt
|
||||
# removedAt
|
||||
# extendedPatient {
|
||||
# name
|
||||
# surname
|
||||
# identificationNumber
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# """
|
||||
GRAPHQL_QUERY = r"""
|
||||
query ClinicRequestGrid_ListPatientRequestsForClinic2(
|
||||
$clinicSlug: String!,
|
||||
$queueId: String,
|
||||
$queueAssignment: QueueAssignmentFilter!,
|
||||
$state: PatientRequestState,
|
||||
$pageInfo: PageInfo!,
|
||||
$locale: Locale!
|
||||
) {
|
||||
requestsResponse: listPatientRequestsForClinic2(
|
||||
clinicSlug: $clinicSlug
|
||||
queueId: $queueId
|
||||
queueAssignment: $queueAssignment
|
||||
state: $state
|
||||
pageInfo: $pageInfo
|
||||
) {
|
||||
count
|
||||
patientRequests {
|
||||
id
|
||||
displayTitle(locale: $locale)
|
||||
|
||||
### TIME FIELDS ADDED
|
||||
createdAt
|
||||
updatedAt
|
||||
doneAt
|
||||
removedAt
|
||||
|
||||
extendedPatient {
|
||||
id
|
||||
identificationNumber
|
||||
name
|
||||
surname
|
||||
kind
|
||||
key
|
||||
type
|
||||
user {
|
||||
id
|
||||
name
|
||||
surname
|
||||
}
|
||||
owner {
|
||||
name
|
||||
surname
|
||||
}
|
||||
dob
|
||||
premiumPlanPatient {
|
||||
id
|
||||
premiumPlan {
|
||||
id
|
||||
}
|
||||
}
|
||||
status2
|
||||
tags(onlyImportant: true) {
|
||||
id
|
||||
}
|
||||
isUnknownPatient
|
||||
}
|
||||
|
||||
invoice {
|
||||
id
|
||||
status
|
||||
amount
|
||||
currency
|
||||
dueAmount
|
||||
isOverdue
|
||||
refundedAmount
|
||||
settledAmount
|
||||
}
|
||||
|
||||
lastMessage {
|
||||
createdAt
|
||||
id
|
||||
readAt
|
||||
sender {
|
||||
id
|
||||
name
|
||||
surname
|
||||
clinicId
|
||||
}
|
||||
text
|
||||
}
|
||||
|
||||
priority
|
||||
|
||||
queue {
|
||||
id
|
||||
name
|
||||
clinicPatientRequestQueueUsers {
|
||||
accountable {
|
||||
id
|
||||
name
|
||||
surname
|
||||
}
|
||||
id
|
||||
}
|
||||
}
|
||||
|
||||
reservations {
|
||||
calendar {
|
||||
id
|
||||
internalName
|
||||
name
|
||||
}
|
||||
id
|
||||
canceledAt
|
||||
done
|
||||
start
|
||||
}
|
||||
|
||||
tags(onlyImportant: true) {
|
||||
id
|
||||
}
|
||||
|
||||
userECRF(locale: $locale) {
|
||||
id
|
||||
sid
|
||||
icon {
|
||||
color
|
||||
id
|
||||
urlSvg
|
||||
}
|
||||
ecrfSet {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
|
||||
priceWhenCreated
|
||||
currencyWhenCreated
|
||||
createdByDoctor
|
||||
eventType
|
||||
clinicNotes {
|
||||
id
|
||||
}
|
||||
clinicMedicalRecord
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
def read_token(path: Path) -> str:
|
||||
tok = path.read_text(encoding="utf-8").strip()
|
||||
if tok.startswith("Bearer "):
|
||||
tok = tok.split(" ", 1)[1]
|
||||
return tok
|
||||
|
||||
|
||||
def main():
|
||||
token = read_token(TOKEN_PATH)
|
||||
headers = {
|
||||
"Authorization": f"Bearer {token}",
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
}
|
||||
|
||||
variables = {
|
||||
"clinicSlug": CLINIC_SLUG,
|
||||
"queueId": None,
|
||||
"queueAssignment": "ANY",
|
||||
"pageInfo": {"first": BATCH_SIZE, "offset": 0},
|
||||
"locale": "cs",
|
||||
"state": "ACTIVE",
|
||||
}
|
||||
|
||||
payload = {
|
||||
"operationName": "ClinicRequestGrid_ListPatientRequestsForClinic2",
|
||||
"query": GRAPHQL_QUERY,
|
||||
"variables": variables,
|
||||
}
|
||||
|
||||
print("\n===== ČISTÁ ODPOVĚĎ SERVERU =====\n")
|
||||
|
||||
r = requests.post("https://api.medevio.cz/graphql", json=payload, headers=headers, timeout=30)
|
||||
|
||||
print(f"HTTP {r.status_code}\n")
|
||||
print(r.text) # <-- TISK NEUPRAVENÉHO JSONU
|
||||
|
||||
print("\n===== KONEC ČISTÉ ODPOVĚDI =====\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user