PJ-TEAM-Vitamin / Hospital_reservation_web_application

실시간 병원 예약 웹 어플리케이션 프로젝트
MIT License
0 stars 0 forks source link

[Issue] 파일 구조 및 dto #7

Open hyeonpark-5 opened 7 months ago

hyeonpark-5 commented 7 months ago

파일구조

controller - service(service, serviceImpl) - dto - mapper - mapper.xml - DB

DTO 구현

기타사항

date, datetime, time format 필요

break 테이블의 break break_date로 이름 변경 필요


package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger;
import java.time.LocalDateTime;

@Data
public class AdminDTO {
    private BigInteger admin_id;
    private String admin_name;
    private String password;
    private String email;
    private String name;
    private int is_active;
    private LocalDateTime last_login;
    private LocalDateTime create_at;
    private LocalDateTime update_at;
    private BigInteger hospital_id;
}

import java.math.BigInteger; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime;

@Data public class BreakDTO { private BigInteger break_id; private Integer off; private LocalDate break_date; private LocalTime opening; private LocalTime close; private LocalDateTime created_at; private BigInteger room_id; }


- BusinessHourDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger; import java.time.LocalTime;

@Data public class BusinessHourDTO { private BigInteger business_hour_id; private String week; private LocalTime opening; private LocalTime close; private Integer holiday; private BigInteger hospital_id; }


- ClinicDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger;

@Data public class ClinicDTO { private BigInteger clinic_id; private String title; private String description; private BigInteger room_id; }


- ClosedDTO

import lombok.Data;

import java.math.BigInteger; import java.time.LocalDate; import java.time.LocalDateTime;

@Data public class ClosedDTO { private BigInteger closed_id; private String title; private LocalDate date; private LocalDateTime created_at; private BigInteger admin_id; private BigInteger hospital_id; }


- ConsultationDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger; import java.time.LocalTime;

@Data public class ConsultationDTO { private BigInteger consultation_id; private String week; private LocalTime opening; private LocalTime close; private Integer off; private BigInteger room_id; }


- DiseaseDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger; @Data public class Disease_DTO { private BigInteger disease_id; private String name; private BigInteger user_id; }

- DoctorDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger; import java.time.LocalDate; import java.time.LocalDateTime;

@Data public class DoctorDTO { private BigInteger doctor_id; private String email; private String name; private String position; private char Gender; private LocalDate birthdate; private String phone; private String address; private Integer banned; private LocalDate sign_out; private LocalDateTime created_at; private LocalDateTime updated_at; private BigInteger hospital_id; }

- HospitalDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger; import java.time.LocalDate; import java.time.LocalDateTime;

@Data public class HospitalDTO { private BigInteger hospital_id; private String tel; private String owner; private LocalDate registration; private String address; private String corporate; private LocalDateTime create_at; private LocalDateTime updated_at; }


- MajorDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger; import java.time.LocalDate;

@Data public class MajorDTO { private BigInteger major_id; private String title; private String degree; private String school; private LocalDate graduate; private BigInteger doctor_id; }


- MedicationDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger;

@Data public class MedicationDTO { private BigInteger medication_id; private String name; private String manufacturer; private BigInteger user_id; }


- NoticeDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger; import java.time.LocalDateTime;

@Data public class NoticeDTO { private BigInteger notice_id; private String title; private String description; private LocalDateTime created_at; private LocalDateTime updated_at; private BigInteger hospital_id; private BigInteger admin_id; }

- ReserveDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger; import java.time.LocalDateTime; @Data public class ReserveDTO { private BigInteger reserve_id; private LocalDateTime reservation; private Integer reservation_status; private LocalDateTime confirmed; private BigInteger user_id; private BigInteger hospital_id; private BigInteger room_id; }

- RoomDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger; @Data public class RoomDTO { private BigInteger room_id; private String name; private String area; private String floor; private String call_number; private BigInteger hospital_id; private BigInteger doctor_id; }

- UserDTO

package com.vitamin.app.dto;

import lombok.Data;

import java.math.BigInteger; import java.time.LocalDate; import java.time.LocalDateTime;

