一对多完善

This commit is contained in:
czx 2020-12-29 18:41:11 +08:00
parent e73d581adf
commit 1a6837f49e
5 changed files with 23 additions and 8 deletions

View File

@ -28,8 +28,6 @@ public class ClientPatientController extends BaseController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String createAt = sdf.format(new Date()); String createAt = sdf.format(new Date());
FtPatientVo reportMealsToday = iFtPatientDaoService.getReportMealsToday("2020-12-29", patientId); return AjaxResult.success(iFtPatientDaoService.getReportMealsToday("2020-12-29", patientId));
return AjaxResult.success(reportMealsToday);
} }
} }

View File

@ -51,5 +51,5 @@ public interface FtPatientDaoMapper extends BaseMapper<FtPatientDao> {
@Select("select a.hospital_id, a.name, a.depart_name, a.bed_id, b.depart_id, c.hospital_id as old_hospital_id, c.name as old_name, a.depart_name as old_depart_name, c.bed_id as old_bed_id, c.depart_id as old_depart_id, c.patient_id as patient_id from ft_sync a LEFT JOIN ft_depart b on a.depart_name = b.depart_name LEFT JOIN ft_patient c on a.hospital_id = c.hospital_id where b.depart_id = c.depart_id and a.bed_id = c.bed_id and a.name = c.name and c.hospital_id!=a.hospital_id") @Select("select a.hospital_id, a.name, a.depart_name, a.bed_id, b.depart_id, c.hospital_id as old_hospital_id, c.name as old_name, a.depart_name as old_depart_name, c.bed_id as old_bed_id, c.depart_id as old_depart_id, c.patient_id as patient_id from ft_sync a LEFT JOIN ft_depart b on a.depart_name = b.depart_name LEFT JOIN ft_patient c on a.hospital_id = c.hospital_id where b.depart_id = c.depart_id and a.bed_id = c.bed_id and a.name = c.name and c.hospital_id!=a.hospital_id")
List<ftSyncConflictVo> syncConflictOtherAllEqual(); List<ftSyncConflictVo> syncConflictOtherAllEqual();
FtPatientVo getReportMealsToday(@Param("createAt") String createAt, @Param("patientId") Long patientId); List<FtPatientVo> getReportMealsToday(@Param("createAt") String createAt, @Param("patientId") Long patientId);
} }

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.fantang.service; package com.ruoyi.system.fantang.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.fantang.domain.FtPatientDao; import com.ruoyi.system.fantang.domain.FtPatientDao;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.system.fantang.vo.FtPatientVo; import com.ruoyi.system.fantang.vo.FtPatientVo;
@ -14,5 +15,5 @@ import java.util.List;
*/ */
public interface IFtPatientDaoService extends IService<FtPatientDao> { public interface IFtPatientDaoService extends IService<FtPatientDao> {
FtPatientVo getReportMealsToday(String createAt, Long patientId ); AjaxResult getReportMealsToday(String createAt, Long patientId );
} }

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.fantang.service.impl; package com.ruoyi.system.fantang.service.impl;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.fantang.vo.FtPatientVo; import com.ruoyi.system.fantang.vo.FtPatientVo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -19,7 +20,7 @@ import java.util.List;
public class FtPatientDaoServiceImpl extends ServiceImpl<FtPatientDaoMapper, FtPatientDao> implements IFtPatientDaoService { public class FtPatientDaoServiceImpl extends ServiceImpl<FtPatientDaoMapper, FtPatientDao> implements IFtPatientDaoService {
@Override @Override
public FtPatientVo getReportMealsToday(String createAt, Long patientId) { public AjaxResult getReportMealsToday(String createAt, Long patientId) {
return this.baseMapper.getReportMealsToday(createAt, patientId); return AjaxResult.success(this.baseMapper.getReportMealsToday(createAt, patientId));
} }
} }

View File

@ -14,6 +14,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="offFlag" column="off_flag" /> <result property="offFlag" column="off_flag" />
<result property="createAt" column="create_at" /> <result property="createAt" column="create_at" />
</resultMap> </resultMap>
<select id="getReportMealsToday" resultMap="patientReportMealsList">
SELECT a.patient_id, a.`name`, b.depart_name, a.bed_id, a.hospital_id, c.create_at, c.foods, c.id, c.nutrition_food_id, c.type from ft_patient a
LEFT JOIN ft_depart b on a.depart_id = b.depart_id
RIGHT JOIN ft_report_meals c on a.patient_id = c.patient_id
WHERE a.patient_id = #{patientId} and c.create_at = #{createAt}
</select>
<resultMap id="patientReportMealsList" type="com.ruoyi.system.fantang.vo.FtPatientVo">
<collection property="reportMealsList" ofType="com.ruoyi.system.fantang.domain.FtReportMealsDao">
<result property="id" column="id"></result>
<result property="createAt" column="create_at"></result>
<result property="type" column="type"></result>
<result property="foods" column="foods"></result>
<result property="nutritionFoodId" column="nutrition_food_id"></result>
</collection>
</resultMap>
</mapper> </mapper>