c2-clinical 1.0.108 → 1.0.111

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.
@@ -1,7 +1,8 @@
1
- import { IFormUnit } from "../../models/form/FormUnit";
1
+ import { IFormUnit, IRow } from "../../models/form/FormUnit";
2
2
  import { IMetActivityPatient } from "../../models/met-activity/MetActivityPatient";
3
- declare class ProcessAnswerFlow {
3
+ declare class ProcessAnswerFlowTester {
4
+ executeByRows(questionAnswered: IFormUnit, rows: IRow[], attendanceMetActivities: IMetActivityPatient[]): IFormUnit[];
4
5
  execute(questionAnswered: IFormUnit, bankAnswer: IFormUnit[], attendanceMetActivities: IMetActivityPatient[]): IFormUnit[];
5
6
  }
6
- declare const _default: ProcessAnswerFlow;
7
+ declare const _default: ProcessAnswerFlowTester;
7
8
  export default _default;
@@ -4,8 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const ExecFormulaFlowTester_1 = __importDefault(require("./ExecFormulaFlowTester"));
7
+ const ConvertRowToFormUnitsFlowItem_1 = __importDefault(require("./item/ConvertRowToFormUnitsFlowItem"));
7
8
  const GetAnswerRelationedsFlowItemTester_1 = __importDefault(require("./item/GetAnswerRelationedsFlowItemTester"));
8
- class ProcessAnswerFlow {
9
+ class ProcessAnswerFlowTester {
10
+ executeByRows(questionAnswered, rows, attendanceMetActivities) {
11
+ const bankAnswer = ConvertRowToFormUnitsFlowItem_1.default.execute(rows);
12
+ return this.execute(questionAnswered, bankAnswer, attendanceMetActivities);
13
+ }
9
14
  execute(questionAnswered, bankAnswer, attendanceMetActivities) {
10
15
  const answerRelacioneds = GetAnswerRelationedsFlowItemTester_1.default.execute(questionAnswered, bankAnswer);
11
16
  const autoAnswereds = [];
@@ -50,4 +55,4 @@ class ProcessAnswerFlow {
50
55
  return questionsRelacionedsAnsweredsRet;
51
56
  }
52
57
  }
53
- exports.default = new ProcessAnswerFlow();
58
+ exports.default = new ProcessAnswerFlowTester();
@@ -0,0 +1,8 @@
1
+ import { IFormUnit, IRow } from "../../../models/form/FormUnit";
2
+ declare class ConvertRowToFormUnitsFlowItem {
3
+ private formUnits;
4
+ execute(rows: IRow[]): IFormUnit[];
5
+ private iterate;
6
+ }
7
+ declare const _default: ConvertRowToFormUnitsFlowItem;
8
+ export default _default;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class ConvertRowToFormUnitsFlowItem {
4
+ formUnits = [];
5
+ execute(rows) {
6
+ for (const row of rows) {
7
+ this.formUnits = [...this.formUnits, ...this.iterate(row)];
8
+ }
9
+ return this.formUnits;
10
+ }
11
+ iterate(row) {
12
+ let formUnits = [];
13
+ row.collumns?.forEach((collumn) => {
14
+ formUnits.push({ ...collumn, lines: undefined });
15
+ if (collumn.lines?.length) {
16
+ collumn.lines.forEach((line) => {
17
+ formUnits = [...formUnits, ...this.iterate(line)];
18
+ });
19
+ }
20
+ });
21
+ return formUnits;
22
+ }
23
+ }
24
+ exports.default = new ConvertRowToFormUnitsFlowItem();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-clinical",
3
- "version": "1.0.108",
3
+ "version": "1.0.111",
4
4
  "description": "Biblioteca Typescript para API NodeJS",
5
5
  "repository": "https://github.com/cabralsilva/c2-clinical.git",
6
6
  "author": "Daniel Cabral <cabralconsultoriaemsoftware@gmail.com>",