Coder Social home page Coder Social logo

tasddc1226 / doctor-for-you Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 53 KB

환자가 원하는 의사를 쉽게 찾고, 진료 예약까지 한번에 할 수 있도록 도와주는 백엔드 서비스

Python 100.00%
django-rest-framework mysql-database

doctor-for-you's Introduction

header

Hi There! 🙋‍♂️

doctor-for-you's People

Contributors

tasddc1226 avatar

Watchers

 avatar  avatar

doctor-for-you's Issues

#1 다음 영업일 찾기 문제

평일 점심시간에 진료 예약 요청이 들어온 경우

# 예약 요청을 날린 시각을 설정한다.
now = datetime(2022, 1, 11, 12, 50) #  평일 점심시간대로 설정
  • Request Data : 진료 요청 Data는 정상적으로 들어온 경우
{
	"patient_id" : 3,
	"doctor_id" : 2,
	"year": 2022,
	"month": 1,
	"day": 11,
	"hour": 14,
	"min": 45
}
  • Response Data
{
	"id": 11,
	"book_time": "2022-01-11T14:45:00",
	"created_at": "2022-07-21T00:48:42.640920", // don't care
	"expire_time": "2022-01-11T13:15:00",
	"is_booked": false,
	"patient": 3,
	"doctor": 2
}
  • id가 2번인 의사의 평일 점심시간은 12시부터 13시까지 이다.
  • 따라서 요청 만료 시간은 점심시간이 끝난 후 15분까지 유효하므로 정상적으로 점심시간 종료 이후 + 15분의 expire_time이 생성되어진다.

주말에 진료 예약 요청이 들어온 경우

# 예약 요청을 날린 시각을 설정한다.
now = datetime(2022, 1, 15, 1, 0) #  주말 새벽 시간대로 설정
  • Request Data : 진료 요청 Data는 정상적으로 들어온 경우
{
	"patient_id" : 3,
	"doctor_id" : 1,
	"year": 2022,
	"month": 1,
	"day": 17,
	"hour": 10,
	"min": 45
}
- 즉, 환자가 15일(토요일)에 17일(월요일)날 오전 10시 45분에 진료를 요청한 경우이다.
  • Response Data
{
	"id": 12,
	"book_time": "2022-01-17T10:45:00",
	"created_at": "2022-07-21T00:52:59.889905", // don't care
	"expire_time": "2022-01-16T09:15:00",
	"is_booked": false,
	"patient": 3,
	"doctor": 1
}
  • 하지만 응답으로는 위처럼 결과가 나오고 있음.
  • id가 1번인 의사는 주말에 진료를 하지 않는다.
  • 하지만 응답 결과의 expire_time로는 15일(토요일) 다음날인 16일(일요일)의 영업 시작일 + 15분으로 나오는 현상이 발생.

이유

  • 우선, 점심시간 제외 금일 영업시간이 종료되어 다음 영업일을 찾는 방법이 아래와 같다.
                    info = {
                        "patient": data["patient_id"],
                        "doctor": data["doctor_id"],
                        "book_time": book_time,
                        "expire_time": datetime(
                            now.year, now.month, now.day + 1
                        )
                        + timedelta(hours=hour_range_list[0], minutes=15),
                    }
  • 영업이 종료로 인한 의사의 부재인 경우 무조건 다음날 영업시작시간 + 15분을 해주고 있기 때문이다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.