Commit 99922c9f authored by mengmeng's avatar mengmeng

Merge branch 'Shen' into 'master'

1.添加预约信息查询接口(根据身份证号码或手机号)

See merge request !1
parents ba552e51 ef71e9da
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="CheckStyle-IDEA-Module">
<option name="configuration">
<map />
</option>
</component>
<component name="FacetManager"> <component name="FacetManager">
<facet type="Spring" name="Spring"> <facet type="Spring" name="Spring">
<configuration /> <configuration />
...@@ -57,8 +52,6 @@ ...@@ -57,8 +52,6 @@
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.9.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.9.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.9.RELEASE" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.9.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.3" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.8.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.8.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.9.3" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.9.3" level="project" />
......
...@@ -56,6 +56,21 @@ public class AppointmentOrderController { ...@@ -56,6 +56,21 @@ public class AppointmentOrderController {
return new Result<AppointmentOrderDTO>().ok(data); return new Result<AppointmentOrderDTO>().ok(data);
} }
@GetMapping("identity/{identity}")
@ApiOperation("根据手机号或身份证号获取信息")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<AppointmentOrderDTO>> queryInfo(@ApiIgnore @RequestParam Map<String, Object> params,
@PathVariable("identity") String identity){
PageData<AppointmentOrderDTO> pageData = appointmentOrderService.getAppointmentInfoPage(params, identity);
return new Result<PageData<AppointmentOrderDTO>>().ok(pageData);
}
@PostMapping @PostMapping
@ApiOperation("保存") @ApiOperation("保存")
public Result save(@RequestBody AppointmentOrderDTO dto){ public Result save(@RequestBody AppointmentOrderDTO dto){
......
package io.hmit.modules.appointment.dao; package io.hmit.modules.appointment.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.dao.BaseDao; import io.hmit.common.dao.BaseDao;
import io.hmit.modules.appointment.dto.AppointmentOrderDTO;
import io.hmit.modules.appointment.entity.AppointmentOrderEntity; import io.hmit.modules.appointment.entity.AppointmentOrderEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -12,5 +14,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,5 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface AppointmentOrderDao extends BaseDao<AppointmentOrderEntity> { public interface AppointmentOrderDao extends BaseDao<AppointmentOrderEntity> {
IPage<AppointmentOrderDTO> getAppointmentInfo(IPage<AppointmentOrderEntity> page, String phone, String idCard);
} }
\ No newline at end of file
package io.hmit.modules.appointment.service; package io.hmit.modules.appointment.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.CrudService; import io.hmit.common.service.CrudService;
import io.hmit.modules.appointment.dto.AppointmentOrderDTO; import io.hmit.modules.appointment.dto.AppointmentOrderDTO;
import io.hmit.modules.appointment.entity.AppointmentOrderEntity; import io.hmit.modules.appointment.entity.AppointmentOrderEntity;
import java.util.Map;
/** /**
* 预约订单表 * 预约订单表
* *
...@@ -12,4 +15,6 @@ import io.hmit.modules.appointment.entity.AppointmentOrderEntity; ...@@ -12,4 +15,6 @@ import io.hmit.modules.appointment.entity.AppointmentOrderEntity;
*/ */
public interface AppointmentOrderService extends CrudService<AppointmentOrderEntity, AppointmentOrderDTO> { public interface AppointmentOrderService extends CrudService<AppointmentOrderEntity, AppointmentOrderDTO> {
PageData<AppointmentOrderDTO> getAppointmentInfoPage(Map<String, Object> params, String identity);
} }
\ No newline at end of file
package io.hmit.modules.appointment.service.impl; package io.hmit.modules.appointment.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.modules.appointment.dao.AppointmentOrderDao; import io.hmit.modules.appointment.dao.AppointmentOrderDao;
import io.hmit.modules.appointment.dto.AppointmentOrderDTO; import io.hmit.modules.appointment.dto.AppointmentOrderDTO;
import io.hmit.modules.appointment.entity.AppointmentOrderEntity; import io.hmit.modules.appointment.entity.AppointmentOrderEntity;
...@@ -9,6 +13,7 @@ import io.hmit.modules.appointment.service.AppointmentOrderService; ...@@ -9,6 +13,7 @@ import io.hmit.modules.appointment.service.AppointmentOrderService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
/** /**
...@@ -20,6 +25,19 @@ import java.util.Map; ...@@ -20,6 +25,19 @@ import java.util.Map;
@Service @Service
public class AppointmentOrderServiceImpl extends CrudServiceImpl<AppointmentOrderDao, AppointmentOrderEntity, AppointmentOrderDTO> implements AppointmentOrderService { public class AppointmentOrderServiceImpl extends CrudServiceImpl<AppointmentOrderDao, AppointmentOrderEntity, AppointmentOrderDTO> implements AppointmentOrderService {
@Resource
private AppointmentOrderDao appointmentOrderDao;
/**
* 电话号码校验(不包含港澳台手机号)
*/
final static String VALIDATE_PHONE = "^(13[0-9]|14[579]|15[0-3,5-9]|16[0-9]|17[0135678]|18[0-9]|19[89])\\d{8}$";
/**
* 身份证校验
*/
final static String ID_NUMBER ="^[1-9]\\d{5}(18|19|20|(3\\d))\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$";
@Override @Override
public QueryWrapper<AppointmentOrderEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<AppointmentOrderEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("id");
...@@ -30,5 +48,18 @@ public class AppointmentOrderServiceImpl extends CrudServiceImpl<AppointmentOrde ...@@ -30,5 +48,18 @@ public class AppointmentOrderServiceImpl extends CrudServiceImpl<AppointmentOrde
return wrapper; return wrapper;
} }
@Override
public PageData<AppointmentOrderDTO> getAppointmentInfoPage(Map<String, Object> params, String identity) {
String phone = null;
String idCard = null;
if (identity.matches(VALIDATE_PHONE)) {
phone = identity;
}
if (identity.matches(ID_NUMBER)) {
idCard = identity;
}
IPage<AppointmentOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<AppointmentOrderDTO> appointmentOrderDTOIPage = appointmentOrderDao.getAppointmentInfo(page, phone, idCard);
return getPageData(appointmentOrderDTOIPage, AppointmentOrderDTO.class);
}
} }
\ No newline at end of file
...@@ -28,5 +28,18 @@ ...@@ -28,5 +28,18 @@
<result property="updateDate" column="update_date"/> <result property="updateDate" column="update_date"/>
</resultMap> </resultMap>
<select id="getAppointmentInfo" resultType="io.hmit.modules.appointment.dto.AppointmentOrderDTO">
SELECT *
FROM appointment_order ao
WHERE
<choose>
<when test="phone != null">
ao.appointment_phone = #{phone}
</when>
<otherwise>
ao.appointment_id_card = #{idCard}
</otherwise>
</choose>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -28,5 +28,18 @@ ...@@ -28,5 +28,18 @@
<result property="updateDate" column="update_date"/> <result property="updateDate" column="update_date"/>
</resultMap> </resultMap>
<select id="getAppointmentInfo" resultType="io.hmit.modules.appointment.dto.AppointmentOrderDTO">
SELECT *
FROM appointment_order ao
WHERE
<choose>
<when test="phone != null">
ao.appointment_phone = #{phone}
</when>
<otherwise>
ao.appointment_id_card = #{idCard}
</otherwise>
</choose>
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment