Skip to content

Commit

Permalink
[feat] 의사버전 수정 완료
Browse files Browse the repository at this point in the history
  • Loading branch information
seunghee17 committed May 23, 2024
1 parent c103bf1 commit c5341e0
Show file tree
Hide file tree
Showing 20 changed files with 310 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package com.example.remind.data.model.response

data class GetDailyMoodResponse(
val code: Int,
val `data`: Data,
val `data`: DailyActivity,
val message: String
)
data class Data(
data class DailyActivity(
val activities: List<Activities> = emptyList(),
val feelingType: String = "",
val moodDetail: String = ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.example.remind.data.model.response

data class ListData(
val name: String=""
)
//data class ListData(
// val name: String=""
//)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.example.remind.data.model.response

data class MemberInfoResponse(
val code: Int,
val `data`: Info,
val message: String
)
data class Info(
val age: Int=0,
val gender: String="",
val imageUrl: String="",
val name: String=""
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ package com.example.remind.data.network.service
import com.example.remind.data.model.request.KakaoLoginRequest
import com.example.remind.data.model.request.OnBoardingRequest
import com.example.remind.data.model.request.TokenRequest
import com.example.remind.data.model.response.MemberInfoResponse
import com.example.remind.data.model.response.OnBoardingResponse
import com.example.remind.data.model.response.SocialLoginResponse
import com.example.remind.data.model.response.TokenResponse
import com.example.remind.data.network.adapter.ApiResult
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

interface AuthService {
@POST("/member/refresh")
Expand All @@ -25,4 +28,9 @@ interface AuthService {
suspend fun OnBoarding(
@Body body: OnBoardingRequest
): ApiResult<OnBoardingResponse>

@GET("/member/info")
suspend fun MemberInfo(
@Query("memberId") memberId:Int
): ApiResult<MemberInfoResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.example.remind.data.network.service
import com.example.remind.data.model.request.SetAcceptrequest
import com.example.remind.data.model.response.GetAcceptResponse
import com.example.remind.data.model.response.GetPatientResponse
import com.example.remind.data.model.response.MoodChartResponse
import com.example.remind.data.network.adapter.ApiResult
import retrofit2.http.Body
import retrofit2.http.GET
Expand All @@ -19,4 +20,13 @@ interface DoctorService {
suspend fun setRequest(
@Body body: SetAcceptrequest
): ApiResult<GetAcceptResponse>

@GET("/mood/chart/connection")
suspend fun getPatienceMoodChart(
@Query("year") year: Int,
@Query("month") month: Int,
@Query("day") day: Int,
@Query("size") size: Int,
@Query("memberId") memberId: Int,
): ApiResult<MoodChartResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package com.example.remind.data.repository.auth

import com.example.remind.data.model.request.KakaoLoginRequest
import com.example.remind.data.model.request.OnBoardingRequest
import com.example.remind.data.model.request.TokenRequest
import com.example.remind.data.model.response.MemberInfoResponse
import com.example.remind.data.model.response.OnBoardingResponse
import com.example.remind.data.model.response.SocialLoginResponse
import com.example.remind.data.model.response.TokenResponse
import com.example.remind.data.network.adapter.ApiResult
import retrofit2.http.Body

interface AuthRepository {
suspend fun getTokenFromKakao(body: KakaoLoginRequest): ApiResult<SocialLoginResponse>
suspend fun postOnBoardingInfo(body: OnBoardingRequest): ApiResult<OnBoardingResponse>
suspend fun getMemberInfo(memberId: Int): ApiResult<MemberInfoResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package com.example.remind.data.repository.auth

import com.example.remind.data.model.request.KakaoLoginRequest
import com.example.remind.data.model.request.OnBoardingRequest
import com.example.remind.data.model.request.TokenRequest
import com.example.remind.data.model.response.MemberInfoResponse
import com.example.remind.data.model.response.OnBoardingResponse
import com.example.remind.data.model.response.SocialLoginResponse
import com.example.remind.data.model.response.TokenResponse
import com.example.remind.data.network.adapter.ApiResult
import com.example.remind.data.network.service.AuthService
import javax.inject.Inject
Expand All @@ -22,4 +21,8 @@ class AuthRepositoryImpl @Inject constructor(
return service.OnBoarding(body)
}

override suspend fun getMemberInfo(memberId: Int): ApiResult<MemberInfoResponse> {
return service.MemberInfo(memberId)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package com.example.remind.data.repository.doctor
import com.example.remind.data.model.request.SetAcceptrequest
import com.example.remind.data.model.response.GetAcceptResponse
import com.example.remind.data.model.response.GetPatientResponse
import com.example.remind.data.model.response.MoodChartResponse
import com.example.remind.data.network.adapter.ApiResult

interface DoctorRepository {
suspend fun getPatientList(status: String): ApiResult<GetPatientResponse>
suspend fun getRequest(body: SetAcceptrequest): ApiResult<GetAcceptResponse>
suspend fun getMoodChart(year: Int, month: Int, day: Int, size: Int, memberId: Int): ApiResult<MoodChartResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.example.remind.data.repository.doctor
import com.example.remind.data.model.request.SetAcceptrequest
import com.example.remind.data.model.response.GetAcceptResponse
import com.example.remind.data.model.response.GetPatientResponse
import com.example.remind.data.model.response.MoodChartResponse
import com.example.remind.data.network.adapter.ApiResult
import com.example.remind.data.network.service.DoctorService
import javax.inject.Inject
Expand All @@ -18,4 +19,14 @@ class DoctorRepositoryImpl @Inject constructor(
return service.setRequest(body)
}

override suspend fun getMoodChart(
year: Int,
month: Int,
day: Int,
size: Int,
memberId: Int
): ApiResult<MoodChartResponse> {
return service.getPatienceMoodChart(year, month, day, size, memberId)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.example.remind.domain.usecase.doctor_usecase

import com.example.remind.data.model.response.MoodChartResponse
import com.example.remind.data.network.adapter.ApiResult
import com.example.remind.data.repository.doctor.DoctorRepository
import javax.inject.Inject

class GetDoctorMoodChartUseCase @Inject constructor(
private val doctorRepository: DoctorRepository
) {
suspend operator fun invoke(
year: Int,
month: Int,
day: Int,
size: Int,
memberId: Int
): ApiResult<MoodChartResponse> {
return doctorRepository.getMoodChart(year, month, day, size, memberId)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.remind.domain.usecase.onboarding_usecase

import com.example.remind.data.model.response.MemberInfoResponse
import com.example.remind.data.network.adapter.ApiResult
import com.example.remind.data.repository.auth.AuthRepository
import javax.inject.Inject

class MemberInfoUseCase @Inject constructor(
private val authRepository: AuthRepository
) {
suspend operator fun invoke(memberId: Int): ApiResult<MemberInfoResponse> {
return authRepository.getMemberInfo(memberId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.example.remind.core.base.UiEvent
import com.example.remind.core.base.UiState
import com.example.remind.data.model.response.DoctorData
import com.example.remind.data.model.response.GetMonthlyMedicineResponse
import com.example.remind.data.model.response.Info
import com.example.remind.data.model.response.Mood
import com.example.remind.data.model.response.PercentList
import com.example.remind.data.model.response.Prescription
Expand All @@ -26,6 +27,8 @@ class DoctorContract {
val prescription: Prescription = Prescription(),
val getMonthlyMedicineResponse: GetMonthlyMedicineResponse = GetMonthlyMedicineResponse(),
val feelingTotalPerCent: List<PercentList> = emptyList(),
val memberInfo: Info = Info(),
val patientInfo: Info = Info()
): UiState

sealed class Event: UiEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand All @@ -21,19 +22,23 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavHostController
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
import com.bumptech.glide.integration.compose.GlideImage
import com.example.remind.R
import com.example.remind.core.common.component.BasicButton
import com.example.remind.core.common.component.BasicListItem
import com.example.remind.core.common.component.MainAppBar
import com.example.remind.core.common.component.RemindSearchTextField
import com.example.remind.core.designsystem.theme.RemindTheme
import com.example.remind.data.model.response.Info
import kotlinx.coroutines.flow.collectLatest

@OptIn(ExperimentalFoundationApi::class)
Expand All @@ -49,6 +54,7 @@ fun DoctorMain(
LaunchedEffect(Unit) {
viewModel.getPatients()
viewModel.getRequestPatients()
viewModel.getMemberInfo()
}

LaunchedEffect(true) {
Expand All @@ -75,7 +81,10 @@ fun DoctorMain(
modifier = Modifier.padding(start = 26.dp, end = 28.dp),
) {
item {
Profile(modifier = Modifier)
Profile(
modifier = Modifier,
myInfo = uiState.memberInfo
)
}
stickyHeader {
StickyHeaderComponent(
Expand Down Expand Up @@ -115,30 +124,34 @@ fun DoctorMain(
}


@OptIn(ExperimentalGlideComposeApi::class)
@Composable
fun Profile(modifier: Modifier) {
fun Profile(
modifier: Modifier,
myInfo: Info
) {
Row(
modifier = modifier
.fillMaxWidth()
.padding(start = 20.dp, end = 24.dp),
verticalAlignment = Alignment.CenterVertically
) {
//예비
Icon(
painter = painterResource(id = R.drawable.ic_logo),
contentDescription = null,
modifier = modifier
.size(width = 71.dp, height = 95.dp)
.padding(start = 20.dp),
tint = RemindTheme.colors.main_1
GlideImage(
modifier = Modifier
.size(width = 80.dp, height = 80.dp)
.clip(RoundedCornerShape(10.dp))
.padding(end = 8.dp),
contentScale = ContentScale.Crop,
model = myInfo.imageUrl,
contentDescription = null
)
Column(
modifier = modifier
.fillMaxWidth()
) {
Text(
modifier = modifier.padding(end = 24.dp, bottom = 4.dp),
text = "김말랑 ",
text = "${myInfo.name}",
style = RemindTheme.typography.b1Bold
)
Text(
Expand All @@ -165,10 +178,10 @@ fun StickyHeaderComponent(
modifier = modifier
.background(color = RemindTheme.colors.white)
.padding(
start = 44.dp,
top = 14.dp,
bottom = 9.dp
),
start = 44.dp,
top = 14.dp,
bottom = 9.dp
),
text = stringResource(R.string.관리_중인_환자),
style = RemindTheme.typography.b3Bold.copy(color = RemindTheme.colors.main_6)
)
Expand Down Expand Up @@ -210,6 +223,7 @@ fun StickyHeaderComponent(
RemindSearchTextField(
modifier = Modifier
.weight(1f)
.fillMaxHeight()
.padding(start = 14.dp),
hintText = stringResource(R.string.검색),
onValueChange = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ fun DoctorMedicineManage(
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
val effectFlow = viewModel.effect
val scrollState = rememberScrollState()

LaunchedEffect(true) {
effectFlow.collectLatest { effect ->
when(effect) {
Expand All @@ -53,7 +54,7 @@ fun DoctorMedicineManage(
}
}
}
val patientInfo = uiState.acceptList.patientDtos.find { it.memberId == uiState.memberId }
//val patientInfo = uiState.acceptList.patientDtos.find { it.memberId == uiState.memberId }
RemindTheme {
Column(
modifier = Modifier
Expand All @@ -63,7 +64,7 @@ fun DoctorMedicineManage(
.verticalScroll(scrollState)
) {
BasicBackAppBar (
modifier = Modifier,
modifier = Modifier.padding(top = 20.dp),
onClick = {navController.navigateUp()},
title = "환자 관리"
)
Expand All @@ -72,7 +73,7 @@ fun DoctorMedicineManage(
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = "${patientInfo?.name}님의 약 처방",
text = "${uiState.patientInfo.name}님의 약 처방",
style = RemindTheme.typography.b2Bold.copy(color = RemindTheme.colors.text)
)
Spacer(modifier = Modifier.weight(1f))
Expand All @@ -92,7 +93,8 @@ fun DoctorMedicineManage(
)
BasicButton(
modifier = Modifier
.fillMaxWidth(),
.fillMaxWidth()
.padding(top = 7.dp),
text = "약 처방 업데이트",
RoundedCorner = 12.dp,
backgroundColor = RemindTheme.colors.main_6,
Expand Down Expand Up @@ -186,6 +188,7 @@ fun PatientMedicineContainer(
Text(
modifier = modifier
.fillMaxWidth()
.padding(bottom = 11.dp)
.background(
color = RemindTheme.colors.main_2,
shape = RoundedCornerShape(20.dp)
Expand Down
Loading

0 comments on commit c5341e0

Please sign in to comment.