-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lukas Drahnik <[email protected]>
- Loading branch information
Lukas Drahnik
committed
Aug 25, 2021
1 parent
169ddc7
commit 4585705
Showing
10 changed files
with
635 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
# pro-oc | ||
# PRO OC | ||
|
||
Rozšíření přidává užitečné funkce do modulu [Pacienti COVID-19](https://ereg.ksrzis.cz/Registr/CUDZadanky/VyhledaniPacienta) a [Žádanky testů COVID-19](https://eregpublicsecure.ksrzis.cz/Registr/CUD/Overeni). | ||
|
||
|
||
## Žádanky testů COVID-19 | ||
|
||
- Přidává tlačítko **Stáhnout certifikát** na stránku Overovani | ||
|
||
![Preview](preview/tlacitko_stahnout_certifikat.PNG) | ||
|
||
## Pacienti COVID-19 | ||
|
||
- Přidává tlačítko **Detail pacienta** na detail žádanky | ||
|
||
![Preview](preview/tlaciko_detail_pacienta.PNG) | ||
|
||
- Přidává tlačítko **Vyhledat moje žádanky** na detail pacienta do sekce **Žádanky a testy** | ||
|
||
![Preview](preview/tlacitko_vyhledat_moje_zadanky.PNG) | ||
|
||
- Přidává tlačítko **Stornovat žádanku** i na detail PCR žádanky se zaškrtnutým **Provedl jsem odběr** | ||
|
||
## Žádanky testů COVID-19 + Pacienti COVID-19 | ||
|
||
- Přidává možnost změnit přihlašovací údaje do aplikace [Tečka](https://ockodoc.mzcr.cz/napoveda/tecka/cz/) nebo [ocko.uzis.cz](https://ocko.uzis.cz/) | ||
|
||
![Preview](preview/moznost_ulozit_prihlasovaci_udaje_na_zadance.PNG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
function getEregRegistrDomain() { | ||
return "ereg.ksrzis.cz"; | ||
} | ||
|
||
function getEregRegistrUrl() { | ||
return "https://" + getEregRegistrDomain(); | ||
} | ||
|
||
function getRegistrCUDZadankyMojeZadankyEditaceUrlParams(ProvedenOdber) { | ||
var urlParams = new URLSearchParams(); | ||
urlParams.set("ProvedenOdber", ProvedenOdber); | ||
return urlParams; | ||
} | ||
|
||
function getRegistrCUDZadankyMojeZadankyEditaceUrl(CisloZadanky) { | ||
return getEregRegistrUrl() + "/Registr/CUDZadanky/MojeZadanky/Editace/" + CisloZadanky; | ||
} | ||
|
||
function getRegistrCUDVyhledaniPacientaUrl() { | ||
return getEregRegistrUrl() + "/Registr/CUDZadanky/VyhledaniPacienta"; | ||
} | ||
|
||
function getRegistrCUDVyhledaniPacientaUrlParams(zadanka) { | ||
var urlParams = new URLSearchParams(); | ||
urlParams.set("DuvodVyhledani", "VyhledatPacienta"); | ||
urlParams.set("TypVyhledani", zadanka.StatniPrislusnost == "CZ" ? "JmenoPrijmeniRC" : "CizinecJmenoPrijmeniDatumNarozniObcanstvi"); | ||
urlParams.set("Jmeno", zadanka.Jmeno); | ||
urlParams.set("Prijmeni", zadanka.Prijmeni); | ||
if(zadanka.StatniPrislusnost == "CZ") { | ||
urlParams.set("RodneCislo", zadanka.CisloPojistence); | ||
} else { | ||
urlParams.set("DatumNarozeni", zadanka.DatumNarozeni); | ||
urlParams.set("ZemeKod", zadanka.StatniPrislusnost); | ||
} | ||
urlParams.set("_submit", "None"); | ||
return urlParams; | ||
} | ||
|
||
function unsetProvedenOdber(Cislo, callback) { | ||
|
||
var urlParams = getRegistrCUDZadankyMojeZadankyEditaceUrlParams(false); | ||
var url = getRegistrCUDZadankyMojeZadankyEditaceUrl(Cislo); | ||
|
||
var xhr = new XMLHttpRequest(); | ||
xhr.open("POST", url, true); | ||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | ||
xhr.onreadystatechange = function() { | ||
if(xhr.readyState === XMLHttpRequest.DONE && xhr.status == 200) { | ||
callback(true); | ||
} | ||
} | ||
xhr.send(urlParams.toString()); | ||
} | ||
|
||
function stornoZadanka(Cislo, callback) { | ||
|
||
var url = getRegistrCUDZadankyMojeZadankyStornoUrl(Cislo); | ||
|
||
var xhr = new XMLHttpRequest(); | ||
xhr.open("POST", url, true); | ||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | ||
xhr.onreadystatechange = function() { | ||
if(xhr.readyState === XMLHttpRequest.DONE && xhr.status == 200) { | ||
callback(true); | ||
} | ||
} | ||
xhr.send(); | ||
} | ||
|
||
|
||
function loadOckoUzisPatientCredentials(zadanka, callback) { | ||
|
||
var url = getRegistrCUDVyhledaniPacientaUrl(); | ||
var urlParams = getRegistrCUDVyhledaniPacientaUrlParams(zadanka); | ||
|
||
var xhr = new XMLHttpRequest(); | ||
xhr.open("POST", url, true); | ||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | ||
xhr.onreadystatechange = function() { | ||
if(xhr.readyState === XMLHttpRequest.DONE && xhr.status == 200) { | ||
|
||
var parser = new DOMParser(); | ||
var responseDocument = parser.parseFromString(xhr.responseText,"text/html"); | ||
|
||
var results = {}; | ||
var labels = responseDocument.getElementsByTagName('label'); | ||
for (var i = 0; i < labels.length; i++) { | ||
switch(labels[i].htmlFor) { | ||
case 'Pacient_Telefon': | ||
results.Telefon = labels[i].nextElementSibling.innerText.trim(); | ||
break; | ||
case 'Pacient_Email': | ||
results.Email = labels[i].nextElementSibling.innerText.trim(); | ||
} | ||
} | ||
results.EditLink = xhr.responseURL.replace("Index", "Edit"); | ||
|
||
callback(results); | ||
} | ||
} | ||
xhr.send(urlParams.toString()); | ||
} | ||
|
||
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) { | ||
if (msg.text === 'OckoUzisPatientCredentials') { | ||
loadOckoUzisPatientCredentials(msg.data, Credentials => { | ||
sendResponse(Credentials); | ||
}); | ||
return true; | ||
} else if(msg.text === 'ZrusitProvedenOdber' && msg.data.Cislo) { | ||
unsetProvedenOdber(msg.data.Cislo, function(result) { | ||
sendResponse(result); | ||
}); | ||
return true; | ||
} else if(msg.text === 'StornoZadanka' && msg.data.Cislo) { | ||
stornoZadanka(msg.data.Cislo, function(result) { | ||
sendResponse(result); | ||
}); | ||
return true; | ||
} | ||
}); |
Oops, something went wrong.