Intake FR

Intkae inladen voor FR

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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);
})();