์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- Absolute
- AGI
- ai
- AI agents
- AI engineer
- AI researcher
- ajax
- algorithm
- Algorithms
- aliases
- Array ๊ฐ์ฒด
- ASI
- bayes' theorem
- Bit
- Blur
- BOM
- bootstrap
- canva
- challenges
- ChatGPT
- Today
- In Total
A Joyful AI Research Journey๐ณ๐
[10] 230426 ํ ํ๋ก์ ํธ (1) 10์ผ ์ฐจ Wed) ํ ๊ฒ ๋ชฉ๋ก ์์ ๋ฐ ์ฝ๋, *๋ชจ๋ธ ๋ณธ๋ฌธ
[10] 230426 ํ ํ๋ก์ ํธ (1) 10์ผ ์ฐจ Wed) ํ ๊ฒ ๋ชฉ๋ก ์์ ๋ฐ ์ฝ๋, *๋ชจ๋ธ
yjyuwisely 2023. 4. 26. 07:00230426 Wed 83rd class
์ฐ์ ํ ๊ฒ
1) ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ฟผ๋ฆฌ ์ ์
Create a MySQL database and tables to store the necessary information.
MySQL (ateam)
- certificate(PatientVO): id, Diagnostic, patientcode, admission_date, discharge_date, disease, opertation, surg_date
- member(MemberVO): id(UUID), email, password, name, residentid, phone, doctor (n/y)
1) ์ง๋ฃํ์ธ์: ํ์ ์ ๋ณด name, residentid, phone + ์๋ณ๋ช
disease
2) ์
,ํด์ํ์ธ์: ํ์ ์ ๋ณด name, residentid, phone + ์
์ ๋ ์ง admission_date, ํด์ ๋ ์ง discharge_date
3) ์์ ํ์ธ์: ํ์ ์ ๋ณด name, residentid, phone + ์๋ณ๋ช
disease, ์์ ๋ช
operation, ์์ ๋ ์ง surg_date
ํ์์ด๋ฆ ${member.name} ์ฃผ๋ฏผ๋ฑ๋ก๋ฒํธ ${member.residentid}
๋ณ๋ช
${certificate.disease} ์
์ ๋ ์ง ${certificate.admission_date} ํด์ ๋ ์ง ${certificate.discharge_date}
์์ ๋ช
${certificate.opertation} ์์ ์ผ์ ${certificate.surg_date}
2) JSP ํ์ผ ํ๊ทธ ์์ ํด์ ๋ฐ์ดํฐ ์ฝ์ด๋ค์ธ๋ค. [์๋ฃ]
Write JSP pages to display the data to the patient. You can use JSTL tags to iterate through the data and display it on the web page.
3) ๋ง์ด๋ฐํฐ์ค ์จ์ MemberVO๋ PatientVO์ ์ฐ๊ฒฐ
Write the MyBatis configuration file (mybatis-config.xml) and map the MemberVO and PatientVO classes to their respective database tables.
=> ์ด๋ฏธ root-context.xml์ ์์. ํ์ผ ๋ง๋ค ํ์ ์๋ ๋ฏ
<!-- Mybatis ๊ด๋ จ ์ค์ SessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
</bean>
<mybatis-spring:scan base-package="com.obj.mapper"/>
<context:component-scan base-package="com.obj.service"/>
์ฝ๋)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<typeAliases>
<typeAlias type="com.obj.vo.MemberVO" alias="MemberVO" />
<typeAlias type="com.obj.vo.PatientVO" alias="PatientVO" />
</typeAliases>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://192.168.30.79:3306/ateam?useSSL=false&serverTimezone=Asia/Seoul" />
<property name="username" value="totoro" />
<property name="password" value="1234" />
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="com/obj/mapper/MemberMapper.xml" />
<mapper resource="com/obj/mapper/PatientMapper.xml" />
</mappers>
</configuration>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
environments : DB ์ฐ๊ฒฐ ์ค์ , environment id๋ฅผ ๊ตฌ๋ถํ์ฌ ์ฐ๊ฒฐํ DB๋ฅผ ์ฌ๋ฌ ๊ฐ ๊ตฌ์ฑํ ์ ๋
์์
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<dataSource type="POOLED">
<property name="driverClassName"
value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl"
value="jdbc:mysql://192.168.30.79:3306/ateam?allowMultiQueries=true"></property>
<property name="username" value="totoro"></property>
<property name="password" value="1234"></property>
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="com/obj/mapper/CertificateMapper.xml" />
</mappers>
</configuration>
4) CertificateMapper.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">
<mapper namespace="com.obj.mapper.CertificateMapper">
<!-- used INNER JOIN to combine data from two tables (patient and certificate)
that share a common field (id). -->
<!-- ์ง๋ฃํ์ธ์ -->
<select id="GeneralDown" resultMap="PatientResultMap">
SELECT p.name, p.residentid, c.disease
FROM patient p
INNER JOIN certificate c ON p.id = c.id
WHERE
p.name = #{name} and p.residentid = #{residentid}
AND c.disease = #{disease}
</select>
<!-- ์
,ํด์ํ์ธ์ -->
<select id="InoutDown" resultMap="PatientResultMap">
SELECT p.name, p.residentid,
c.admission_date, c.discharge_date
FROM patient p
INNER JOIN certificate c ON p.id = c.id
WHERE p.name = #{name} and p.residentid = #{residentid}
AND c.admission_date = #{admission_date} and c.discharge_date = #{discharge_date}
</select>
<!-- ์์ ํ์ธ์ -->
<select id="SergDown" resultMap="PatientResultMap">
SELECT p.name, p.residentid, c.disease, c.operation, c.surge_date
FROM patient p
INNER JOIN certificate c ON p.id = c.id
WHERE p.name = #{name} and p.residentid = #{residentid}
AND c.disease = #{disease} and c.operation = #{operation} and c.surge_date = #{surge_date}
</select>
<!-- The resultMap (๋ณต์กํ ๊ฒฐ๊ณผ ๋งคํ์ ๊ฐํธํ๊ฒ ๋ง๋ค์ด์ฃผ๊ธฐ ์ํด ๋ง๋ค์ด์ง ํ๊ทธ)
specifies which columns in the result set
should be mapped to which properties in your Java object. -->
<!-- defined the PatientResultMap, which maps from the name to the surge_date columns
to properties in the PatientVO class. -->
<resultMap id="PatientResultMap"
type="com.obj.model.PatientVO">
<result property="name" column="name" />
<result property="residentid" column="residentid" />
<result property="disease" column="disease" />
<result property="admission_date" column="admission_date" />
<result property="discharge_date" column="discharge_date" />
<result property="operation" column="operation" />
<result property="surge_date" column="surge_date" />
</resultMap>
</mapper>
Write the CertificateMapper.xml file to define the SQL queries to retrieve the necessary data from the database.
<?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">
<mapper namespace="com.obj.mapper.CertificateMapper">
<select id="getMedicalCertificatesByEmail" resultType="com.obj.model.PatientVO">
SELECT * FROM medical_certificate WHERE email = #{email}
</select>
</mapper>
https://suhun918.tistory.com/15
5) CertificateMapper.java ๋ฉ์๋ ์คํ
Implement the CertificateMapper interface in CertificateMapper.java to execute the SQL queries defined in CertificateMapper.xml.
package com.obj.mapper;
import java.util.List;
import com.obj.model.PatientVO;
public interface CertificateMapper {
List<PatientVO> getMedicalCertificatesByEmail(String email);
}
6) Write a servlet to handle requests from the JSP pages and call the appropriate methods in the CertificateService or CertificateMapper classes.
- END XD -
Deploy the web application to a server, such as Tomcat or Jetty, and test it to ensure it is working correctly.
๊ธฐํ ํ์์ ์์ฒญ) JS ๋ก๊ทธ์์ ๊ตฌํ,
https://jobtc.tistory.com/13
๋ก๊ทธ์ธ, ๋ก๊ทธ์์ ๋ฒํผ ํฌ๊ฒ [์๋ฃ]
You can simply retrieve the necessary data using the appropriate DAO or Mapper classes and populate the necessary fields in your JSP or other view technology.
1) CertificateMapper interface that defines the necessary database operations and
2) a corresponding CertificateMapper.xml file that contains the SQL queries to retrieve the data.
You can write a query to retrieve data from the database that matches the selected medical certificate for a specific patient. You may need to join tables to get all the necessary data, depending on how the data is structured in the database.
You can then use the MyBatis framework to execute the queries and map the results to your MemberVO and PatientVO objects.
Once you have the query, you can implement it in your CertificateMapper.xml file. You can then call the method that executes this query from your CertificateMapper.java file.
Finally, you can use the data retrieved to populate the view that displays the medical certificate data to the patient.
On the server-side, create a function that takes the patient and doctor data as parameters and
returns the file for the requested certificate.
Use a web framework like Spring to handle the requests and responses.
the logic to retrieve the patient and doctor data from your MySQL database and
display it on the screen.
Create a new Spring MVC controller that handles the request for the page
that displays the patient and doctor data.
The controller can retrieve the data from the database and pass it to a JSP page,
which can then display the data using HTML and JSP tags.
MySQL DB์์ ๋ฐ์ดํฐ ๋ถ๋ฌ์จ๋ค.
MySQL (ateam)
certificate(PatientVO): id, Diagnostic, patientcode, admission_date, discharge_date, disease, opertation, surg_date
member(MemberVO): id(UUID), email, password, residentid, phone, doctor
1) ์ง๋ฃํ์ธ์: ํ์ ์ ๋ณด name, residentid, phone + ์๋ณ๋ช
disease
2) ์
,ํด์ํ์ธ์: ํ์ ์ ๋ณด name, residentid, phone + ์
์ ๋ ์ง admission_date, ํด์ ๋ ์ง discharge_date
3) ์์ ํ์ธ์: ํ์ ์ ๋ณด name, residentid, phone + ์๋ณ๋ช
disease, ์์ ๋ช
operation, ์์ ๋ ์ง surg_date
๊ฐ ์์ธ ๋ด์ญ ๋ฌ๋ค.
2) ์
,ํด์ํ์ธ์: ์
์ ๋ ์ง admission_date, ํด์ ๋ ์ง discharge_date,
1) ์ง๋ฃํ์ธ์, 3) ์์ ํ์ธ์: ์๋ณ๋ช
disease, ์์ ๋ช
operation
- member: (id), (email), (password), name, residentid, phone
- certificate: id, Diagnostic, patientcode,
1) CertificateVO.java - Start by defining the data model or value object that represents the medical certificate. This should include all the necessary fields to store the relevant information about each certificate.
CertificateRepository.java - Create the repository interface that will define the methods for accessing and manipulating the certificate data in the database. This can include methods for querying, inserting, updating, and deleting certificates.
MyBatis ์ฌ์ฉ ๊ฐ๋ฅ
2) CertificateService.java - Define the service interface that will provide the business logic for handling certificate-related operations. This can include methods for validating certificate data, generating certificate PDFs, and interacting with the repository.
3) CertificateServiceImpl.java - Implement the service interface by creating a concrete class that provides the actual implementation of the business logic. This can include dependencies on other services, such as a PDF generation service or an email service.
4) CertificateController.java - Create the controller class that will handle incoming requests related to certificates. This can include methods for displaying certificate information, downloading certificates, and uploading new certificates. Use the service layer to perform the actual logic for each method.
CertificateVO.java model
contain the necessary data fields to represent a medical certificate.
represents the model or data layer, which contains the attributes and methods that define the data and how it is manipulated.
CertificateRepository.java model
handle the database operations related to the medical certificates
also part of the model layer, specifically the data access layer, and provides an interface for accessing and manipulating the data stored in a database.
CertificateService.java model
provide the business logic for interacting with the CertificateRepository.
the service layer, which contains the business logic and serves as an intermediary between the controller and the repository. These layers are responsible for processing and transforming data to meet the requirements of the application.
CertificateServiceImpl.java model
handle the HTTP requests from the client-side and serve the appropriate response.
the service layer, which contains the business logic and serves as an intermediary between the controller and the repository. These layers are responsible for processing and transforming data to meet the requirements of the application.
CertificateController.java controller
provide the business logic for interacting with the CertificateRepository.
the controller layer, which handles the user input and interacts with the service layer to process the request and send the response back to the user.