@mbehenri/openmrs-esm-opentms-meet-app 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +57 -0
- package/.husky/pre-commit +7 -0
- package/.husky/pre-push +6 -0
- package/.prettierignore +14 -0
- package/.turbo.json +18 -0
- package/.yarn/install-state.gz +0 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
- package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
- package/.yarn/releases/yarn-3.6.1.cjs +874 -0
- package/.yarnrc.yml +9 -0
- package/LICENSE +401 -0
- package/README.md +26 -0
- package/__mocks__/react-i18next.js +55 -0
- package/e2e/README.md +115 -0
- package/e2e/core/global-setup.ts +32 -0
- package/e2e/core/index.ts +1 -0
- package/e2e/core/test.ts +20 -0
- package/e2e/fixtures/api.ts +26 -0
- package/e2e/fixtures/index.ts +1 -0
- package/e2e/pages/home-page.ts +9 -0
- package/e2e/pages/index.ts +1 -0
- package/e2e/specs/sample-test.spec.ts +11 -0
- package/e2e/support/github/Dockerfile +34 -0
- package/e2e/support/github/docker-compose.yml +24 -0
- package/e2e/support/github/run-e2e-docker-env.sh +49 -0
- package/example.env +6 -0
- package/i18next-parser.config.js +89 -0
- package/jest.config.js +31 -0
- package/package.json +108 -0
- package/playwright.config.ts +32 -0
- package/src/Extensions/AppointmentTabExt.tsx +23 -0
- package/src/Extensions/DemandTabExt.tsx +14 -0
- package/src/Extensions/MeetIframeExt.tsx +14 -0
- package/src/Extensions/ValidateDemandFormExt.tsx +14 -0
- package/src/assets/img/Logo-texte.png +0 -0
- package/src/assets/img/Logo-texte.sim.white.png +0 -0
- package/src/assets/img/Logo-texte.white.png +0 -0
- package/src/assets/img/Logo.png +0 -0
- package/src/assets/img/favicon.ico +0 -0
- package/src/components/Appointment/index.scss +91 -0
- package/src/components/Appointment/index.tsx +207 -0
- package/src/components/Appointment/menu.scss +7 -0
- package/src/components/Appointment/menu.tsx +48 -0
- package/src/components/Appointment/tab.tsx +162 -0
- package/src/components/Demand/form.scss +19 -0
- package/src/components/Demand/form.tsx +236 -0
- package/src/components/Demand/index.tsx +0 -0
- package/src/components/Demand/tab.scss +145 -0
- package/src/components/Demand/tab.tsx +315 -0
- package/src/components/EmptyLayout/index.scss +69 -0
- package/src/components/EmptyLayout/index.tsx +32 -0
- package/src/components/MeetIframe/index.scss +56 -0
- package/src/components/MeetIframe/index.tsx +117 -0
- package/src/config-schema.ts +45 -0
- package/src/dashboard.meta.ts +12 -0
- package/src/declarations.d.ts +6 -0
- package/src/index.ts +75 -0
- package/src/pages/home/home.component.tsx +8 -0
- package/src/privileges/doctor.ts +213 -0
- package/src/repositories/Opencare/index.ts +12 -0
- package/src/repositories/Opencare/prodRepository.ts +176 -0
- package/src/repositories/Opencare/repository.ts +34 -0
- package/src/repositories/TypeRepository.ts +1 -0
- package/src/repositories/env.ts +7 -0
- package/src/repositories/errors.ts +13 -0
- package/src/root.component.tsx +46 -0
- package/src/root.scss +15 -0
- package/src/root.test.tsx +54 -0
- package/src/routes.json +44 -0
- package/src/services/doctor.ts +165 -0
- package/src/setup-tests.ts +1 -0
- package/src/utils.ts +41 -0
- package/translations/en.json +1 -0
- package/translations/es.json +24 -0
- package/translations/fr.json +24 -0
- package/translations/he.json +24 -0
- package/translations/km.json +24 -0
- package/tsconfig.json +24 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import styles from "./index.scss";
|
|
3
|
+
import logo from "../../assets/img/Logo.png";
|
|
4
|
+
|
|
5
|
+
interface MeetIframeProps {
|
|
6
|
+
username: string;
|
|
7
|
+
token: string;
|
|
8
|
+
url: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const MeetIframe: React.FC<MeetIframeProps> = ({
|
|
12
|
+
url,
|
|
13
|
+
token,
|
|
14
|
+
username,
|
|
15
|
+
}) => {
|
|
16
|
+
const iframeRef = useRef<HTMLIFrameElement>(null);
|
|
17
|
+
|
|
18
|
+
const [showPreloader, setShowPreloader] = useState(false);
|
|
19
|
+
const [needContinue, setNeedContinue] = useState(true);
|
|
20
|
+
|
|
21
|
+
const handleLogin = useCallback(
|
|
22
|
+
async (iframe: HTMLIFrameElement) => {
|
|
23
|
+
try {
|
|
24
|
+
const iframeWindow = iframe.contentWindow;
|
|
25
|
+
if (!iframeWindow) {
|
|
26
|
+
console.error("Impossible d'accéder à la fenêtre de l'iframe.");
|
|
27
|
+
setShowPreloader(false);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const iframeDocument = iframeWindow.document;
|
|
32
|
+
|
|
33
|
+
const isLoggedIn = iframeDocument.querySelector(".user-menu");
|
|
34
|
+
if (isLoggedIn) {
|
|
35
|
+
//console.log("Utilisateur déjà connecté.");
|
|
36
|
+
//setShowPreloader(false);
|
|
37
|
+
return; // Pas besoin de soumettre le formulaire
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const userInput = iframeDocument.querySelector(
|
|
41
|
+
'input[name="user"]'
|
|
42
|
+
) as HTMLInputElement | null;
|
|
43
|
+
const passwordInput = iframeDocument.querySelector(
|
|
44
|
+
'input[name="password"]'
|
|
45
|
+
) as HTMLInputElement | null;
|
|
46
|
+
const loginForm = iframeDocument.querySelector(
|
|
47
|
+
"form"
|
|
48
|
+
) as HTMLFormElement | null;
|
|
49
|
+
|
|
50
|
+
if (userInput && passwordInput && loginForm) {
|
|
51
|
+
userInput.value = username;
|
|
52
|
+
passwordInput.value = token;
|
|
53
|
+
|
|
54
|
+
// Attendre 3 secondes avant de soumettre le formulaire
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
loginForm.submit();
|
|
57
|
+
// eslint-disable-next-line no-console
|
|
58
|
+
console.log("Formulaire de connexion soumis.");
|
|
59
|
+
}, 3000); // Délai de 3 secondes
|
|
60
|
+
//console.log('username', userInput.value, 'password', passwordInput.value);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.error("Erreur lors de l'accès au contenu de l'iframe :", error);
|
|
65
|
+
}
|
|
66
|
+
//setShowPreloader(false);
|
|
67
|
+
},
|
|
68
|
+
[token, username]
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const handleLoad = useCallback(
|
|
72
|
+
async (iframe: HTMLIFrameElement) => {
|
|
73
|
+
if (needContinue) {
|
|
74
|
+
await handleLogin(iframe).finally(() => setNeedContinue(false));
|
|
75
|
+
}
|
|
76
|
+
setShowPreloader(false);
|
|
77
|
+
},
|
|
78
|
+
[handleLogin, needContinue]
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const iframe = iframeRef.current;
|
|
83
|
+
if (iframe) {
|
|
84
|
+
setShowPreloader(true);
|
|
85
|
+
const load = () => handleLoad(iframe);
|
|
86
|
+
|
|
87
|
+
// Associer l'événement de chargement
|
|
88
|
+
iframe.addEventListener("load", load);
|
|
89
|
+
|
|
90
|
+
// Nettoyage de l'événement lors du démontage du composant
|
|
91
|
+
return () => {
|
|
92
|
+
iframe.removeEventListener("load", load);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}, [handleLoad]);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<div className={styles.contentViewWrapper}>
|
|
99
|
+
<div
|
|
100
|
+
className={styles.preloader}
|
|
101
|
+
style={{ display: showPreloader ? "flex" : "none" }}
|
|
102
|
+
>
|
|
103
|
+
<span className={styles.spinner}></span>
|
|
104
|
+
<img src={logo} alt="opencare logo" className="logo" />
|
|
105
|
+
</div>
|
|
106
|
+
<iframe
|
|
107
|
+
ref={iframeRef}
|
|
108
|
+
className={styles.viewer}
|
|
109
|
+
title="Web Meeting"
|
|
110
|
+
src={url}
|
|
111
|
+
allow="camera;microphone"
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export default MeetIframe;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Type, validator } from "@openmrs/esm-framework";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is the config schema. It expects a configuration object which
|
|
5
|
+
* looks like this:
|
|
6
|
+
*
|
|
7
|
+
* ```json
|
|
8
|
+
* { "casualGreeting": true, "whoToGreet": ["Mom"] }
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* In OpenMRS Microfrontends, all config parameters are optional. Thus,
|
|
12
|
+
* all elements must have a reasonable default. A good default is one
|
|
13
|
+
* that works well with the reference application.
|
|
14
|
+
*
|
|
15
|
+
* To understand the schema below, please read the configuration system
|
|
16
|
+
* documentation:
|
|
17
|
+
* https://openmrs.github.io/openmrs-esm-core/#/main/config
|
|
18
|
+
* Note especially the section "How do I make my module configurable?"
|
|
19
|
+
* https://openmrs.github.io/openmrs-esm-core/#/main/config?id=im-developing-an-esm-module-how-do-i-make-it-configurable
|
|
20
|
+
* and the Schema Reference
|
|
21
|
+
* https://openmrs.github.io/openmrs-esm-core/#/main/config?id=schema-reference
|
|
22
|
+
*/
|
|
23
|
+
export const configSchema = {
|
|
24
|
+
API_USER: {
|
|
25
|
+
_type: Type.String,
|
|
26
|
+
_default: "admin",
|
|
27
|
+
_description: 'API user used',
|
|
28
|
+
},
|
|
29
|
+
API_PASSWORD: {
|
|
30
|
+
_type: Type.String,
|
|
31
|
+
_default: "Admin123",
|
|
32
|
+
_description: 'API password used',
|
|
33
|
+
},
|
|
34
|
+
API_BASE_URL: {
|
|
35
|
+
_type: Type.String,
|
|
36
|
+
_default: "http://localhost:8000",
|
|
37
|
+
_description: 'API base url',
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type Config = {
|
|
42
|
+
API_USER: string,
|
|
43
|
+
API_PASSWORD: string,
|
|
44
|
+
API_BASE_URL: string,
|
|
45
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the entrypoint file of the application. It communicates the
|
|
3
|
+
* important features of this microfrontend to the app shell. It
|
|
4
|
+
* connects the app shell to the React application(s) that make up this
|
|
5
|
+
* microfrontend.
|
|
6
|
+
*/
|
|
7
|
+
import { getAsyncLifecycle, defineConfigSchema, getSyncLifecycle } from "@openmrs/esm-framework";
|
|
8
|
+
import { configSchema } from "./config-schema";
|
|
9
|
+
import Root from "./root.component";
|
|
10
|
+
import DemandTabExt from "./Extensions/DemandTabExt";
|
|
11
|
+
import AppointmentTabExt from "./Extensions/AppointmentTabExt";
|
|
12
|
+
import MeetIframeExt from "./Extensions/MeetIframeExt";
|
|
13
|
+
import { ValidateDemandFormExt } from "./Extensions/ValidateDemandFormExt";
|
|
14
|
+
|
|
15
|
+
const moduleName = "@openmrs/esm-opencare-app";
|
|
16
|
+
|
|
17
|
+
const options = {
|
|
18
|
+
featureName: "opencare",
|
|
19
|
+
moduleName,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* This tells the app shell how to obtain translation files: that they
|
|
24
|
+
* are JSON files in the directory `../translations` (which you should
|
|
25
|
+
* see in the directory structure).
|
|
26
|
+
*/
|
|
27
|
+
export const importTranslation = require.context(
|
|
28
|
+
"../translations",
|
|
29
|
+
false,
|
|
30
|
+
/.json$/,
|
|
31
|
+
"lazy"
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* This function performs any setup that should happen at microfrontend
|
|
36
|
+
* load-time (such as defining the config schema) and then returns an
|
|
37
|
+
* object which describes how the React application(s) should be
|
|
38
|
+
* rendered.
|
|
39
|
+
*/
|
|
40
|
+
export function startupApp() {
|
|
41
|
+
defineConfigSchema(moduleName, configSchema);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* This named export tells the app shell that the default export of `root.component.tsx`
|
|
46
|
+
* should be rendered when the route matches `root`. The full route
|
|
47
|
+
* will be `openmrsSpaBase() + 'root'`, which is usually
|
|
48
|
+
* `/openmrs/spa/opencare`.
|
|
49
|
+
*/
|
|
50
|
+
/* export const root = getSyncLifecycle(
|
|
51
|
+
Root,
|
|
52
|
+
options
|
|
53
|
+
); */
|
|
54
|
+
|
|
55
|
+
export const root = getSyncLifecycle(Root, options);
|
|
56
|
+
|
|
57
|
+
export const demandtab = getSyncLifecycle(
|
|
58
|
+
DemandTabExt,
|
|
59
|
+
options
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
export const appointmenttab = getSyncLifecycle(
|
|
63
|
+
AppointmentTabExt,
|
|
64
|
+
options
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
export const meetiframe = getSyncLifecycle(
|
|
68
|
+
MeetIframeExt,
|
|
69
|
+
options
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
export const validatedemandform = getSyncLifecycle(
|
|
73
|
+
ValidateDemandFormExt,
|
|
74
|
+
options
|
|
75
|
+
);
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
|
|
2
|
+
export const actions = [
|
|
3
|
+
"Edit Patient Identifiers",
|
|
4
|
+
"Remove Problems",
|
|
5
|
+
"View Order Types",
|
|
6
|
+
"View Global Properties",
|
|
7
|
+
"Edit Problems",
|
|
8
|
+
"View Concept Proposals",
|
|
9
|
+
"Add Relationships",
|
|
10
|
+
"View Locations",
|
|
11
|
+
"Manage OWA",
|
|
12
|
+
"Preview Forms",
|
|
13
|
+
"Manage HL7 Messages",
|
|
14
|
+
"View Patient Programs",
|
|
15
|
+
"Manage Concept Reference Terms",
|
|
16
|
+
"Manage Order Set Attribute Types",
|
|
17
|
+
"Delete HL7 Inbound Archive",
|
|
18
|
+
"Manage Concept Map Types",
|
|
19
|
+
"Add Encounters",
|
|
20
|
+
"View Patients",
|
|
21
|
+
"Generate Batch of Identifiers",
|
|
22
|
+
"Manage Person Attribute Types",
|
|
23
|
+
"Manage Auto Generation Options",
|
|
24
|
+
"Edit Encounters",
|
|
25
|
+
"Manage Field Types",
|
|
26
|
+
"Add Orders",
|
|
27
|
+
"View Programs",
|
|
28
|
+
"Manage Visit Attribute Types",
|
|
29
|
+
"Manage Forms",
|
|
30
|
+
"View Concept Datatypes",
|
|
31
|
+
"Add Concept Proposals",
|
|
32
|
+
"Manage Identifier Types",
|
|
33
|
+
"Update HL7 Inbound Exception",
|
|
34
|
+
"Get Order Frequencies",
|
|
35
|
+
"Manage Implementation Id",
|
|
36
|
+
"Manage Relationships",
|
|
37
|
+
"Manage Programs",
|
|
38
|
+
"Upload Batch of Identifiers",
|
|
39
|
+
"Remove Allergies",
|
|
40
|
+
"Manage Order Sets",
|
|
41
|
+
"Add Problems",
|
|
42
|
+
"View Observations",
|
|
43
|
+
"Add Visits",
|
|
44
|
+
"View Forms",
|
|
45
|
+
"Add Patients",
|
|
46
|
+
"View Problems",
|
|
47
|
+
"Add People",
|
|
48
|
+
"Add HL7 Source",
|
|
49
|
+
"Get Concept Attribute Types",
|
|
50
|
+
"Add Observations",
|
|
51
|
+
"Manage Visit Types",
|
|
52
|
+
"View Roles",
|
|
53
|
+
"Add Patient Programs",
|
|
54
|
+
"Edit Visits",
|
|
55
|
+
"Delete Patient Programs",
|
|
56
|
+
"View Encounters",
|
|
57
|
+
"View Privileges",
|
|
58
|
+
"Manage Providers",
|
|
59
|
+
"View Field Types",
|
|
60
|
+
"Delete People",
|
|
61
|
+
"Delete Users",
|
|
62
|
+
"Manage Encounter Roles",
|
|
63
|
+
"Delete Patients",
|
|
64
|
+
"Patient Dashboard - View Forms Section",
|
|
65
|
+
"View People",
|
|
66
|
+
"Get Diagnoses Attribute Types",
|
|
67
|
+
"Manage Address Hierarchy",
|
|
68
|
+
"Add Patient Identifiers",
|
|
69
|
+
"Edit Cohorts",
|
|
70
|
+
"Get Notes",
|
|
71
|
+
"Delete HL7 Inbound Exception",
|
|
72
|
+
"Get Visit Types",
|
|
73
|
+
"Get HL7 Inbound Exception",
|
|
74
|
+
"Manage Concepts",
|
|
75
|
+
"Get Visit Attribute Types",
|
|
76
|
+
"Get Visits",
|
|
77
|
+
"Get Providers",
|
|
78
|
+
"Get Location Attribute Types",
|
|
79
|
+
"Get Encounter Roles",
|
|
80
|
+
"Add HL7 Inbound Archive",
|
|
81
|
+
"Get HL7 Source",
|
|
82
|
+
"View Orders",
|
|
83
|
+
"Get HL7 Inbound Archive",
|
|
84
|
+
"Get HL7 Inbound Queue",
|
|
85
|
+
"Delete Patient Identifiers",
|
|
86
|
+
"View Relationship Types",
|
|
87
|
+
"Manage Global Properties",
|
|
88
|
+
"Manage Modules",
|
|
89
|
+
"Update HL7 Source",
|
|
90
|
+
"View Patient Cohorts",
|
|
91
|
+
"Manage Metadata Mapping",
|
|
92
|
+
"Edit Conditions",
|
|
93
|
+
"Delete Cohorts",
|
|
94
|
+
"Assign System Developer Role",
|
|
95
|
+
"Edit Users",
|
|
96
|
+
"Delete Concept Proposals",
|
|
97
|
+
"Get Concept Datatypes",
|
|
98
|
+
"Get Concept Classes",
|
|
99
|
+
"Edit Notes",
|
|
100
|
+
"Get Roles",
|
|
101
|
+
"Get Care Settings",
|
|
102
|
+
"Get Privileges",
|
|
103
|
+
"Get Order Types",
|
|
104
|
+
"Get Field Types",
|
|
105
|
+
"Get Concept Sources",
|
|
106
|
+
"Get Relationship Types",
|
|
107
|
+
"Manage Encounter Types",
|
|
108
|
+
"Get Identifier Types",
|
|
109
|
+
"Manage Scheduler",
|
|
110
|
+
"Get Forms",
|
|
111
|
+
"Get Orders",
|
|
112
|
+
"Get Global Properties",
|
|
113
|
+
"Manage Locations",
|
|
114
|
+
"Get Patient Programs",
|
|
115
|
+
"Get People",
|
|
116
|
+
"Patient Dashboard - View Overview Section",
|
|
117
|
+
"Delete Diagnoses",
|
|
118
|
+
"Get Person Attribute Types",
|
|
119
|
+
"Get Database Changes",
|
|
120
|
+
"Form Entry",
|
|
121
|
+
"Get Relationships",
|
|
122
|
+
"Get Allergies",
|
|
123
|
+
"Get Problems",
|
|
124
|
+
"Edit Diagnoses",
|
|
125
|
+
"Delete Orders",
|
|
126
|
+
"Get Programs",
|
|
127
|
+
"Get Concept Reference Terms",
|
|
128
|
+
"Purge Field Types",
|
|
129
|
+
"View Data Entry Statistics",
|
|
130
|
+
"Manage Address Templates",
|
|
131
|
+
"Upload XSN",
|
|
132
|
+
"Get Concept Map Types",
|
|
133
|
+
"Add HL7 Inbound Exception",
|
|
134
|
+
"Manage Identifier Sources",
|
|
135
|
+
"Get Conditions",
|
|
136
|
+
"Update HL7 Inbound Archive",
|
|
137
|
+
"Add Allergies",
|
|
138
|
+
"Manage Search Index",
|
|
139
|
+
"Manage Concept Classes",
|
|
140
|
+
"View Patient Identifiers",
|
|
141
|
+
"Manage Order Frequencies",
|
|
142
|
+
"Patient Overview - View Relationships",
|
|
143
|
+
"Patient Dashboard - View Demographics Section",
|
|
144
|
+
"Patient Overview - View Programs",
|
|
145
|
+
"Patient Overview - View Problem List",
|
|
146
|
+
"Patient Overview - View Allergies",
|
|
147
|
+
"View Administration Functions",
|
|
148
|
+
"Get Encounters",
|
|
149
|
+
"Get Users",
|
|
150
|
+
"Get Locations",
|
|
151
|
+
"View Encounter Types",
|
|
152
|
+
"Get Encounter Types",
|
|
153
|
+
"Get Patients",
|
|
154
|
+
"Get Observations",
|
|
155
|
+
"Get Patient Cohorts",
|
|
156
|
+
"Manage Location Attribute Types",
|
|
157
|
+
"View Identifier Types",
|
|
158
|
+
"Get Patient Identifiers",
|
|
159
|
+
"View Metadata Via Mapping",
|
|
160
|
+
"Add Users",
|
|
161
|
+
"Edit User Passwords",
|
|
162
|
+
"View Navigation Menu",
|
|
163
|
+
"Get Concepts",
|
|
164
|
+
"Delete Encounters",
|
|
165
|
+
"Get Concept Proposals",
|
|
166
|
+
"Edit People",
|
|
167
|
+
"Manage RESTWS",
|
|
168
|
+
"Edit Concept Proposals",
|
|
169
|
+
"Manage Concept Stop Words",
|
|
170
|
+
"Manage Location Tags",
|
|
171
|
+
"Manage Concept Sources",
|
|
172
|
+
"Manage Order Types",
|
|
173
|
+
"Edit Allergies",
|
|
174
|
+
"Patient Dashboard - View Encounters Section",
|
|
175
|
+
"Add Cohorts",
|
|
176
|
+
"Delete Notes",
|
|
177
|
+
"Manage Concept Datatypes",
|
|
178
|
+
"Delete Conditions",
|
|
179
|
+
"Manage Relationship Types",
|
|
180
|
+
"Edit Orders",
|
|
181
|
+
"Get Order Set Attribute Types",
|
|
182
|
+
"Get Diagnoses",
|
|
183
|
+
"View Relationships",
|
|
184
|
+
"Manage Alerts",
|
|
185
|
+
"Manage FormEntry XSN",
|
|
186
|
+
"View Unpublished Forms",
|
|
187
|
+
"Configure Visits",
|
|
188
|
+
"Patient Overview - View Patient Actions",
|
|
189
|
+
"Get Order Sets",
|
|
190
|
+
"Delete Visits",
|
|
191
|
+
"Patient Dashboard - View Patient Summary",
|
|
192
|
+
"Delete HL7 Inbound Queue",
|
|
193
|
+
"Delete Relationships",
|
|
194
|
+
"Edit Observations",
|
|
195
|
+
"View Concepts",
|
|
196
|
+
"Edit Patient Programs",
|
|
197
|
+
"View Person Attribute Types",
|
|
198
|
+
"View RESTWS",
|
|
199
|
+
"Patient Dashboard - View Graphs Section",
|
|
200
|
+
"Delete Observations",
|
|
201
|
+
"Patient Dashboard - View Regimen Section",
|
|
202
|
+
"Manage Concept Attribute Types",
|
|
203
|
+
"Manage Concept Name tags",
|
|
204
|
+
"View Users",
|
|
205
|
+
"View Allergies",
|
|
206
|
+
"View Concept Sources",
|
|
207
|
+
"Add HL7 Inbound Queue",
|
|
208
|
+
"Manage Roles",
|
|
209
|
+
"Update HL7 Inbound Queue",
|
|
210
|
+
"Edit Relationships",
|
|
211
|
+
"Edit Patients",
|
|
212
|
+
"View Concept Classes"
|
|
213
|
+
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type TypeRepository } from "../TypeRepository";
|
|
2
|
+
import ProdOpencareRepository from "./prodRepository";
|
|
3
|
+
import OpencareRepository from "./repository";
|
|
4
|
+
|
|
5
|
+
export function getOpencareRepository(
|
|
6
|
+
t: TypeRepository = "fake"
|
|
7
|
+
): OpencareRepository {
|
|
8
|
+
if (t === "fake") {
|
|
9
|
+
return new OpencareRepository();
|
|
10
|
+
}
|
|
11
|
+
return new ProdOpencareRepository();
|
|
12
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { BadResponse } from "../errors";
|
|
2
|
+
import env from "../env";
|
|
3
|
+
import OpencareRepository from "./repository";
|
|
4
|
+
|
|
5
|
+
class ProdOpencareRepository extends OpencareRepository {
|
|
6
|
+
async getDemands(): Promise<Array<any>> {
|
|
7
|
+
let myHeaders = new Headers();
|
|
8
|
+
myHeaders.append("Accept", "application/json,");
|
|
9
|
+
myHeaders.append("Content-Type", "application/json");
|
|
10
|
+
//myHeaders.append("Authorization", `Basic ${TALK_BASE64}`);
|
|
11
|
+
|
|
12
|
+
let requestOptions = {
|
|
13
|
+
method: "GET",
|
|
14
|
+
headers: myHeaders,
|
|
15
|
+
};
|
|
16
|
+
const demandProgressStatus = "2";
|
|
17
|
+
return await fetch(
|
|
18
|
+
`${env.API_BASE_URL}/demand?status=${demandProgressStatus}`,
|
|
19
|
+
requestOptions
|
|
20
|
+
)
|
|
21
|
+
.then((response) => {
|
|
22
|
+
if (response.ok) {
|
|
23
|
+
return response.json();
|
|
24
|
+
}
|
|
25
|
+
throw new BadResponse(
|
|
26
|
+
`Impossible de recupérer les démandes (${response.status})`,
|
|
27
|
+
"Opencare"
|
|
28
|
+
);
|
|
29
|
+
})
|
|
30
|
+
.then(({ results }) => {
|
|
31
|
+
const res: Array<any> = results;
|
|
32
|
+
return res;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async getAppointments(
|
|
37
|
+
patientUuid: string,
|
|
38
|
+
doctor?: string
|
|
39
|
+
): Promise<Array<any>> {
|
|
40
|
+
let myHeaders = new Headers();
|
|
41
|
+
myHeaders.append("Accept", "application/json,");
|
|
42
|
+
myHeaders.append("Content-Type", "application/json");
|
|
43
|
+
//myHeaders.append("Authorization", `Basic ${TALK_BASE64}`);
|
|
44
|
+
|
|
45
|
+
let requestOptions = {
|
|
46
|
+
method: "GET",
|
|
47
|
+
headers: myHeaders,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return await fetch(
|
|
51
|
+
`${env.API_BASE_URL}/patient/${patientUuid}/appointment${
|
|
52
|
+
doctor ? `?doctor=${doctor}` : ""
|
|
53
|
+
}`,
|
|
54
|
+
requestOptions
|
|
55
|
+
)
|
|
56
|
+
.then((response) => {
|
|
57
|
+
if (response.ok) {
|
|
58
|
+
return response.json();
|
|
59
|
+
}
|
|
60
|
+
throw new BadResponse(
|
|
61
|
+
`Impossible de recupérer les rencontres (${response.status})`,
|
|
62
|
+
"Opencare"
|
|
63
|
+
);
|
|
64
|
+
})
|
|
65
|
+
.then(({ results }) => {
|
|
66
|
+
const res: Array<any> = results;
|
|
67
|
+
return res.map((appointment) => {
|
|
68
|
+
return {
|
|
69
|
+
uuid: appointment.uuid,
|
|
70
|
+
startDateTime: appointment.startDateTime,
|
|
71
|
+
location: "",
|
|
72
|
+
service: appointment.service,
|
|
73
|
+
status: appointment.statusProgress,
|
|
74
|
+
appointmentKind: "Scheduled",
|
|
75
|
+
comments: "",
|
|
76
|
+
linkRoom: appointment.linkRoom,
|
|
77
|
+
patientUuid,
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async rejectDemand(demand_id: string): Promise<void> {
|
|
84
|
+
let myHeaders = new Headers();
|
|
85
|
+
myHeaders.append("Accept", "application/json,");
|
|
86
|
+
myHeaders.append("Content-Type", "application/json");
|
|
87
|
+
//myHeaders.append("Authorization", `Basic ${TALK_BASE64}`);
|
|
88
|
+
|
|
89
|
+
let requestOptions = {
|
|
90
|
+
method: "PUT",
|
|
91
|
+
headers: myHeaders,
|
|
92
|
+
};
|
|
93
|
+
await fetch(
|
|
94
|
+
`${env.API_BASE_URL}/demand/${demand_id}/reject`,
|
|
95
|
+
requestOptions
|
|
96
|
+
).then((response) => {
|
|
97
|
+
if (response.ok) {
|
|
98
|
+
return response.json();
|
|
99
|
+
}
|
|
100
|
+
throw new BadResponse(
|
|
101
|
+
`Impossible de rejeter la demande (${response.status})`,
|
|
102
|
+
"Opencare"
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async vaidateDemand(
|
|
108
|
+
demand_id: string,
|
|
109
|
+
doctor_id: string,
|
|
110
|
+
startDate: Date = new Date(),
|
|
111
|
+
duration = 30
|
|
112
|
+
): Promise<void> {
|
|
113
|
+
const myHeaders = new Headers();
|
|
114
|
+
myHeaders.append("Accept", "application/json,");
|
|
115
|
+
myHeaders.append("Content-Type", "application/json");
|
|
116
|
+
|
|
117
|
+
const raw = JSON.stringify({
|
|
118
|
+
doctor_id: doctor_id,
|
|
119
|
+
duration: duration,
|
|
120
|
+
date_meeting: startDate.toISOString(),
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const requestOptions = {
|
|
124
|
+
method: "POST",
|
|
125
|
+
headers: myHeaders,
|
|
126
|
+
body: raw,
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
await fetch(
|
|
130
|
+
`${env.API_BASE_URL}/demand/${demand_id}/validate`,
|
|
131
|
+
requestOptions
|
|
132
|
+
).then((response) => {
|
|
133
|
+
if (response.ok) {
|
|
134
|
+
return response.json();
|
|
135
|
+
}
|
|
136
|
+
throw new BadResponse(
|
|
137
|
+
`Impossible de valider la demande (${response.status})`,
|
|
138
|
+
"Opencare"
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async getProviders(): Promise<Array<any>> {
|
|
144
|
+
let myHeaders = new Headers();
|
|
145
|
+
myHeaders.append("Accept", "application/json,");
|
|
146
|
+
myHeaders.append("Content-Type", "application/json");
|
|
147
|
+
//myHeaders.append("Authorization", `Basic ${TALK_BASE64}`);
|
|
148
|
+
|
|
149
|
+
let requestOptions = {
|
|
150
|
+
method: "GET",
|
|
151
|
+
headers: myHeaders,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return await fetch(`${env.API_BASE_URL}/doctor`, requestOptions)
|
|
155
|
+
.then((response) => {
|
|
156
|
+
if (response.ok) {
|
|
157
|
+
return response.json();
|
|
158
|
+
}
|
|
159
|
+
throw new BadResponse(
|
|
160
|
+
`Impossible de recupérer les rencontres (${response.status})`,
|
|
161
|
+
"Opencare"
|
|
162
|
+
);
|
|
163
|
+
})
|
|
164
|
+
.then(({ results }) => {
|
|
165
|
+
const res: Array<any> = results;
|
|
166
|
+
return res.map((doctor) => {
|
|
167
|
+
return {
|
|
168
|
+
id: doctor.uuid,
|
|
169
|
+
name: doctor.person.display,
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export default ProdOpencareRepository;
|