<!doctype html>

<html lang="ru">

<head>

<meta charset="utf-8"/>

<meta name="viewport" content="width=device-width, initial-scale=1"/>

<title>BARYTAN FREE DEMO</title>


<style>

body{font-family:Arial;max-width:900px;margin:40px auto;padding:0 20px}

h1{margin-bottom:20px}

textarea{width:100%;min-height:150px;padding:10px;border-radius:8px;border:1px solid #ccc}

button{margin-top:10px;padding:10px 15px;border-radius:8px;border:1px solid #ccc;cursor:pointer}

pre{background:#111;color:#0f0;padding:12px;border-radius:10px;margin-top:15px}

</style>

</head>


<body>


<h1>BARYTAN FREE DEMO</h1>


<textarea id="inputText" placeholder="Пациент жалуется на боль в горле 3 дня, температура 38. Назначен ибупрофен."></textarea>

<br>

<button id="extract">Run Extract</button>


<pre id="jsonOut">{}</pre>


<script>

function extractSOAP(text){

const complaint=text.match(/жалует(?:ся)? на ([^.\n]+)/i);

const duration=text.match(/\d+\s*(дн|дня|дней|нед|недели|час|часа)/i);

const temp=text.match(/температур[^.\n]*/i);

const plan=text.match(/назначен[ао]? ([^.\n]+)/i);


return{

templateId:"soap",

data:{

chief_complaint:complaint?complaint[1]:null,

history:duration?duration[0]:null,

objective:temp?temp[0]:null,

assessment:null,

plan:plan?plan[1]:null

}

};

}


document.getElementById("extract").onclick=function(){

const text=document.getElementById("inputText").value;

const result=extractSOAP(text);

document.getElementById("jsonOut").textContent=JSON.stringify(result,null,2);

};

</script>


</body>

</html>