master
Bas Kloosterman 2 years ago
parent b7fbd4a50a
commit f757e7ce52
  1. 9
      his/app/src/App.js
  2. 18
      his/app/src/Connections.js
  3. 4
      his/app/src/Home.js
  4. 26
      his/app/src/Index.css
  5. 11
      his/app/src/ManageConnection.js
  6. 23
      his/app/src/Patients.js
  7. 27
      his/main.go
  8. 31
      his/openapiclient.go

@ -1,6 +1,7 @@
import React from "react"; import React from "react";
import { import {
Link, Link,
NavLink,
Outlet, Outlet,
} from "react-router-dom"; } from "react-router-dom";
import "./Index.css"; import "./Index.css";
@ -8,9 +9,11 @@ const App = () => {
return ( return (
<div> <div>
<nav className="c-main-nav"> <nav className="c-main-nav">
<p style={{padding: 5, marginRight: 50}}>MYHIS</p> <p style={{marginRight: 50}}><Link to="/">MYHIS</Link></p>
<Link to="patienten">Patienten</Link> <div className="c-main-nav__main">
<Link to="connecties">Connecties</Link> <NavLink to="patienten">Patienten</NavLink>
<NavLink to="connecties">Verbindingen</NavLink>
</div>
</nav> </nav>
<div className="c-main-content"> <div className="c-main-content">
<Outlet/> <Outlet/>

@ -81,7 +81,8 @@ const Connections = () => {
return ( return (
<div> <div>
<Outlet/> <Outlet/>
<Link to="/connecties/nieuw" className="c-button">Nieuwe connectie</Link> <h1 className="t-page-header">Verbindingen</h1>
<Link to="/connecties/nieuw" className="c-button">Nieuwe verbinding</Link>
<table className="c-table"> <table className="c-table">
<thead> <thead>
<tr> <tr>
@ -89,7 +90,7 @@ const Connections = () => {
<th>Systeem</th> <th>Systeem</th>
<th>Leverancier</th> <th>Leverancier</th>
<th>Status</th> <th>Status</th>
<th>Actieve diensten</th> <th>Diensten</th>
<th>Acties</th> <th>Acties</th>
</tr> </tr>
</thead> </thead>
@ -100,11 +101,18 @@ const Connections = () => {
<td>{x.System ? x.System : 'Onbekend'}</td> <td>{x.System ? x.System : 'Onbekend'}</td>
<td>{x.Supplier ? x.Supplier : 'Onbekend'}</td> <td>{x.Supplier ? x.Supplier : 'Onbekend'}</td>
<td>{x.State == "pending" ? 'in afwachting' : 'actief'}</td> <td>{x.State == "pending" ? 'in afwachting' : 'actief'}</td>
<td>{x.Services.length ? x.Services.map((s) => { <td>{
x.State == "pending" ? "" : (
x.Services.length ? x.Services.map((s) => {
return <span style={{marginRight: 10}} key={s.ID}>{s.Name}</span> return <span style={{marginRight: 10}} key={s.ID}>{s.Name}</span>
}) : '-'}</td> }) : <Link style={{marginRight: 10}} to={`/connecties/${x.ID}`}>Beschikbare diensten</Link>
)}</td>
<td> <td>
{x.State == "pending" ? <Link to={`/connecties/${x.ID}/activeer`}>Activeer</Link> : <Link to={`/connecties/${x.ID}`}>Beheer</Link>} {x.State == "pending" ? (
<Link to={`/connecties/${x.ID}/activeer`}>Afronden verbinding</Link>
) : (
x.Services.length ? <Link to={`/connecties/${x.ID}`}>Beheer</Link> : <Link to={`/connecties/${x.ID}`}>Activeer</Link>
)}
</td> </td>
</tr>) </tr>)
})} })}

@ -3,7 +3,9 @@ import "./Index.css";
const App = () => { const App = () => {
return ( return (
<div></div> <div>
<h1 className="t-page-header">Welkom bij MYHIS</h1>
</div>
); );
}; };

