From 73fb025a5fd499cb82d7fc87182bce9d4f9cf586 Mon Sep 17 00:00:00 2001 From: chenfei <18955928961@163.com> Date: Thu, 11 Aug 2022 11:10:02 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B0=B1=E8=AF=8A?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=97=A5=E6=9C=9F=E6=9F=A5=E8=AF=A2=E5=8F=8A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=82=A3=E8=80=85=E6=89=8B=E6=9C=BA=E5=8F=B7?= =?UTF-8?q?=E5=94=AF=E4=B8=80=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/api/AppController.java | 4 +++ .../system/domain/req/TRecordResultReq.java | 12 ++++---- .../ruoyi/system/mapper/TPatientMapper.java | 16 +++++----- .../system/service/ITPatientService.java | 2 ++ .../service/impl/TPatientServiceImpl.java | 29 ++++++++++++++----- .../mapper/system/TPatientMapper.xml | 16 ++++++---- .../resources/mapper/system/TRecordMapper.xml | 7 ++--- 7 files changed, 55 insertions(+), 31 deletions(-) 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..e4cc6c4 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)); 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..193f29a 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml @@ -202,10 +202,9 @@ 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') - - + 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} From 59348b7162dc10dd2f83f1b930db262527d99b70 Mon Sep 17 00:00:00 2001 From: chenfei <18955928961@163.com> Date: Thu, 11 Aug 2022 11:37:07 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=B0=B1=E8=AF=8A=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml index 193f29a..bf13ea1 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml @@ -205,8 +205,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 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} + order by tr.create_time ${doctorOder}, tp.create_time ${firstVisitOder}