-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #267 from noharm-ai/develop
v2.05-beta
- Loading branch information
Showing
17 changed files
with
424 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import os | ||
from flask import Blueprint, request | ||
from flask_jwt_extended import jwt_required, get_jwt_identity | ||
|
||
from models.main import * | ||
from models.appendix import * | ||
from models.segment import * | ||
from models.prescription import * | ||
from services.admin import exam_service | ||
from exception.validation_error import ValidationError | ||
|
||
app_admin_exam = Blueprint("app_admin_exam", __name__) | ||
|
||
|
||
@app_admin_exam.route("/admin/exam/copy", methods=["POST"]) | ||
@jwt_required() | ||
def copy_exams(): | ||
user = User.find(get_jwt_identity()) | ||
dbSession.setSchema(user.schema) | ||
os.environ["TZ"] = "America/Sao_Paulo" | ||
data = request.get_json() | ||
|
||
try: | ||
result = exam_service.copy_exams( | ||
id_segment_origin=data.get("idSegmentOrigin", None), | ||
id_segment_destiny=data.get("idSegmentDestiny", None), | ||
user=user, | ||
) | ||
except ValidationError as e: | ||
return {"status": "error", "message": str(e), "code": e.code}, e.httpStatus | ||
|
||
return tryCommit(db, result.rowcount) | ||
|
||
|
||
@app_admin_exam.route("/admin/exam/most-frequent", methods=["GET"]) | ||
@jwt_required() | ||
def get_most_frequent(): | ||
user = User.find(get_jwt_identity()) | ||
dbSession.setSchema(user.schema) | ||
|
||
try: | ||
list = exam_service.get_most_frequent(user=user) | ||
except ValidationError as e: | ||
return {"status": "error", "message": str(e), "code": e.code}, e.httpStatus | ||
|
||
return { | ||
"status": "success", | ||
"data": list, | ||
}, status.HTTP_200_OK | ||
|
||
|
||
@app_admin_exam.route("/admin/exam/most-frequent/add", methods=["POST"]) | ||
@jwt_required() | ||
def add_most_frequent(): | ||
user = User.find(get_jwt_identity()) | ||
dbSession.setSchema(user.schema) | ||
os.environ["TZ"] = "America/Sao_Paulo" | ||
data = request.get_json() | ||
|
||
try: | ||
exam_service.add_most_frequent( | ||
id_segment=data.get("idSegment", None), | ||
exam_types=data.get("examTypes", None), | ||
user=user, | ||
) | ||
except ValidationError as e: | ||
return {"status": "error", "message": str(e), "code": e.code}, e.httpStatus | ||
|
||
return tryCommit(db, True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.