Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
RIT_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박권수
2021-10-10 21:22:16 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fddba9b0495da5a49dbd378b6f74a156f9ca2a2e
fddba9b0
1 parent
646d1ba1
feat. 차트 및 상세사항 변경
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
12 deletions
web/src/util/makeChart.ts
web/src/views/bottleInfo/BottleInfoContainer.tsx
web/src/views/bottleInfo/BottleInfoPresenter.tsx
web/src/views/bottleInfo/BottleInfoStyled.tsx
web/src/util/makeChart.ts
View file @
fddba9b
import
moment
from
'moment'
;
export
const
make
=
(
chartData
:
any
[],
numberOfRow
:
number
)
=>
{
export
const
make
=
(
takeMedicineHist
:
any
[],
numberOfRow
:
number
)
=>
{
const
now
=
new
Date
();
const
result
:
any
=
{};
new
Array
(
numberOfRow
).
fill
(
null
).
forEach
((
item
:
any
,
index
:
number
)
=>
{
new
Array
(
numberOfRow
).
fill
(
null
).
forEach
(()
=>
{
const
key
=
moment
(
now
).
format
(
'MM/DD'
);
result
[
key
]
=
0
;
now
.
setDate
(
now
.
getDate
()
-
1
);
})
})
;
chartData
.
forEach
((
data
:
any
)
=>
{
takeMedicineHist
.
forEach
((
data
:
any
)
=>
{
const
key
:
string
=
moment
(
data
.
takeDate
).
format
(
'MM/DD'
);
!
isNaN
(
result
[
key
])
?
result
[
key
]
=
result
[
key
]
+
1
:
null
;
!
isNaN
(
result
[
key
])
?
result
[
key
]
=
result
[
key
]
+
data
.
dosage
:
null
;
});
const
categories
:
any
=
[];
...
...
web/src/views/bottleInfo/BottleInfoContainer.tsx
View file @
fddba9b
...
...
@@ -52,7 +52,7 @@ const BottleInfoContainer = (props : BottleInfoProps) => {
categories : [],
},
series : [{
name : '약 복용
횟수
',
name : '약 복용
회분
',
color : '#337DFF',
data : [],
}],
...
...
@@ -75,7 +75,12 @@ const BottleInfoContainer = (props : BottleInfoProps) => {
try {
const result = await doctorApi.getPatientBottleDetail(token, bottleId);
if (result.statusText === 'OK') {
setTakeMedicineHist(result.data.takeMedicineHist);
setTakeMedicineHist(result.data.takeMedicineHist.map((takeMedicine : any) => {
return ({
...takeMedicine,
takeDate : moment(takeMedicine.takeDate).format('YYYY년 MM월 DD일 hh시 mm분'),
});
}));
const { categories, data } = makeChart.make(result.data.takeMedicineHist, numberOfChartItem);
setBottleInfo({
...result.data,
...
...
web/src/views/bottleInfo/BottleInfoPresenter.tsx
View file @
fddba9b
...
...
@@ -72,6 +72,10 @@ const BottleInfoPresenter = (props : BottleInfoProps) => {
</styled.HistDtmWrapper>
<styled.HistInfoWrapper>
<styled.HistInfoEachWrapper>
복용량
<styled.HistInfoEach>{hist.dosage}회분</styled.HistInfoEach>
</styled.HistInfoEachWrapper>
<styled.HistInfoEachWrapper>
약병 내 온도
<styled.HistInfoEach>{hist.temperature}℃</styled.HistInfoEach>
</styled.HistInfoEachWrapper>
...
...
@@ -79,10 +83,6 @@ const BottleInfoPresenter = (props : BottleInfoProps) => {
약병 내 습도
<styled.HistInfoEach>{hist.humidity}%</styled.HistInfoEach>
</styled.HistInfoEachWrapper>
<styled.HistInfoEachWrapper>
약병 내 잔량
<styled.HistInfoEach>{hist.balance}%</styled.HistInfoEach>
</styled.HistInfoEachWrapper>
</styled.HistInfoWrapper>
</styled.HistWrapper>
)
...
...
web/src/views/bottleInfo/BottleInfoStyled.tsx
View file @
fddba9b
...
...
@@ -72,7 +72,7 @@ export const HistDtmWrapper = styled.div `
`;
export const HistDtm = styled.div `
font-size : 1
8
px;
font-size : 1
6
px;
color : #000;
`;
...
...
Please
register
or
login
to post a comment