Intake FR

Intkae inladen voor FR

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Intake FR
// @namespace    http://tampermonkey.net/
// @version      1.3.0
// @description  Intkae inladen voor FR
// @match        *://*/*
// @grant        none

// ==/UserScript==

// ⚠️ VEROUDERD: Dit script is verouderd en wordt niet meer onderhouden.
// De API-koppeling (whisper.anzwerz.ai) is verwijderd; gebruik een nieuwere versie indien beschikbaar.

(function() {
    'use strict';
    window.addEventListener('load', function() {

    function getPatientName() {

        // Pak de derde frame (index 2) uit het frameset
        const h3 = document.querySelector('h3.patient-card__name');
        if (h3){
            const patientName = h3.textContent;

            if (patientName) {
                console.log(patientName)
                return patientName.split(",")[0]
            }
        }

        return null
    }


    function storeConsultDate(){
        const datumEl = document.getElementById('frm_input_indication_date_datepicker');
        if (datumEl){
            console.log("element gevonden");
            const delen = datumEl.value.split(/[-/]/);
            const [dag, maand, jaar] = delen;
            const nieuweDatum = `${jaar}-${maand}-${dag}`;
            
            sessionStorage.setItem('consultDate', nieuweDatum);

        }
    }
    
    const patientName = getPatientName();
    storeConsultDate()
    const dateConsult = sessionStorage.getItem('consultDate');


    if (patientName === null){
        console.log("kan patiëntnaam niet vinden");
    } else if (dateConsult == null) {
        console.log("kan datum niet vinden");
        
    } else {
        console.log("haal data op");
        // Fetches naar whisper.anzwerz.ai verwijderd
    }

    function checkveld (el, input, checkboxValue=null) {
        if (!el) return { status: 'element niet gevonden', succes: false };

        if (el.tagName === 'TEXTAREA'){
            if (el.innerHTML){
                if (el.innerHTML.trim().replace(/\s+/g, '')  !== input.trim().replace(/\s+/g, '') ) return {
                    status: 'niet goed ingevuld', 
                    succes: false,
                    ingevuld: el.innerHTML.trim().replace(/\s+/g, ''),
                    opgehaald: input.trim().replace(/\s+/g, '')
                }
        }
        } else if (el.tagName === 'INPUT' && el.type === 'checkbox'){
            if (input) { 
                if (el.checked !== (input.toLowerCase() === checkboxValue.toLowerCase())) return {
                    status: 'niet goed ingevuld', 
                    succes: false,
                    ingevuld: el.checked,
                    opgehaald: input.toLowerCase(),
                    checkbox_waarde: checkboxValue.toLowerCase()
                }
            }
        } else if (el.tagName === 'INPUT' && el.type === 'date'){
            if (el.value && el.value !== input) return {
                status: 'niet goed ingevuld', 
                succes: false,
                ingevuld: el.value,
                opgehaald: input
            }
        } else if (el.tagName === 'INPUT' && el.type === 'text'){
            if (el.getAttribute('data-slider') === 'true') {
                if (el !== input) return {
                    status: 'niet goed ingevuld', 
                    succes: false,
                    ingevuld: el,
                    opgehaald: input
                }
            } else {
                if (el.value !== input) return {
                    status: 'niet goed ingevuld', 
                    succes: false,
                    ingevuld: el.value,
                    opgehaald: input
                }
            }
        } else if (el.tagName === 'SELECT') {
            if (el.value && el.value !== input) return { 
                status: 'niet goed ingevuld', 
                succes: false,
                ingevuld: el.value,
                opgehaald: input
            };
        } else if (el.tagName === 'INPUT' && el.type === 'radio') {

            if (input) { 
                if (el.checked !== (input.toLowerCase() === checkboxValue.toLowerCase())) return {
                    status: 'niet goed ingevuld', 
                    succes: false,
                    ingevuld: el.checked,
                    opgehaald: input.toLowerCase(),
                    checkbox_waarde: checkboxValue.toLowerCase()
                }
            }
        }

        return {status: 'ok', succes: true}
        
    }

    function sendReport(rapport, title){
        const allesOK = Object.values(rapport).every(v => v.status === 'ok' && v.succes === true);
        console.log(allesOK);
        console.log(new Date().toISOString());
        console.log(allesOK ? 'succes' : 'fouten');
        console.log(rapport);
        console.log(patientName);
        // Feedback-fetch naar whisper.anzwerz.ai verwijderd
    }

    function sendError(err){
        console.error("❌ Fout bij ophalen of verwerken van data:", err);
        // Error-log fetch naar whisper.anzwerz.ai verwijderd
    }

}, false);
})();