From ac29da01fc60f649aced6cfa075e53261b8eac55 Mon Sep 17 00:00:00 2001 From: apan Date: Thu, 28 Jul 2022 14:24:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E8=B0=83?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + apps/report/views.py | 2 +- apps/user/views.py | 7 ++----- config/server.py | 2 -- config/system.conf | 4 ++-- db_logic/db_base.py | 2 +- db_logic/medicament.py | 4 ++-- db_logic/user.py | 2 +- main.py | 5 +++-- models/client_models.py | 3 ++- models/humiture_models.py | 3 ++- models/log_models.py | 3 ++- models/medicament_models.py | 14 +------------- models/user_models.py | 4 +++- models/warning_models.py | 3 ++- 15 files changed, 25 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 23210f7..21c47f1 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ coverage.xml # Django stuff: *.log +.conf local_settings.py db.sqlite3 db.sqlite3-journal diff --git a/apps/report/views.py b/apps/report/views.py index a4ef39a..a53abb9 100644 --- a/apps/report/views.py +++ b/apps/report/views.py @@ -5,7 +5,7 @@ ''' from flask import jsonify, request -from common.utils import PageParam, Utils +from Common.Utils import PageParam, Utils from db_logic.medicament_record import BllMedicamentRecord from db_logic.medicament import BllMedicament diff --git a/apps/user/views.py b/apps/user/views.py index de0cbc3..e428396 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -4,16 +4,13 @@ @Date:2022/07/19 16:34:34 ''' from flask import jsonify, request, Blueprint, g -from common.auth import token_auth -from common.utils import Utils -from flask_siwadoc import SiwaDoc -from pydantic import BaseModel +from Common.auth import token_auth +from Common.Utils import Utils from db_logic.user import BllUser user_router = Blueprint('user', __name__) -doc_siwa = SiwaDoc(user_router) # class LoginBase(BaseModel): diff --git a/config/server.py b/config/server.py index 9cf083d..9598d61 100644 --- a/config/server.py +++ b/config/server.py @@ -11,7 +11,6 @@ import decimal from flask import Flask as New_flask from flask.json import JSONEncoder as _JSONEncoder from flask_cors import CORS -from flask_siwadoc import SiwaDoc from sqlalchemy.ext.declarative import DeclarativeMeta @@ -81,7 +80,6 @@ def register_blueprints(app: New_flask): def create_app(): app = Flask(__name__) CORS(app) - SiwaDoc(app) # app.config.from_object('setting') app.config["SECRET_KEY"] = "wYdilHT~TRw7j{lF+Ee5MR3nFBINONPUcObwjwzge&/(~[C?Yz" register_blueprints(app) diff --git a/config/system.conf b/config/system.conf index a2316d4..dd69b85 100644 --- a/config/system.conf +++ b/config/system.conf @@ -2,5 +2,5 @@ clientid = 000 serverip = 127.0.0.1 port = 9001 -dbconntion = mysql+pymysql://root:123456@127.0.0.1/local_rms_db?charset=utf8 - +# dbconntion = mysql+pymysql://root:123456@127.0.0.1/local_rms_db?charset=utf8 +dbconntion = mysql+pymysql://yanyi:tangyan86910282@111.231.67.55/yy_rms_multiple?charset=utf8 diff --git a/db_logic/db_base.py b/db_logic/db_base.py index c7a0385..5fabd22 100644 --- a/db_logic/db_base.py +++ b/db_logic/db_base.py @@ -13,7 +13,7 @@ from sqlalchemy.sql import func import paginate_sqlalchemy from config.SystemConfig import SystemConfig from models.models_base import Base -from common.log_utlis import logger +from Common.Utils import logger """数据仓储类""" diff --git a/db_logic/medicament.py b/db_logic/medicament.py index a394616..07f4020 100644 --- a/db_logic/medicament.py +++ b/db_logic/medicament.py @@ -15,7 +15,7 @@ from models.medicament_models import EntityMedicament, EntityMedicamentRecord, E from models.client_models import EntityClient from models.user_models import EntityUser from db_logic.meidcament_variety import BllMedicamentVariety -from common.utils import Utils, DrugStatus, DrugRecordType, PageParam +from Common.Utils import Utils, DrugStatus, DrugRecordType, PageParam @@ -333,7 +333,7 @@ class BllMedicament(Repository): if __name__ == '__main__': from db_logic.medicament import BllMedicament - from common.utils import PageParam + from Common.Utils import PageParam page_param = PageParam(1, 10) data = BllMedicament().get_drug_use_classify() print(data) diff --git a/db_logic/user.py b/db_logic/user.py index b711dec..0281d53 100644 --- a/db_logic/user.py +++ b/db_logic/user.py @@ -12,7 +12,7 @@ from flask import current_app from sqlalchemy import and_, insert, or_, desc from db_logic.db_base import Repository from models.user_models import EntityUser -from common.utils import Utils +from Common.Utils import Utils #用户操作业务逻辑类 class BllUser(Repository): diff --git a/main.py b/main.py index 8895d9a..d50836a 100644 --- a/main.py +++ b/main.py @@ -3,9 +3,10 @@ ''' @Date:2022/07/18 15:00:54 ''' - +import sys +sys.path.append(".") from config.server import create_app -from common.exception_base import APIException +from Common.exception_base import APIException from config.SystemConfig import SystemConfig app = create_app() diff --git a/models/client_models.py b/models/client_models.py index 36437b2..2dd45bd 100644 --- a/models/client_models.py +++ b/models/client_models.py @@ -3,7 +3,8 @@ ''' @Date:2022/07/18 15:24:43 ''' - +import sys +sys.path.append(".") # 已同步本地数据库 from models.models_base import Base, get_uuid diff --git a/models/humiture_models.py b/models/humiture_models.py index 39511c0..58fc30d 100644 --- a/models/humiture_models.py +++ b/models/humiture_models.py @@ -3,7 +3,8 @@ ''' @Date:2022/07/18 15:26:19 ''' - +import sys +sys.path.append(".") from sqlalchemy import Column, String, Float, Integer from models.models_base import Base, get_uuid diff --git a/models/log_models.py b/models/log_models.py index e6ecc1f..67f67c9 100644 --- a/models/log_models.py +++ b/models/log_models.py @@ -3,7 +3,8 @@ ''' @Date:2022/07/18 15:30:14 ''' - +import sys +sys.path.append(".") # 已同步本地数据库 from sqlalchemy import Column, String, Integer from models.models_base import Base, get_uuid diff --git a/models/medicament_models.py b/models/medicament_models.py index 6b2f9d7..a0d8add 100644 --- a/models/medicament_models.py +++ b/models/medicament_models.py @@ -3,8 +3,6 @@ ''' @Date:2022/07/18 15:28:11 ''' -from datetime import datetime -from random import randint import sys sys.path.append('.') # from common.utils import Utils @@ -103,16 +101,6 @@ class EntityMedicament(Base): remark30 = Column(String(50), comment='扩展字段30') - def to_dict(self): - # li = [] - # for i in self.__table__.columns: - # li.append(i.name) - return [i for i in c.__table__.columns] - # return {c.name: getattr(self, c.name) for c in self.__table__.columns} - - - - class EntityMedicamentTemplate(Base): __tablename__ = "rms_medicament_template" @@ -230,7 +218,7 @@ class EntityMedicamentExtend(Base): if __name__ == '__main__': drug_info = {} user_info = {} - from common.utils import Utils + from Common.Utils import Utils entity = EntityMedicamentVariety( customer_id="customer_id", name=drug_info.get("name"), diff --git a/models/user_models.py b/models/user_models.py index da14352..4036af1 100644 --- a/models/user_models.py +++ b/models/user_models.py @@ -3,8 +3,10 @@ ''' @Date:2022/07/18 15:29:38 ''' +import sys +sys.path.append(".") from sqlalchemy import Column, String, Text, Integer -from common.utils import Utils +from Common.Utils import Utils from models.models_base import Base, get_uuid from werkzeug.security import check_password_hash, generate_password_hash diff --git a/models/warning_models.py b/models/warning_models.py index e64a69b..9a76314 100644 --- a/models/warning_models.py +++ b/models/warning_models.py @@ -3,7 +3,8 @@ ''' @Date:2022/07/18 15:27:14 ''' - +import sys +sys.path.append(".") from sqlalchemy import Column, String, Integer, Text from models.models_base import Base, get_uuid