diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java index a0754c6..42e983f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java @@ -1,6 +1,7 @@ package com.ruoyi.web.controller.api; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; @@ -173,6 +174,9 @@ public class AppController extends BaseController { TPatient tPatient = new TPatient(); BeanUtils.copyProperties(appPatientReq, tPatient); + if(UserConstants.NOT_UNIQUE.equals(tPatientService.checkPhoneUnique(tPatient.getPhone()))){ + return AjaxResult.error("手机号已注册"); + } tPatientService.insertTPatient(tPatient); Long identifier = 10000000L + tPatient.getId(); tPatient.setIdentifier(String.valueOf(identifier)); @@ -265,4 +269,12 @@ public class AppController extends BaseController return AjaxResult.success(tPatientService.selectTPatientById(getUserId())); } + @GetMapping("/patient/record/historyData") + @ApiOperation("查询患者历史数据图表") + public AjaxResult getHistoryRecordList(AppRecordReq appRecordReq){ + TRecord tRecord = new TRecord(); + BeanUtils.copyProperties(appRecordReq, tRecord); + return tRecordService.getHistoryList(tRecord); + } + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/TRecordResultReq.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/TRecordResultReq.java index 14732da..39676ac 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/TRecordResultReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/TRecordResultReq.java @@ -43,10 +43,10 @@ public class TRecordResultReq @ApiModelProperty("待诊日期开始时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date startTime; + private String startTime; @ApiModelProperty("待诊日期结束时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date endTime; + private String endTime; public String getName() { @@ -149,22 +149,22 @@ public class TRecordResultReq this.createTime = createTime; } - public Date getStartTime() + public String getStartTime() { return startTime; } - public void setStartTime(Date startTime) + public void setStartTime(String startTime) { this.startTime = startTime; } - public Date getEndTime() + public String getEndTime() { return endTime; } - public void setEndTime(Date endTime) + public void setEndTime(String endTime) { this.endTime = endTime; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TPatientMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TPatientMapper.java index 8988b0d..77d5d4e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TPatientMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TPatientMapper.java @@ -8,7 +8,7 @@ import tk.mybatis.mapper.common.Mapper; /** * 患者信息Mapper接口 - * + * * @author ruoyi * @date 2022-08-03 */ @@ -16,7 +16,7 @@ public interface TPatientMapper { /** * 查询患者信息 - * + * * @param id 患者信息主键 * @return 患者信息 */ @@ -24,7 +24,7 @@ public interface TPatientMapper /** * 查询患者信息列表 - * + * * @param tPatient 患者信息 * @return 患者信息集合 */ @@ -32,7 +32,7 @@ public interface TPatientMapper /** * 新增患者信息 - * + * * @param tPatient 患者信息 * @return 结果 */ @@ -40,7 +40,7 @@ public interface TPatientMapper /** * 修改患者信息 - * + * * @param tPatient 患者信息 * @return 结果 */ @@ -48,7 +48,7 @@ public interface TPatientMapper /** * 删除患者信息 - * + * * @param id 患者信息主键 * @return 结果 */ @@ -56,7 +56,7 @@ public interface TPatientMapper /** * 批量删除患者信息 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ @@ -65,4 +65,6 @@ public interface TPatientMapper public TPatient queryTPatient(TPatient tPatient); List queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq); + + int checkPhoneUnique(String phone); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java index 9ef1d4c..504c354 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java @@ -62,4 +62,6 @@ public interface ITPatientService public int deleteTPatientById(Long id); List queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq); + + String checkPhoneUnique(String phone); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java index f5483a9..2a1c529 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.system.service.impl; import java.util.List; + +import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.system.domain.req.PcTPatintQueryByPageReq; import com.ruoyi.system.domain.resp.PcTPatientQueryByPageResp; @@ -12,19 +14,19 @@ import com.ruoyi.system.service.ITPatientService; /** * 患者信息Service业务层处理 - * + * * @author ruoyi * @date 2022-08-03 */ @Service -public class TPatientServiceImpl implements ITPatientService +public class TPatientServiceImpl implements ITPatientService { @Autowired private TPatientMapper tPatientMapper; /** * 查询患者信息 - * + * * @param id 患者信息主键 * @return 患者信息 */ @@ -36,7 +38,7 @@ public class TPatientServiceImpl implements ITPatientService /** * 查询患者信息列表 - * + * * @param tPatient 患者信息 * @return 患者信息 */ @@ -48,7 +50,7 @@ public class TPatientServiceImpl implements ITPatientService /** * 新增患者信息 - * + * * @param tPatient 患者信息 * @return 结果 */ @@ -61,7 +63,7 @@ public class TPatientServiceImpl implements ITPatientService /** * 修改患者信息 - * + * * @param tPatient 患者信息 * @return 结果 */ @@ -74,7 +76,7 @@ public class TPatientServiceImpl implements ITPatientService /** * 批量删除患者信息 - * + * * @param ids 需要删除的患者信息主键 * @return 结果 */ @@ -86,7 +88,7 @@ public class TPatientServiceImpl implements ITPatientService /** * 删除患者信息信息 - * + * * @param id 患者信息主键 * @return 结果 */ @@ -100,4 +102,15 @@ public class TPatientServiceImpl implements ITPatientService public List queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq) { return tPatientMapper.queryByPage(pcTPatintQueryByPageReq); } + + @Override + public String checkPhoneUnique(String phone) + { + int count = tPatientMapper.checkPhoneUnique(phone); + if (count > 0) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml index 5b35117..57e8590 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - + insert into t_patient @@ -105,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from t_patient where id in + delete from t_patient where id in #{id} @@ -152,4 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by a.create_time desc - \ No newline at end of file + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml index 8c6f682..bf13ea1 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml @@ -202,12 +202,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and DATE_FORMAT(tp.create_time,'%Y-%m') = DATE_FORMAT(#{createTime},'%Y-%m') - - AND tr.create_time between DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') and DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s') - - - order by tr.create_time ${doctorOder}, tp.create_time ${firstVisitOder} + and tr.create_time >= #{startTime} + and tr.create_time <= #{endTime} + and tr.create_time between #{startTime} and #{endTime} + order by tr.create_time ${doctorOder}, tp.create_time ${firstVisitOder}