-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into consturctor-laboratory-search
- Loading branch information
Showing
8 changed files
with
129 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from django.core.management import BaseCommand | ||
from directions.models import Diagnoses | ||
import requests | ||
from openpyxl import load_workbook | ||
|
||
|
||
def fetch(url): | ||
page = requests.get(url) | ||
return page.json()['list'] | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Импорт справочника МКБ" | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('path', type=str) | ||
parser.add_argument('mode', type=str) | ||
|
||
def handle(self, *args, **kwargs): | ||
fp = kwargs["path"] | ||
self.stdout.write("Path: " + fp) | ||
wb = load_workbook(filename=fp) | ||
ws = wb[wb.sheetnames[0]] | ||
starts = False | ||
mode = kwargs.get("mode") | ||
code, nsi_id, title = "", "", "" | ||
for row in ws.rows: | ||
cells = [str(x.value) for x in row] | ||
if not starts: | ||
if "Уникальный идентификатор" in cells: | ||
title = cells.index("Наименование") | ||
code = cells.index("Код МКБ-10") | ||
nsi_id = cells.index("Уникальный идентификатор") | ||
starts = True | ||
else: | ||
r = Diagnoses.objects.filter(code=cells[code], d_type=mode) | ||
if not r.exists(): | ||
Diagnoses(d_type=mode, code=cells[code], title=cells[title], nsi_id=cells[nsi_id], hide=False, m_type=2).save() | ||
print('сохранено', cells[code]) # noqa: T001 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
__version__ = "2024.12.120019+74217f" | ||
__version__ = "2024.12.151313+fe4486" | ||
VERSION = __version__ |
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ skip-string-normalization = true | |
|
||
[tool.poetry] | ||
name = "l2" | ||
version = "2024.12.120019+74217f" | ||
version = "2024.12.151313+fe4486" | ||
description = "" | ||
authors = ["Mikhail Privalov <[email protected]>"] | ||
license = "MIT" | ||
|