@ -1,5 +1,5 @@
body { body {
font-family: helvetica; font-family: Helvetica, Arial, sans-serif;
} }
* { margin: 0; padding: 0; box-sizing: border-box; } * { margin: 0; padding: 0; box-sizing: border-box; }
@ -16,8 +16,20 @@ h2 {
box-shadow: 2px 2px 10px rgba(0,0,0,0.1); box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
} }
.c-main-nav__main {
display: flex;
justify-content: space-between;
flex:1;
}
.c-main-nav a {display: block; padding: 5px; color: #137ad4; text-decoration: none} .c-main-nav a {display: block; padding: 5px; color: #137ad4; text-decoration: none}
.c-main-nav p a {color: black}
.c-main-nav .active {font-weight:bold; text-decoration: underline}
.t-page-header {
margin-bottom: 50px;
}
.c-table { .c-table {
width: 100%; width: 100%;
} }
@ -46,7 +58,7 @@ h2 {
font-size: 95%; font-size: 95%;
color: white; color: white;
background-color: #137ad4; background-color: #137ad4;
border: 0; border: 1px solid #137ad4;
outline: 0; outline: 0;
cursor: pointer; cursor: pointer;
margin-bottom: 10px; margin-bottom: 10px;
@ -54,6 +66,13 @@ h2 {
text-decoration: none; text-decoration: none;
} }
.c-button--default {
background-color: white;
color: #137ad4;
}
.c-button--sm { .c-button--sm {
padding: 4px 8px; padding: 4px 8px;
font-size: 80%; font-size: 80%;
@ -106,7 +125,7 @@ h2 {
} }
.c-form-row { .c-form-row {
margin-bottom: 10px; margin-bottom: 15px;
} }
.c-input { .c-input {
@ -117,6 +136,7 @@ h2 {
display: block; display: block;
outline: none; outline: none;
font-size: 95%; font-size: 95%;
font-family: Helvetica, Arial, sans-serif;
} }
input:disabled { input:disabled {

@ -65,6 +65,7 @@ const ManageConnection = () => {
return ( return (
<div> <div>
<Outlet/> <Outlet/>
<h1 className="t-page-header">Verbinding</h1>
<table className="c-table"> <table className="c-table">
<thead> <thead>
<tr> <tr>
@ -86,8 +87,8 @@ const ManageConnection = () => {
<th>Omschrijving</th> <th>Omschrijving</th>
<th>Aanmeldpolicy</th> <th>Aanmeldpolicy</th>
<th>Toestemmingspolicy</th> <th>Toestemmingspolicy</th>
<th>Status</th> {!connection || connection.State == "pending" ? null : <th>Status</th>}
<th>Acties</th> {!connection || connection.State == "pending" ? null : <th>Acties</th>}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -98,8 +99,8 @@ const ManageConnection = () => {
<td>{x.description}</td> <td>{x.description}</td>
<td>{policy(x)}</td> <td>{policy(x)}</td>
<td>{needConsent(x) ? 'expliciet' : 'verondersteld'}</td> <td>{needConsent(x) ? 'expliciet' : 'verondersteld'}</td>
<td>{isActive(connection, x) ? 'actief' : 'inactief'}</td> {!connection || connection.State == "pending" ? null : (<td>{isActive(connection, x) ? 'actief' : 'inactief'}</td>)}
<td>{ {!connection || connection.State == "pending" ? null : (<td>{
isActive(connection, x) ? ( isActive(connection, x) ? (
<button <button
onClick={e => modService(false, connection, x)} onClick={e => modService(false, connection, x)}
@ -117,7 +118,7 @@ const ManageConnection = () => {
Activeer Activeer
</button> </button>
) )
}</td> }</td>)}
</tr>) </tr>)
}) })
} }

@ -4,7 +4,6 @@ import { Link, useParams, useLocation } from "react-router-dom";
import "./Index.css"; import "./Index.css";
import { policy, needConsent } from "./ManageConnection"; import { policy, needConsent } from "./ManageConnection";
import format from "date-fns/format"; import format from "date-fns/format";
import formatRelativeWithOptions from "date-fns/esm/fp/formatRelativeWithOptions/index";
const hasConsent = (patient, service) => { const hasConsent = (patient, service) => {
let consent = patient.Consent.filter(x => x.ServiceID == service.ServiceID)[0] let consent = patient.Consent.filter(x => x.ServiceID == service.ServiceID)[0]
@ -69,7 +68,7 @@ const DropDown = ({patient, services, updateSubscription, loading, saveConsent,
className="c-button c-button--sm" className="c-button c-button--sm"
onClick={e => e.preventDefault() || e.stopPropagation() || setOpen(true)} onClick={e => e.preventDefault() || e.stopPropagation() || setOpen(true)}
> >
Opties Aanmelden
</a> </a>
<div <div
className="c-dropdown__options" className="c-dropdown__options"
@ -102,7 +101,7 @@ const DropDown = ({patient, services, updateSubscription, loading, saveConsent,
e.stopPropagation() e.stopPropagation()
const enable = applyPolicy(e.target.checked, x) const enable = applyPolicy(e.target.checked, x)
updateSubscription(patient, x, enable) updateSubscription(patient, x, enable)
enable && setConsentId([patient, x]) enable && needConsent(x) && setConsentId([patient, x])
}} name="" id="" }} name="" id=""
/> {x.Name} {needConsent(x) ? <ConsentLink saveConsent={saveConsent} setConsentId={setConsentId} patient={patient} service={x}/> : null}</span> /> {x.Name} {needConsent(x) ? <ConsentLink saveConsent={saveConsent} setConsentId={setConsentId} patient={patient} service={x}/> : null}</span>
</label> </label>
@ -166,7 +165,7 @@ export const ConsentModal = ({loading, close, service, patient, saveConsent, rem
<input className="c-input" disabled={!consent.EnableBrochure} onChange={x => setConsent(Object.assign({}, consent, {Brochureversion: x.target.value}))} value={consent.Brochureversion} type="text"/> <input className="c-input" disabled={!consent.EnableBrochure} onChange={x => setConsent(Object.assign({}, consent, {Brochureversion: x.target.value}))} value={consent.Brochureversion} type="text"/>
</div> </div>
<div className="c-modal-buttons"> <div className="c-modal-buttons">
<button className="c-button" disabled={loading} onClick={async x => { <button className="c-button c-button--default" disabled={loading} onClick={async x => {
await removeConsent(Object.assign({}, consent)) await removeConsent(Object.assign({}, consent))
close() close()
}}>Toestemming intrekken</button> }}>Toestemming intrekken</button>
@ -251,18 +250,23 @@ const Patients = () => {
return ( return (
<div> <div>
<table className="c-table"> <h1 className="t-page-header">Patienten</h1>
<table className="c-table" style={{width: "initial"}}>
<thead> <thead>
<tr> <tr>
<th style={{width: 200}}>Naam</th>
<th style={{width: 200}}>Geboortedatum</th>
<th style={{width: 200}}>BSN</th>
<th>Acties</th> <th>Acties</th>
<th>Naam</th>
<th>Geboortedatum</th>
<th>BSN</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{patients.map(x => { {patients.map(x => {
return (<tr key={x.ID}> return (<tr key={x.ID}>
<td>{x.Name}</td>
<td>{x.Birthdate}</td>
<td>{x.ExternalId}</td>
<td> <td>
{services.length ? <DropDown {services.length ? <DropDown
updateSubscription={updateSubscription} updateSubscription={updateSubscription}
@ -273,9 +277,6 @@ const Patients = () => {
removeConsent={removeConsent} removeConsent={removeConsent}
/> : null} /> : null}
</td> </td>
<td>{x.Name}</td>
<td>{x.Birthdate}</td>
<td>{x.ExternalId}</td>
</tr>) </tr>)
})} })}
</tbody> </tbody>

@ -8,32 +8,23 @@ import (
"sync" "sync"
) )
var srvaddr = "localhost:8888" var localAddr = "0.0.0.0:8084"
var patientIf = "localhost:8084" var externalAddr = "http://localhost:8084"
func main() { func main() {
stop := make(chan os.Signal, 1) stop := make(chan os.Signal, 1)
signal.Notify(stop, os.Interrupt) signal.Notify(stop, os.Interrupt)
wg := &sync.WaitGroup{} wg := &sync.WaitGroup{}
// register(srvaddr) if os.Getenv("LOCAL_ADDR") != "" {
// fmt.Println("Enter ref: ") localAddr = os.Getenv("LOCAL_ADDR")
}
// // var then variable name then variable type if os.Getenv("EXT_ADDR") != "" {
// var ref string externalAddr = os.Getenv("EXT_ADDR")
}
// // Taking input from user srv := NewServer(localAddr)
// fmt.Scanln(&ref)
// fmt.Println("Enter psk: ")
// var psk string
// fmt.Scanln(&psk)
// complete(srvaddr, ref, psk)
// listMeta(srvaddr)
// enableService(srvaddr, "wbx:visitelijst")
// subscribePatients(srvaddr, "wbx:visitelijst", patients)
// listSubscriptions(srvaddr, "wbx:visitelijst")
srv := NewServer(patientIf)
srv.LoadData("./data/data.db") srv.LoadData("./data/data.db")
go func() { go func() {

@ -213,7 +213,7 @@ func (srv *HISServer) enableService(conn *model.Connection, service string, acti
Fetch: &openkv.ServiceConfig{ Fetch: &openkv.ServiceConfig{
Protocol: "https://whiteboxsystems.nl/protospecs/whitebox-fetch/http", Protocol: "https://whiteboxsystems.nl/protospecs/whitebox-fetch/http",
Config: map[string]string{ Config: map[string]string{
"url": "http://localhost:8084/external/api", "url": externalAddr + "/external/api",
}, },
Auth: &openkv.AuthConfig{ Auth: &openkv.AuthConfig{
Method: openkv.AuthMethod_APIToken, Method: openkv.AuthMethod_APIToken,
@ -222,7 +222,30 @@ func (srv *HISServer) enableService(conn *model.Connection, service string, acti
Push: &openkv.ServiceConfig{ Push: &openkv.ServiceConfig{
Protocol: "https://whiteboxsystems.nl/protospecs/whitebox-push/http", Protocol: "https://whiteboxsystems.nl/protospecs/whitebox-push/http",
Config: map[string]string{ Config: map[string]string{
"url": "http://localhost:8084/external/api", "url": externalAddr + "/external/api",
},
Auth: &openkv.AuthConfig{
Method: openkv.AuthMethod_APIToken,
},
},
})
} else if m, _ := regexp.MatchString("voorbeeld:*", service); m { // Kis
resp, err = client.ConfigService(context.Background(), &openkv.ConfigServiceRequest{
Service: service,
Enabled: active,
Fetch: &openkv.ServiceConfig{
Protocol: "https://whiteboxsystems.nl/protospecs/whitebox-fetch/http",
Config: map[string]string{
"url": externalAddr + "/external/api",
},
Auth: &openkv.AuthConfig{
Method: openkv.AuthMethod_APIToken,
},
},
Push: &openkv.ServiceConfig{
Protocol: "https://whiteboxsystems.nl/protospecs/whitebox-push/http",
Config: map[string]string{
"url": externalAddr + "/external/api",
}, },
Auth: &openkv.AuthConfig{ Auth: &openkv.AuthConfig{
Method: openkv.AuthMethod_APIToken, Method: openkv.AuthMethod_APIToken,
@ -236,7 +259,7 @@ func (srv *HISServer) enableService(conn *model.Connection, service string, acti
Fetch: &openkv.ServiceConfig{ Fetch: &openkv.ServiceConfig{
Protocol: "https://hl7.org/fhir", Protocol: "https://hl7.org/fhir",
Config: map[string]string{ Config: map[string]string{
"url": "http://localhost:8084/external/fhir/Patient", "url": externalAddr + "/external/fhir/Patient",
}, },
Auth: &openkv.AuthConfig{ Auth: &openkv.AuthConfig{
Method: openkv.AuthMethod_APIToken, Method: openkv.AuthMethod_APIToken,
@ -245,7 +268,7 @@ func (srv *HISServer) enableService(conn *model.Connection, service string, acti
Push: &openkv.ServiceConfig{ Push: &openkv.ServiceConfig{
Protocol: "https://hl7.org/fhir", Protocol: "https://hl7.org/fhir",
Config: map[string]string{ Config: map[string]string{
"url": "http://localhost:8084/external/fhir/Patient", "url": externalAddr + "/external/fhir/Patient",
}, },
Auth: &openkv.AuthConfig{ Auth: &openkv.AuthConfig{
Method: openkv.AuthMethod_APIToken, Method: openkv.AuthMethod_APIToken,

Loading…
Cancel
Save