@Data public class UserDTO { private BigInteger user_id; private String password; private String nickname; private String email; private String name; private char gender; private LocalDate birth_date; private String phone; private String address; private Integer banned; private LocalDateTime created_at; private LocalDateTime updated_at; private BigInteger hospital_id; }

hyeonpark-5 commented 7 months ago

mapper.xml 구현

Controller - service(service, serviceImpl) - mapper - mapper.xml - DB


INSERT INTO notice( notice_id , title , description , create_at , update_at )VALUES ( #{notice_id} , #{title} , #{description} , {create_at} , {update_at} ); UPDATE notice SET title = #{title} , description = #{description} , create_at = #{create_at} , update_at = #{update_at} WHERE notice_id = #{notice_id} DELETE FROM notice WHERE notice_id = #{notice_id} INSERT INTO reserve( closed_id , title , date , create_at )VALUES ( #{closed_id} , #{title} , #{date} , {create_at} ); UPDATE reserve SET reserve_status = #{reserve_status} WHERE reserve_id = #{reserve_id} DELETE FROM reserve WHERE reserve_id = #{reserve_id}
- DoctorMapper.xml

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

INSERT INTO doctor( doctor_id , email , name , position , gender , birthdate , phone , address , banned , sign_out , created_at , updated_at , hospital_id )VALUES ( #{doctor_id} , #{email} , #{name} , {position} , {gender} , {birthdate} , {phone} , {address} , {banned} , {sign_out} , {created_at} , {updated_at} , {hospital_id} ); INSERT INTO major( major_id , title , degree , school , graduate , doctor_id )VALUES ( #{major_id} , #{title} , #{degree} , {school} , {graduate} , {doctor_id} ); INSERT INTO medication( medication_id , name , manufacturer )VALUES ( #{medication_id} , #{name} , #{manufacturer} );
- HospitalMapper.xml

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

INSERT INTO hospital( hospital_id , name , tel , owner , registration , address , corporate , created_at , updated_at )VALUES ( #{hospital_id} , #{name} , #{tel} , {owner} , {registration} , {address} , {corporate} , {create_at} , {updated_at} ); INSERT INTO room( room_id , name , area , floor , call_number , hospital_id , doctor_id )VALUES ( #{room_id} , #{name} , #{area} , {floor} , {call_number} , {hospital_id} , {doctor_id} ); INSERT INTO break( break_id , off , break_date , opening , close , created_at , room_id )VALUES ( #{break_id} , #{off} , #{break_date} , {opening} , {close} , {created_at} , {room_id} ); INSERT INTO clinic( clinic_id , title , description , room_id )VALUES ( #{clinic_id} , #{title} , #{description} , {room_id} ); INSERT INTO consultation( consultation_id , week , opening , close , off , room_id )VALUES ( #{consultation_id} , #{week} , #{opening} , {close} , {off} , {room_id} );
- MainMapper.xml

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

UPDATE user SET password = #{password} , nickname = #{nickname} , email = #{email} , name = #{name} , gender = #{gender} , birth_date = #{birth_date} , phone = #{phone} , address = #{address} WHERE user_id = #{user_id} DELETE FROM user WHERE user_id = #{user_id} INSERT INTO reserve( reserve_id , symptom , reservation , reservation_status , confirmed , user_id , hospital_id , room_id )VALUES ( #{reserve_id} , #{symptom} , #{reservation} , {reservation_status} , {confirmed} , {user_id} , {hospital_id} , {room_id} ); UPDATE reserve SET symptom = #{symptom} , reservation = #{reservation} , reservation_status = #{reservation_status} , confirmed = #{confirmed} WHERE reserve_id = #{reserve_id} DELETE FROM reserve WHERE reserve_id = #{reserve_id} INSERT INTO disease( disease_id , name )VALUES ( #{disease_id} , #{name} );
- UserMapper.xml

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

INSERT INTO user ( user_id , password , nickname , email , name , gender , birth_date , phone , address )VALUES ( #{mem.id} , #{mem.password} , #{mem.nickname} , #{mem.email} , #{mem.name} , #{gender} , #{birth_date} , #{phone} , #{address} );