提交 83379a5e authored 作者: zhu's avatar zhu

1.订单相关接口丰富

2.COS相关内容增加 3.匿名电话增加部分内容
上级 9432a4ec
...@@ -64,6 +64,10 @@ dependencies { ...@@ -64,6 +64,10 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-redis:3.1.3' implementation 'org.springframework.boot:spring-boot-starter-data-redis:3.1.3'
implementation 'redis.clients:jedis:3.7.1' implementation 'redis.clients:jedis:3.7.1'
implementation 'com.github.wechatpay-apiv3:wechatpay-java:0.2.11' implementation 'com.github.wechatpay-apiv3:wechatpay-java:0.2.11'
implementation 'com.qcloud:cos_api:5.6.173'
implementation 'com.qcloud:cos-sts_api:3.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
annotationProcessor "org.projectlombok:lombok:${lombokPluginVersion}" annotationProcessor "org.projectlombok:lombok:${lombokPluginVersion}"
annotationProcessor "org.mapstruct:mapstruct-processor:${mapStructVersion}" annotationProcessor "org.mapstruct:mapstruct-processor:${mapStructVersion}"
...@@ -96,9 +100,9 @@ dependencyManagement { ...@@ -96,9 +100,9 @@ dependencyManagement {
flyway { flyway {
driver = 'com.mysql.cj.jdbc.Driver' driver = 'com.mysql.cj.jdbc.Driver'
url = 'jdbc:mysql://localhost:3306/hospital-server?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&useSSL=false' url = 'jdbc:mysql://localhost:3306/aiming-hospital?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&useSSL=false'
user = 'xiongwei' user = 'root'
password = '11002326' password = '123456'
} }
tasks.named('test') { tasks.named('test') {
......
...@@ -158,8 +158,6 @@ public class DoctorInfo extends BaseDomain { ...@@ -158,8 +158,6 @@ public class DoctorInfo extends BaseDomain {
@Schema(description = "更新时间", nullable = false) @Schema(description = "更新时间", nullable = false)
private java.util.Date updateTime; private java.util.Date updateTime;
private List<DoctorServiceInfo> serviceInfoList;
/** /**
* 设置默认值 * 设置默认值
*/ */
......
...@@ -43,7 +43,7 @@ public class MedicalReport extends BaseDomain { ...@@ -43,7 +43,7 @@ public class MedicalReport extends BaseDomain {
*/ */
@TableField(value = "patient_name") @TableField(value = "patient_name")
@Schema(description = "患者姓名", nullable = false) @Schema(description = "患者姓名", nullable = false)
private Long patientName; private String patientName;
/** /**
* 患者身份证号码 * 患者身份证号码
*/ */
......
...@@ -74,7 +74,7 @@ public class PatientInfo extends BaseDomain { ...@@ -74,7 +74,7 @@ public class PatientInfo extends BaseDomain {
* 身份证号码 * 身份证号码
*/ */
@TableField(value = "id_no") @TableField(value = "id_no")
@Schema(description = "身份证号码", nullable = false) @Schema(description = "身份证号码")
private String idNo; private String idNo;
/** /**
* 手机号码 * 手机号码
...@@ -197,12 +197,6 @@ public class PatientInfo extends BaseDomain { ...@@ -197,12 +197,6 @@ public class PatientInfo extends BaseDomain {
} }
return false; return false;
} }
if (this.getIdNo() == null) {
if (throwException) {
throw new ApiCode.ApiException(-1, "身份证号码不能为空!");
}
return false;
}
if (this.getBornDate() == null) { if (this.getBornDate() == null) {
if (throwException) { if (throwException) {
throw new ApiCode.ApiException(-1, "出生日期不能为空!"); throw new ApiCode.ApiException(-1, "出生日期不能为空!");
......
...@@ -21,6 +21,7 @@ import org.springframework.format.annotation.DateTimeFormat; ...@@ -21,6 +21,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.xwd.hospital.server.base.BaseDomain; import com.xwd.hospital.server.base.BaseDomain;
import com.xwd.hospital.server.enums.YesNoEnum;
import com.xwd.hospital.server.domain.Order; import com.xwd.hospital.server.domain.Order;
@Data @Data
...@@ -55,12 +56,42 @@ public class PhoneOrderRecord extends BaseDomain { ...@@ -55,12 +56,42 @@ public class PhoneOrderRecord extends BaseDomain {
@TableField(value = "order_no") @TableField(value = "order_no")
@Schema(description = "订单号", nullable = false) @Schema(description = "订单号", nullable = false)
private String orderNo; private String orderNo;
/**
* 患者被叫号码
*/
@TableField(value = "patient_phone_no")
@Schema(description = "患者被叫号码")
private String patientPhoneNo;
/**
* 匿名小号号码
*/
@TableField(value = "proxy_phone_no")
@Schema(description = "匿名小号号码")
private String proxyPhoneNo;
/**
* 唯一绑定id
*/
@TableField(value = "mapping_id")
@Schema(description = "唯一绑定id")
private String mappingId;
/**
* 是否解绑状态
*/
@TableField(value = "mapping_state")
@Schema(description = "是否解绑状态", nullable = false)
private YesNoEnum mappingState;
/** /**
* 电话咨询开始时间 * 电话咨询开始时间
*/ */
@TableField(value = "phone_contact_time") @TableField(value = "phone_contact_time")
@Schema(description = "电话咨询开始时间", nullable = false) @Schema(description = "电话咨询开始时间")
private String phoneContactTime; private String phoneContactTime;
/**
* 电话咨询结束时间
*/
@TableField(value = "phone_release_time")
@Schema(description = "电话咨询结束时间")
private String phoneReleaseTime;
/** /**
* 操作人Id * 操作人Id
*/ */
...@@ -93,6 +124,9 @@ public class PhoneOrderRecord extends BaseDomain { ...@@ -93,6 +124,9 @@ public class PhoneOrderRecord extends BaseDomain {
*/ */
@Override @Override
public PhoneOrderRecord setDefault() { public PhoneOrderRecord setDefault() {
if (this.getMappingState() == null) {
this.setMappingState(YesNoEnum.NO);
}
if (this.getEditorId() == null) { if (this.getEditorId() == null) {
this.setEditorId(1L); this.setEditorId(1L);
} }
...@@ -125,9 +159,9 @@ public class PhoneOrderRecord extends BaseDomain { ...@@ -125,9 +159,9 @@ public class PhoneOrderRecord extends BaseDomain {
} }
return false; return false;
} }
if (this.getPhoneContactTime() == null) { if (this.getMappingState() == null) {
if (throwException) { if (throwException) {
throw new ApiCode.ApiException(-1, "电话咨询开始时间不能为空!"); throw new ApiCode.ApiException(-1, "是否解绑状态不能为空!");
} }
return false; return false;
} }
......
/** /**
* 项目:互联网医疗 * 项目:互联网医疗
* 模型分组:服务管理 * 模型分组:服务管理
* 模型名称:续方开药订单记录信息表 * 模型名称:续方开药订单记录信息表
* @Author: xiongwei * @Author: xiongwei
* @Date: 2023-09-05 09:42:00 * @Date: 2023-09-05 09:42:00
*/ */
package com.xwd.hospital.server.domain; package com.xwd.hospital.server.domain;
import java.io.Serializable; import java.io.Serializable;
import com.xwd.hospital.server.rest.res.ApiCode; import com.xwd.hospital.server.rest.res.ApiCode;
import lombok.*; import lombok.*;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.xwd.hospital.server.base.BaseDomain; import com.xwd.hospital.server.base.BaseDomain;
import com.xwd.hospital.server.domain.Order; import com.xwd.hospital.server.domain.Order;
@Data @Data
@Builder(builderMethodName = "newBuilder") @Builder(builderMethodName = "newBuilder")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@TableName("`pms_prescription_order_record`") @TableName("`pms_prescription_order_record`")
@Schema(name = "PrescriptionOrderRecord", description = "续方开药订单记录信息表") @Schema(name = "PrescriptionOrderRecord", description = "续方开药订单记录信息表")
public class PrescriptionOrderRecord extends BaseDomain { public class PrescriptionOrderRecord extends BaseDomain {
/** /**
* Id * Id
*/ */
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
@Schema(description = "Id", nullable = false) @Schema(description = "Id", nullable = false)
private Long id; private Long id;
/** /**
* 订单id * 订单id
*/ */
@TableField(value = "order_id") @TableField(value = "order_id")
@Schema(description = "订单id", nullable = false) @Schema(description = "订单id", nullable = false)
private Long orderId; private Long orderId;
/** /**
* 订单id * 订单id
*/ */
@Schema(description = "订单id") @Schema(description = "订单id")
@TableField(exist = false) @TableField(exist = false)
private Order order; private Order order;
/** /**
* 订单号 * 订单号
*/ */
@TableField(value = "order_no") @TableField(value = "order_no")
@Schema(description = "订单号", nullable = false) @Schema(description = "订单号", nullable = false)
private String orderNo; private String orderNo;
/** /**
* 处方说明 * 处方说明
*/ */
@TableField(value = "prescription_introduce", select = false) @TableField(value = "prescription_introduce", select = false)
@Schema(description = "处方说明", nullable = false) @Schema(description = "处方说明", nullable = false)
private String prescriptionIntroduce; private String prescriptionIntroduce;
/** /**
* 处方图片 * 处方图片
*/ */
@TableField(value = "prescription_image") @TableField(value = "prescription_image")
@Schema(description = "处方图片", nullable = false) @Schema(description = "处方图片", nullable = false)
private String prescriptionImage; private String prescriptionImage;
/** /**
* 操作人Id * 操作人Id
*/ */
@TableField(value = "editor_id") @TableField(value = "editor_id")
@Schema(description = "操作人Id", nullable = false) @Schema(description = "操作人Id", nullable = false)
private Long editorId; private Long editorId;
/** /**
* 操作人 * 操作人
*/ */
@TableField(value = "editor_name") @TableField(value = "editor_name")
@Schema(description = "操作人", nullable = false) @Schema(description = "操作人", nullable = false)
private String editorName; private String editorName;
/** /**
* 创建时间 * 创建时间
*/ */
@TableField(value = "create_time", fill = FieldFill.INSERT) @TableField(value = "create_time", fill = FieldFill.INSERT)
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间", nullable = false) @Schema(description = "创建时间", nullable = false)
private java.util.Date createTime; private java.util.Date createTime;
/** /**
* 更新时间 * 更新时间
*/ */
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "更新时间", nullable = false) @Schema(description = "更新时间", nullable = false)
private java.util.Date updateTime; private java.util.Date updateTime;
/** /**
* 设置默认值 * 设置默认值
*/ */
@Override @Override
public PrescriptionOrderRecord setDefault() { public PrescriptionOrderRecord setDefault() {
if (this.getEditorId() == null) { if (this.getEditorId() == null) {
this.setEditorId(1L); this.setEditorId(1L);
} }
if (this.getEditorName() == null) { if (this.getEditorName() == null) {
this.setEditorName("admin"); this.setEditorName("admin");
} }
if (this.getCreateTime() == null) { if (this.getCreateTime() == null) {
this.setCreateTime(new java.util.Date()); this.setCreateTime(new java.util.Date());
} }
if (this.getUpdateTime() == null) { if (this.getUpdateTime() == null) {
this.setUpdateTime(new java.util.Date()); this.setUpdateTime(new java.util.Date());
} }
return this; return this;
} }
/** /**
* 数据验证 * 数据验证
*/ */
@Override @Override
public boolean validate(boolean throwException) { public boolean validate(boolean throwException) {
if (this.getOrderId() == null) { if (this.getOrderId() == null) {
if (throwException) { if (throwException) {
throw new ApiCode.ApiException(-1, "订单id不能为空!"); throw new ApiCode.ApiException(-1, "订单id不能为空!");
} }
return false; return false;
} }
if (this.getOrderNo() == null) { if (this.getOrderNo() == null) {
if (throwException) { if (throwException) {
throw new ApiCode.ApiException(-1, "订单号不能为空!"); throw new ApiCode.ApiException(-1, "订单号不能为空!");
} }
return false; return false;
} }
if (this.getPrescriptionIntroduce() == null) { if (this.getPrescriptionIntroduce() == null) {
if (throwException) { if (throwException) {
throw new ApiCode.ApiException(-1, "处方说明不能为空!"); throw new ApiCode.ApiException(-1, "处方说明不能为空!");
} }
return false; return false;
} }
if (this.getPrescriptionImage() == null) { if (this.getPrescriptionImage() == null) {
if (throwException) { if (throwException) {
throw new ApiCode.ApiException(-1, "处方图片不能为空!"); throw new ApiCode.ApiException(-1, "处方图片不能为空!");
} }
return false; return false;
} }
if (this.getEditorId() == null) { if (this.getEditorId() == null) {
if (throwException) { if (throwException) {
throw new ApiCode.ApiException(-1, "操作人Id不能为空!"); throw new ApiCode.ApiException(-1, "操作人Id不能为空!");
} }
return false; return false;
} }
if (this.getEditorName() == null) { if (this.getEditorName() == null) {
if (throwException) { if (throwException) {
throw new ApiCode.ApiException(-1, "操作人不能为空!"); throw new ApiCode.ApiException(-1, "操作人不能为空!");
} }
return false; return false;
} }
return true; return true;
} }
/** /**
* 数据验证 * 数据验证
*/ */
@Override @Override
public boolean validate() { public boolean validate() {
return this.validate(false); return this.validate(false);
} }
} }
...@@ -10,8 +10,10 @@ import com.xwd.hospital.server.annotation.ApiCommon;; ...@@ -10,8 +10,10 @@ import com.xwd.hospital.server.annotation.ApiCommon;;
import com.xwd.hospital.server.annotation.AuthUsername;; import com.xwd.hospital.server.annotation.AuthUsername;;
import com.xwd.hospital.server.rest.res.ApiResponse; import com.xwd.hospital.server.rest.res.ApiResponse;
import com.xwd.hospital.server.util.FileUtils; import com.xwd.hospital.server.util.FileUtils;
import com.xwd.hospital.server.util.TencentCOSUtil;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -23,15 +25,15 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -23,15 +25,15 @@ import org.springframework.web.multipart.MultipartFile;
@RequestMapping("/v1/system/upload") @RequestMapping("/v1/system/upload")
public class UploadController { public class UploadController {
@Value("${rest.upload-path}") @Resource
private String uploadPath; private TencentCOSUtil tencentCOSUtil;
@Operation(summary = "文件上传") @Operation(summary = "文件上传")
@PostMapping @PostMapping
@ApiCommon @ApiCommon
public ApiResponse upload(@RequestParam MultipartFile file, @AuthUsername String username) { public ApiResponse upload(@RequestParam MultipartFile file) {
String upload = FileUtils.upload(file, username, uploadPath); String upload = tencentCOSUtil.upLoadFile(file);
return ApiResponse.ok("/files/upload" + upload); return ApiResponse.ok(upload);
} }
} }
...@@ -41,12 +41,12 @@ public class DepartmentInfoParam extends BaseParam<DepartmentInfo> { ...@@ -41,12 +41,12 @@ public class DepartmentInfoParam extends BaseParam<DepartmentInfo> {
* 科室名称 * 科室名称
*/ */
@Parameter(description = "科室名称") @Parameter(description = "科室名称")
private Long departmentName; private String departmentName;
/** /**
* 科室介绍 * 科室介绍
*/ */
@Parameter(description = "科室介绍") @Parameter(description = "科室介绍")
private Long departmentIntroduce; private String departmentIntroduce;
/** /**
* 科室层级 * 科室层级
*/ */
...@@ -136,8 +136,28 @@ public class DepartmentInfoParam extends BaseParam<DepartmentInfo> { ...@@ -136,8 +136,28 @@ public class DepartmentInfoParam extends BaseParam<DepartmentInfo> {
QueryWrapper<DepartmentInfo> wrapper = Wrappers.<DepartmentInfo>query(); QueryWrapper<DepartmentInfo> wrapper = Wrappers.<DepartmentInfo>query();
wrapper.eq(this.getId() != null, columnPrefix + "id", this.getId()); wrapper.eq(this.getId() != null, columnPrefix + "id", this.getId());
wrapper.in(this.getIdList() != null && this.getIdList().size() > 0, columnPrefix + "id", this.getIdList()); wrapper.in(this.getIdList() != null && this.getIdList().size() > 0, columnPrefix + "id", this.getIdList());
wrapper.eq(this.getDepartmentName() != null, columnPrefix + "department_name", this.getDepartmentName()); if (this.getDepartmentName() != null) {
wrapper.eq(this.getDepartmentIntroduce() != null, columnPrefix + "department_introduce", this.getDepartmentIntroduce()); if (this.getDepartmentName().startsWith("%") && this.getDepartmentName().endsWith("%")) {
wrapper.like(columnPrefix + "department_name", this.getDepartmentName().substring(1, this.getDepartmentName().length() - 1));
} else if (this.getDepartmentName().startsWith("%") && !this.getDepartmentName().endsWith("%")) {
wrapper.likeLeft(columnPrefix + "department_name", this.getDepartmentName().substring(1));
} else if (this.getDepartmentName().endsWith("%")) {
wrapper.likeRight(columnPrefix + "department_name", this.getDepartmentName().substring(0, this.getDepartmentName().length() - 1));
} else {
wrapper.eq(columnPrefix + "department_name", this.getDepartmentName());
}
}
if (this.getDepartmentIntroduce() != null) {
if (this.getDepartmentIntroduce().startsWith("%") && this.getDepartmentIntroduce().endsWith("%")) {
wrapper.like(columnPrefix + "department_introduce", this.getDepartmentIntroduce().substring(1, this.getDepartmentIntroduce().length() - 1));
} else if (this.getDepartmentIntroduce().startsWith("%") && !this.getDepartmentIntroduce().endsWith("%")) {
wrapper.likeLeft(columnPrefix + "department_introduce", this.getDepartmentIntroduce().substring(1));
} else if (this.getDepartmentIntroduce().endsWith("%")) {
wrapper.likeRight(columnPrefix + "department_introduce", this.getDepartmentIntroduce().substring(0, this.getDepartmentIntroduce().length() - 1));
} else {
wrapper.eq(columnPrefix + "department_introduce", this.getDepartmentIntroduce());
}
}
wrapper.eq(this.getDepartmentLevel() != null, columnPrefix + "department_level", this.getDepartmentLevel()); wrapper.eq(this.getDepartmentLevel() != null, columnPrefix + "department_level", this.getDepartmentLevel());
wrapper.in(this.getDepartmentLevelList() != null && this.getDepartmentLevelList().size() > 0, columnPrefix + "department_level", this.getDepartmentLevelList()); wrapper.in(this.getDepartmentLevelList() != null && this.getDepartmentLevelList().size() > 0, columnPrefix + "department_level", this.getDepartmentLevelList());
wrapper.eq(this.getParentId() != null, columnPrefix + "parent_id", this.getParentId()); wrapper.eq(this.getParentId() != null, columnPrefix + "parent_id", this.getParentId());
......
...@@ -41,7 +41,7 @@ public class HospitalInfoParam extends BaseParam<HospitalInfo> { ...@@ -41,7 +41,7 @@ public class HospitalInfoParam extends BaseParam<HospitalInfo> {
* 医院名称 * 医院名称
*/ */
@Parameter(description = "医院名称") @Parameter(description = "医院名称")
private Long hospitalName; private String hospitalName;
/** /**
* 医院等级 * 医院等级
*/ */
...@@ -141,7 +141,17 @@ public class HospitalInfoParam extends BaseParam<HospitalInfo> { ...@@ -141,7 +141,17 @@ public class HospitalInfoParam extends BaseParam<HospitalInfo> {
QueryWrapper<HospitalInfo> wrapper = Wrappers.<HospitalInfo>query(); QueryWrapper<HospitalInfo> wrapper = Wrappers.<HospitalInfo>query();
wrapper.eq(this.getId() != null, columnPrefix + "id", this.getId()); wrapper.eq(this.getId() != null, columnPrefix + "id", this.getId());
wrapper.in(this.getIdList() != null && this.getIdList().size() > 0, columnPrefix + "id", this.getIdList()); wrapper.in(this.getIdList() != null && this.getIdList().size() > 0, columnPrefix + "id", this.getIdList());
wrapper.eq(this.getHospitalName() != null, columnPrefix + "hospital_name", this.getHospitalName()); if (this.getHospitalName() != null) {
if (this.getHospitalName().startsWith("%") && this.getHospitalName().endsWith("%")) {
wrapper.like(columnPrefix + "hospital_name", this.getHospitalName().substring(1, this.getHospitalName().length() - 1));
} else if (this.getHospitalName().startsWith("%") && !this.getHospitalName().endsWith("%")) {
wrapper.likeLeft(columnPrefix + "hospital_name", this.getHospitalName().substring(1));
} else if (this.getHospitalName().endsWith("%")) {
wrapper.likeRight(columnPrefix + "hospital_name", this.getHospitalName().substring(0, this.getHospitalName().length() - 1));
} else {
wrapper.eq(columnPrefix + "hospital_name", this.getHospitalName());
}
}
wrapper.eq(this.getHospitalLevel() != null, columnPrefix + "hospital_level", this.getHospitalLevel()); wrapper.eq(this.getHospitalLevel() != null, columnPrefix + "hospital_level", this.getHospitalLevel());
wrapper.in(this.getHospitalLevelList() != null && this.getHospitalLevelList().size() > 0, columnPrefix + "hospital_level", this.getHospitalLevelList()); wrapper.in(this.getHospitalLevelList() != null && this.getHospitalLevelList().size() > 0, columnPrefix + "hospital_level", this.getHospitalLevelList());
if (this.getAddress() != null) { if (this.getAddress() != null) {
......
...@@ -41,7 +41,7 @@ public class MedicalReportParam extends BaseParam<MedicalReport> { ...@@ -41,7 +41,7 @@ public class MedicalReportParam extends BaseParam<MedicalReport> {
* 患者姓名 * 患者姓名
*/ */
@Parameter(description = "患者姓名") @Parameter(description = "患者姓名")
private Long patientName; private String patientName;
/** /**
* 患者身份证号码 * 患者身份证号码
*/ */
...@@ -179,7 +179,17 @@ public class MedicalReportParam extends BaseParam<MedicalReport> { ...@@ -179,7 +179,17 @@ public class MedicalReportParam extends BaseParam<MedicalReport> {
QueryWrapper<MedicalReport> wrapper = Wrappers.<MedicalReport>query(); QueryWrapper<MedicalReport> wrapper = Wrappers.<MedicalReport>query();
wrapper.eq(this.getId() != null, columnPrefix + "id", this.getId()); wrapper.eq(this.getId() != null, columnPrefix + "id", this.getId());
wrapper.in(this.getIdList() != null && this.getIdList().size() > 0, columnPrefix + "id", this.getIdList()); wrapper.in(this.getIdList() != null && this.getIdList().size() > 0, columnPrefix + "id", this.getIdList());
wrapper.eq(this.getPatientName() != null, columnPrefix + "patient_name", this.getPatientName()); if (this.getPatientName() != null) {
if (this.getPatientName().startsWith("%") && this.getPatientName().endsWith("%")) {
wrapper.like(columnPrefix + "patient_name", this.getPatientName().substring(1, this.getPatientName().length() - 1));
} else if (this.getPatientName().startsWith("%") && !this.getPatientName().endsWith("%")) {
wrapper.likeLeft(columnPrefix + "patient_name", this.getPatientName().substring(1));
} else if (this.getPatientName().endsWith("%")) {
wrapper.likeRight(columnPrefix + "patient_name", this.getPatientName().substring(0, this.getPatientName().length() - 1));
} else {
wrapper.eq(columnPrefix + "patient_name", this.getPatientName());
}
}
if (this.getPatientIdNo() != null) { if (this.getPatientIdNo() != null) {
if (this.getPatientIdNo().startsWith("%") && this.getPatientIdNo().endsWith("%")) { if (this.getPatientIdNo().startsWith("%") && this.getPatientIdNo().endsWith("%")) {
wrapper.like(columnPrefix + "patient_id_no", this.getPatientIdNo().substring(1, this.getPatientIdNo().length() - 1)); wrapper.like(columnPrefix + "patient_id_no", this.getPatientIdNo().substring(1, this.getPatientIdNo().length() - 1));
......
...@@ -17,6 +17,7 @@ import lombok.*; ...@@ -17,6 +17,7 @@ import lombok.*;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.xwd.hospital.server.base.BaseParam; import com.xwd.hospital.server.base.BaseParam;
import com.xwd.hospital.server.enums.YesNoEnum;
import com.xwd.hospital.server.domain.PhoneOrderRecord; import com.xwd.hospital.server.domain.PhoneOrderRecord;
@Data @Data
...@@ -45,11 +46,41 @@ public class PhoneOrderRecordParam extends BaseParam<PhoneOrderRecord> { ...@@ -45,11 +46,41 @@ public class PhoneOrderRecordParam extends BaseParam<PhoneOrderRecord> {
*/ */
@Parameter(description = "订单号") @Parameter(description = "订单号")
private String orderNo; private String orderNo;
/**
* 患者被叫号码
*/
@Parameter(description = "患者被叫号码")
private String patientPhoneNo;
/**
* 匿名小号号码
*/
@Parameter(description = "匿名小号号码")
private String proxyPhoneNo;
/**
* 唯一绑定id
*/
@Parameter(description = "唯一绑定id")
private String mappingId;
/**
* 是否解绑状态
*/
@Parameter(description = "是否解绑状态")
private YesNoEnum mappingState;
/**
* 是否解绑状态 IN值List
*/
@Parameter(description = "是否解绑状态 IN值List")
private List<String> mappingStateList;
/** /**
* 电话咨询开始时间 * 电话咨询开始时间
*/ */
@Parameter(description = "电话咨询开始时间") @Parameter(description = "电话咨询开始时间")
private String phoneContactTime; private String phoneContactTime;
/**
* 电话咨询结束时间
*/
@Parameter(description = "电话咨询结束时间")
private String phoneReleaseTime;
/** /**
* 操作人Id * 操作人Id
*/ */
...@@ -126,6 +157,41 @@ public class PhoneOrderRecordParam extends BaseParam<PhoneOrderRecord> { ...@@ -126,6 +157,41 @@ public class PhoneOrderRecordParam extends BaseParam<PhoneOrderRecord> {
wrapper.eq(columnPrefix + "order_no", this.getOrderNo()); wrapper.eq(columnPrefix + "order_no", this.getOrderNo());
} }
} }
if (this.getPatientPhoneNo() != null) {
if (this.getPatientPhoneNo().startsWith("%") && this.getPatientPhoneNo().endsWith("%")) {
wrapper.like(columnPrefix + "patient_phone_no", this.getPatientPhoneNo().substring(1, this.getPatientPhoneNo().length() - 1));
} else if (this.getPatientPhoneNo().startsWith("%") && !this.getPatientPhoneNo().endsWith("%")) {
wrapper.likeLeft(columnPrefix + "patient_phone_no", this.getPatientPhoneNo().substring(1));
} else if (this.getPatientPhoneNo().endsWith("%")) {
wrapper.likeRight(columnPrefix + "patient_phone_no", this.getPatientPhoneNo().substring(0, this.getPatientPhoneNo().length() - 1));
} else {
wrapper.eq(columnPrefix + "patient_phone_no", this.getPatientPhoneNo());
}
}
if (this.getProxyPhoneNo() != null) {
if (this.getProxyPhoneNo().startsWith("%") && this.getProxyPhoneNo().endsWith("%")) {
wrapper.like(columnPrefix + "proxy_phone_no", this.getProxyPhoneNo().substring(1, this.getProxyPhoneNo().length() - 1));
} else if (this.getProxyPhoneNo().startsWith("%") && !this.getProxyPhoneNo().endsWith("%")) {
wrapper.likeLeft(columnPrefix + "proxy_phone_no", this.getProxyPhoneNo().substring(1));
} else if (this.getProxyPhoneNo().endsWith("%")) {
wrapper.likeRight(columnPrefix + "proxy_phone_no", this.getProxyPhoneNo().substring(0, this.getProxyPhoneNo().length() - 1));
} else {
wrapper.eq(columnPrefix + "proxy_phone_no", this.getProxyPhoneNo());
}
}
if (this.getMappingId() != null) {
if (this.getMappingId().startsWith("%") && this.getMappingId().endsWith("%")) {
wrapper.like(columnPrefix + "mapping_id", this.getMappingId().substring(1, this.getMappingId().length() - 1));
} else if (this.getMappingId().startsWith("%") && !this.getMappingId().endsWith("%")) {
wrapper.likeLeft(columnPrefix + "mapping_id", this.getMappingId().substring(1));
} else if (this.getMappingId().endsWith("%")) {
wrapper.likeRight(columnPrefix + "mapping_id", this.getMappingId().substring(0, this.getMappingId().length() - 1));
} else {
wrapper.eq(columnPrefix + "mapping_id", this.getMappingId());
}
}
wrapper.eq(this.getMappingState() != null, columnPrefix + "mapping_state", this.getMappingState());
wrapper.in(this.getMappingStateList() != null && this.getMappingStateList().size() > 0, columnPrefix + "mapping_state", this.getMappingStateList());
if (this.getPhoneContactTime() != null) { if (this.getPhoneContactTime() != null) {
if (this.getPhoneContactTime().startsWith("%") && this.getPhoneContactTime().endsWith("%")) { if (this.getPhoneContactTime().startsWith("%") && this.getPhoneContactTime().endsWith("%")) {
wrapper.like(columnPrefix + "phone_contact_time", this.getPhoneContactTime().substring(1, this.getPhoneContactTime().length() - 1)); wrapper.like(columnPrefix + "phone_contact_time", this.getPhoneContactTime().substring(1, this.getPhoneContactTime().length() - 1));
...@@ -137,6 +203,17 @@ public class PhoneOrderRecordParam extends BaseParam<PhoneOrderRecord> { ...@@ -137,6 +203,17 @@ public class PhoneOrderRecordParam extends BaseParam<PhoneOrderRecord> {
wrapper.eq(columnPrefix + "phone_contact_time", this.getPhoneContactTime()); wrapper.eq(columnPrefix + "phone_contact_time", this.getPhoneContactTime());
} }
} }
if (this.getPhoneReleaseTime() != null) {
if (this.getPhoneReleaseTime().startsWith("%") && this.getPhoneReleaseTime().endsWith("%")) {
wrapper.like(columnPrefix + "phone_release_time", this.getPhoneReleaseTime().substring(1, this.getPhoneReleaseTime().length() - 1));
} else if (this.getPhoneReleaseTime().startsWith("%") && !this.getPhoneReleaseTime().endsWith("%")) {
wrapper.likeLeft(columnPrefix + "phone_release_time", this.getPhoneReleaseTime().substring(1));
} else if (this.getPhoneReleaseTime().endsWith("%")) {
wrapper.likeRight(columnPrefix + "phone_release_time", this.getPhoneReleaseTime().substring(0, this.getPhoneReleaseTime().length() - 1));
} else {
wrapper.eq(columnPrefix + "phone_release_time", this.getPhoneReleaseTime());
}
}
wrapper.eq(this.getEditorId() != null, columnPrefix + "editor_id", this.getEditorId()); wrapper.eq(this.getEditorId() != null, columnPrefix + "editor_id", this.getEditorId());
if (this.getEditorName() != null) { if (this.getEditorName() != null) {
if (this.getEditorName().startsWith("%") && this.getEditorName().endsWith("%")) { if (this.getEditorName().startsWith("%") && this.getEditorName().endsWith("%")) {
......
package com.xwd.hospital.server.service;
import retrofit2.Call;
import retrofit2.http.*;
import java.util.Map;
public interface CallApiService {
@FormUrlEncoded
@POST("/v20160818/rlxh/midNumBind/{account}")
Call<String> bindNumber(@HeaderMap Map<String, String> headers,@FieldMap Map<String, Object> map,@Path("account") String account);
@FormUrlEncoded
@POST("/v20160818/rlxh/midNumUnBinding/{account}")
Call<String> unbindNumber(@HeaderMap Map<String, String> headers,@FieldMap Map<String, Object> map,@Path("account") String account);
}
...@@ -67,7 +67,7 @@ public interface UserService extends BaseService<User> { ...@@ -67,7 +67,7 @@ public interface UserService extends BaseService<User> {
* 更新用户信息 * 更新用户信息
* @return * @return
*/ */
UserDto updateUserInfo(UpdateUserInfoDto updateInfoDto); User updateUserInfo(UpdateUserInfoDto updateInfoDto);
/** /**
* 微信获取手机号码 * 微信获取手机号码
......
...@@ -17,6 +17,7 @@ import cn.dev33.satoken.stp.StpUtil; ...@@ -17,6 +17,7 @@ import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xwd.hospital.server.domain.*; import com.xwd.hospital.server.domain.*;
import com.xwd.hospital.server.dto.*; import com.xwd.hospital.server.dto.*;
import com.xwd.hospital.server.enums.OrderOperationEnum;
import com.xwd.hospital.server.enums.OrderStateEnum; import com.xwd.hospital.server.enums.OrderStateEnum;
import com.xwd.hospital.server.enums.OrderTypeEnum; import com.xwd.hospital.server.enums.OrderTypeEnum;
import com.xwd.hospital.server.enums.YesNoEnum; import com.xwd.hospital.server.enums.YesNoEnum;
...@@ -37,6 +38,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -37,6 +38,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
@Resource @Resource
private UserInfoService userInfoService; private UserInfoService userInfoService;
@Resource @Resource
private UserService userService;
@Resource
private DoctorServiceInfoService doctorServiceInfoService; private DoctorServiceInfoService doctorServiceInfoService;
@Resource @Resource
private UserCouponInfoService userCouponInfoService; private UserCouponInfoService userCouponInfoService;
...@@ -46,6 +49,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -46,6 +49,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
private PatientInfoService patientInfoService; private PatientInfoService patientInfoService;
@Resource @Resource
private OrderAppraiseService orderAppraiseService; private OrderAppraiseService orderAppraiseService;
@Resource
private PrescriptionOrderRecordService prescriptionOrderRecordService;
@Resource
private OrderOperationService orderOperationService;
@Override @Override
public int updateAllFieldsById(Order entity) { public int updateAllFieldsById(Order entity) {
...@@ -79,9 +86,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -79,9 +86,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
@Override @Override
public Order createOrder(CreateOrderDto createOrderDto) { public Order createOrder(CreateOrderDto createOrderDto) {
//当前用户
Object userId = StpUtil.getExtra("userId");
UserInfo userInfo = userInfoService.getOne(Wrappers.<UserInfo>query().eq("user_id", userId));
if(null == userInfo){
return null;
}
User sysUser = userService.getById(Long.valueOf(userId.toString()));
Order order = new Order(); Order order = new Order();
//写入订单相关记录记录 //写入订单相关记录记录
order.setUserInfoId(createOrderDto.getUserInfoId()); order.setUserInfoId(userInfo.getId());
order.setDoctorId(createOrderDto.getDoctorId()); order.setDoctorId(createOrderDto.getDoctorId());
order.setPatientId(createOrderDto.getPatientId()); order.setPatientId(createOrderDto.getPatientId());
//生成订单号 //生成订单号
...@@ -101,7 +116,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -101,7 +116,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
.eq("service_name", orderType.toString()) .eq("service_name", orderType.toString())
.eq("service_state", YesNoEnum.YES.toString())); .eq("service_state", YesNoEnum.YES.toString()));
if(null == doctorServiceInfo){ if(null == doctorServiceInfo){
//todo 抛出异常
return null;
} }
order.setOrderPrice(doctorServiceInfo.getServicePrice()); order.setOrderPrice(doctorServiceInfo.getServicePrice());
...@@ -116,6 +132,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -116,6 +132,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
//优惠券变为已使用 //优惠券变为已使用
userCouponInfo.setCouponUseState(YesNoEnum.NO); userCouponInfo.setCouponUseState(YesNoEnum.NO);
userCouponInfo.setEditorId(sysUser.getId());
userCouponInfo.setEditorName(sysUser.getUsername());
userCouponInfoService.save(userCouponInfo); userCouponInfoService.save(userCouponInfo);
} }
} }
...@@ -139,13 +157,18 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -139,13 +157,18 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
order.setPatientPhoneNumber(patientInfo.getPhoneNumber()); order.setPatientPhoneNumber(patientInfo.getPhoneNumber());
order.setPatientBornDate(patientInfo.getBornDate()); order.setPatientBornDate(patientInfo.getBornDate());
order.setPatientSelfIntroduce(createOrderDto.getPatientSelfIntroduce()); order.setPatientSelfIntroduce(createOrderDto.getPatientSelfIntroduce());
order.setEditorId(sysUser.getId());
order.setEditorName(sysUser.getUsername());
this.save(order); this.save(order);
//写入订单操作记录 //写入订单操作记录
OrderOperation orderOperation = new OrderOperation(); OrderOperation orderOperation = new OrderOperation();
orderOperation.setOrderId(order.getId()); orderOperation.setOrderId(order.getId());
orderOperation.setOrderNo(order.getOrderNo()); orderOperation.setOrderNo(order.getOrderNo());
orderOperation.setOperateInfo(OrderOperationEnum.ORDER_CREATED.getName());
orderOperation.setEditorId(sysUser.getId());
orderOperation.setEditorName(sysUser.getUsername());
orderOperationService.save(orderOperation);
return order; return order;
} }
...@@ -202,7 +225,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -202,7 +225,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
order.setOrderState(OrderStateEnum.CANCELED); order.setOrderState(OrderStateEnum.CANCELED);
this.save(order); this.save(order);
//todo 优惠券是否返回 //优惠券是否返回
//查询优惠券 //查询优惠券
if(null != order.getUserCouponId()){ if(null != order.getUserCouponId()){
UserCouponInfo userCouponInfo = userCouponInfoService.getById(order.getUserCouponId()); UserCouponInfo userCouponInfo = userCouponInfoService.getById(order.getUserCouponId());
...@@ -233,14 +256,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -233,14 +256,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
order.setCancelReason(rejectOrderDto.getReason()); order.setCancelReason(rejectOrderDto.getReason());
this.save(order); this.save(order);
//todo 优惠券是否返回 //优惠券是否返回
//查询优惠券
if(null != order.getUserCouponId()){ if(null != order.getUserCouponId()){
//查询是否使用优惠券优惠券
UserCouponInfo userCouponInfo = userCouponInfoService.getById(order.getUserCouponId()); UserCouponInfo userCouponInfo = userCouponInfoService.getById(order.getUserCouponId());
Date currentDate = new Date(); Date currentDate = new Date();
//如果使用了优惠券,并且仍符合使用规则
if(currentDate.after(userCouponInfo.getCouponStartDate()) if(currentDate.after(userCouponInfo.getCouponStartDate())
&& currentDate.before(userCouponInfo.getCouponEndDate())){ && currentDate.before(userCouponInfo.getCouponEndDate())){
//优惠券状态设置为可用
userCouponInfo.setCouponUseState(YesNoEnum.YES); userCouponInfo.setCouponUseState(YesNoEnum.YES);
userCouponInfo.setEditorId(1L); userCouponInfo.setEditorId(1L);
userCouponInfoService.save(userCouponInfo); userCouponInfoService.save(userCouponInfo);
...@@ -301,10 +325,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -301,10 +325,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
Order order = this.getOne(Wrappers.<Order>query().eq("order_no", prescriptionInfoDto.getOrderNo())); Order order = this.getOne(Wrappers.<Order>query().eq("order_no", prescriptionInfoDto.getOrderNo()));
if(order.getOrderState() == OrderStateEnum.IN_SERVICE){ if(order.getOrderState() == OrderStateEnum.IN_SERVICE){
PrescriptionOrderRecord record = new PrescriptionOrderRecord(); PrescriptionOrderRecord record = new PrescriptionOrderRecord();
record.setOrderId(order.getId());
record.setOrderNo(order.getOrderNo());
record.setPrescriptionImage(prescriptionInfoDto.getPrescriptionImage());
record.setPrescriptionIntroduce(prescriptionInfoDto.getPrescriptionIntroduce());
prescriptionOrderRecordService.save(record);
} }
return null; return order;
} }
/** /**
...@@ -344,6 +372,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -344,6 +372,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
orderAppraiseService.save(orderAppraise); orderAppraiseService.save(orderAppraise);
} }
return null; return order;
} }
} }
...@@ -188,7 +188,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -188,7 +188,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
user.setUserType(loginDto.getUserType()); user.setUserType(loginDto.getUserType());
user.setRegisterSource(RegisterSourceEnum.WX); user.setRegisterSource(RegisterSourceEnum.WX);
user.setPhone(loginDto.getPhoneNumber()); user.setPhone(loginDto.getPhoneNumber());
this.save(user); super.save(user);
//分配角色 //分配角色
String roleName = ""; String roleName = "";
if(loginDto.getUserType() == UserTypeEnum.PATIENT){ if(loginDto.getUserType() == UserTypeEnum.PATIENT){
...@@ -288,7 +288,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -288,7 +288,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
this.userRoleMapper.insert(UserRole.newBuilder().userId(user.getId()).roleId(defaultRole.getId()).build()); this.userRoleMapper.insert(UserRole.newBuilder().userId(user.getId()).roleId(defaultRole.getId()).build());
} }
this.save(user); this.saveOrUpdate(user);
return userDto; return userDto;
} catch (WxErrorException e) { } catch (WxErrorException e) {
log.error("微信登录异常"); log.error("微信登录异常");
...@@ -299,9 +299,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -299,9 +299,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
} }
@Override @Override
public UserDto updateUserInfo(UpdateUserInfoDto updateUserDto) { public User updateUserInfo(UpdateUserInfoDto updateUserDto) {
Long userId = (Long)StpUtil.getExtra("userId"); Long userId = Long.valueOf(StpUtil.getExtra("userId").toString());
UserDto userDto = new UserDto();
User user = this.getById(userId); User user = this.getById(userId);
//插入obj_id和相关信息记录 //插入obj_id和相关信息记录
...@@ -350,9 +350,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -350,9 +350,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
user.setObjId(doctorInfo.getId()); user.setObjId(doctorInfo.getId());
} }
this.save(user); this.saveOrUpdate(user);
return userDto; return user;
} }
public UserDto wxUpdate(UpdateInfoDto updateUserDto) { public UserDto wxUpdate(UpdateInfoDto updateUserDto) {
...@@ -372,7 +372,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -372,7 +372,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
WxMaUserInfo userInfo = wxMaService.getUserService().getUserInfo(session.getSessionKey(), updateUserDto.getEncryptedData(), updateUserDto.getIvStr()); WxMaUserInfo userInfo = wxMaService.getUserService().getUserInfo(session.getSessionKey(), updateUserDto.getEncryptedData(), updateUserDto.getIvStr());
user.setUsername(userInfo.getNickName()); user.setUsername(userInfo.getNickName());
user.setAvatar(userInfo.getAvatarUrl()); user.setAvatar(userInfo.getAvatarUrl());
this.save(user); this.saveOrUpdate(user);
userDto.setUser(user); userDto.setUser(user);
return userDto; return userDto;
} catch (WxErrorException e) { } catch (WxErrorException e) {
......
package com.xwd.hospital.server.util;
import com.xwd.hospital.server.service.CallApiService;
import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import retrofit2.Retrofit;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Slf4j
public class CallUtil {
private static final String account = "N000*****91";//替换为您的账户
private static final String secret = "5fdb6********bb88e4b";//替换为您的api密码
private static final String host = "http://apis.7moor.com";
public static void call() {
String time = getDateTime();
String sig = md5(account + secret + time);
//查询坐席状态接口
String interfacePath = "/v20160818/user/queryUserState/";
String url = host + interfacePath + account + "?sig=" + sig;
String auth = base64(account + ":" + time);
HttpClientBuilder builder = HttpClientBuilder.create();
CloseableHttpClient client = builder.build();
HttpPost post = new HttpPost(url);
post.addHeader("Accept", "application/json");
post.addHeader("Content-Type","application/json;charset=utf-8");
post.addHeader("Authorization",auth);
StringEntity requestEntity = null;
//根据需要发送的数据做相应替换
requestEntity = new StringEntity("{\"exten\":\"8000\"}","UTF-8");
post.setEntity(requestEntity);
CloseableHttpResponse response = null;
try {
response = client.execute(post);
HttpEntity entity = response.getEntity();
log.info("the response is : " + EntityUtils.toString(entity,"utf8"));
} catch (Exception e) {
e.printStackTrace();
} finally {
if (response != null){
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public static Map<String,String> getSigAndAuth () {
String time = getDateTime();
String sig = md5(account + secret + time);
String auth = base64(account + ":" + time);
HashMap<String, String> map = new HashMap<>();
map.put("sig",sig);
map.put("auth",auth);
return map;
}
public static String md5 (String text) {
return DigestUtils.md5Hex(text).toUpperCase();
}
public static String base64 (String text) {
byte[] b = text.getBytes();
Base64 base64 = new Base64();
b = base64.encode(b);
String s = new String(b);
return s;
}
public static String getDateTime(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
return sdf.format(new Date());
}
public void test(){
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://api.github.com/")
.client(new OkHttpClient.Builder().build())
.build();
CallApiService service = retrofit.create(CallApiService.class);
}
}
package com.xwd.hospital.server.util;
import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.auth.BasicSessionCredentials;
import com.qcloud.cos.auth.COSCredentials;
import com.qcloud.cos.http.HttpProtocol;
import com.qcloud.cos.model.ObjectMetadata;
import com.qcloud.cos.model.PutObjectResult;
import com.qcloud.cos.region.Region;
import com.tencent.cloud.CosStsClient;
import com.tencent.cloud.Response;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.TreeMap;
import java.util.UUID;
@Component
public class TencentCOSUtil {
// 子账户的SecretId
private static String secretId = "AKIDhM2Wpy0TjneHhuwpSoxseOBrhMqDh1GK";
// 子账户的SecretKey
private static String secretKey = "53zrjX7hPvcBjJ1d1gDWeyaHNOGwNYff";
//文件上传后访问路径的根路径,后面要最佳文件名字与类型
private static String rootSrc = "https://medical-server-1321105819.cos.ap-shanghai.myqcloud.com/";
//上传的存储桶的地域,可参考根路径https://qq-test-1303******.cos.地域.myqcloud.com,此参数在COS的后台能查询。
private static String bucketAddr = "ap-shanghai";
//存储桶的名字,是自己在存储空间自己创建的,我创建的名字是:qq-test-1303******
private static String bucketName = "medical-server-1321105819";
/**
* 是用临时秘钥创建COS
* 安全性高
* @return
*/
private static COSClient getCosClient() {
TreeMap<String, Object> config = new TreeMap<String, Object>();
String tmpSecretId = "SECRETID";
String tmpSecretKey = "SECRETKEY";
String sessionToken = "TOKEN";
Response response = null;
try {
//这里的 SecretId 和 SecretKey 代表了用于申请临时密钥的永久身份(主账号、子账号等),子账号需要具有操作存储桶的权限。
//用户的 SecretId,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参见 https://cloud.tencent.com/document/product/598/37140
// 替换为您的云 api 密钥 SecretId
config.put("secretId", secretId);
// 替换为您的云 api 密钥 SecretKey
config.put("secretKey", secretKey);
// 临时密钥有效时长,单位是秒,默认 1800 秒,目前主账号最长 2 小时(即 7200 秒),子账号最长 36 小时(即 129600)秒
config.put("durationSeconds", 1800);
// 换成您的 bucket
config.put("bucket", bucketName);
// 换成 bucket 所在地区
config.put("region", bucketAddr);
// 这里改成允许的路径前缀,可以根据自己网站的用户登录态判断允许上传的具体路径
// 列举几种典型的前缀授权场景:
// 1、允许访问所有对象:"*"
// 2、允许访问指定的对象:"a/a1.txt", "b/b1.txt"
// 3、允许访问指定前缀的对象:"a*", "a/*", "b/*"
// 如果填写了“*”,将允许用户访问所有资源;除非业务需要,否则请按照最小权限原则授予用户相应的访问权限范围。
config.put("allowPrefixes", new String[] {
"*"
})
;
// 密钥的权限列表。必须在这里指定本次临时密钥所需要的权限。
// 简单上传、表单上传和分块上传需要以下的权限,其他权限列表请参见 https://cloud.tencent.com/document/product/436/31923
String[] allowActions = new String[] {
// 简单上传
"name/cos:PutObject",
// 表单上传、小程序上传
"name/cos:PostObject",
// 分块上传
"name/cos:InitiateMultipartUpload",
"name/cos:ListMultipartUploads",
"name/cos:ListParts",
"name/cos:UploadPart",
"name/cos:CompleteMultipartUpload"
};
config.put("allowActions", allowActions);
response = CosStsClient.getCredential(config);
tmpSecretId = response.credentials.tmpSecretId;
tmpSecretKey = response.credentials.tmpSecretKey;
sessionToken = response.credentials.sessionToken;
} catch (IOException e) {
throw new RuntimeException(e);
}
System.out.println(tmpSecretId);
System.out.println(tmpSecretKey);
System.out.println(sessionToken);
BasicSessionCredentials cred = new BasicSessionCredentials(tmpSecretId, tmpSecretKey, sessionToken);
// 2 设置 bucket 的地域
// clientConfig 中包含了设置 region, https(默认 http), 超时, 代理等 set 方法, 使用可参见源码或者常见问题 Java SDK 部分
Region region = new Region(bucketAddr); //COS_REGION 参数:配置成存储桶 bucket 的实际地域,例如 ap-beijing,更多 COS 地域的简称请参见 https://cloud.tencent.com/document/product/436/6224
ClientConfig clientConfig = new ClientConfig(region);
clientConfig.setHttpProtocol(HttpProtocol.https);
// 3 生成 cos 客户端
COSClient cosClient = new COSClient(cred, clientConfig);
// 返回COS客户端
return cosClient;
}
/**
* 使用秘钥创建
* 安全性低
* @return
*/
private static COSClient getNormalCosClient() {
// 1 初始化用户身份信息(secretId, secretKey)。
COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
// 2.1 设置存储桶的地域(上文获得)
Region region = new Region(bucketAddr);
ClientConfig clientConfig = new ClientConfig(region);
// 2.2 使用https协议传输
clientConfig.setHttpProtocol(HttpProtocol.https);
// 3 生成 cos 客户端。
COSClient cosClient = new COSClient(cred, clientConfig);
// 返回COS客户端
return cosClient;
}
public static String upLoadFile(MultipartFile file) {
try {
// 获取上传的文件的输入流
InputStream inputStream = file.getInputStream();
// 避免文件覆盖,获取文件的原始名称,如123.jpg,然后通过截取获得文件的后缀,也就是文件的类型
String originalFilename = file.getOriginalFilename();
//获取文件的类型
String fileType = originalFilename.substring(originalFilename.lastIndexOf("."));
//使用UUID工具 创建唯一名称,放置文件重名被覆盖,在拼接上上命令获取的文件类型
String fileName = UUID.randomUUID().toString() + fileType;
// 指定文件上传到 COS 上的路径,即对象键。最终文件会传到存储桶名字中的images文件夹下的fileName名字
String key = "report-image/" + fileName;
// 创建上传Object的Metadata
ObjectMetadata objectMetadata = new ObjectMetadata();
// - 使用输入流存储,需要设置请求长度
objectMetadata.setContentLength(inputStream.available());
// - 设置缓存
objectMetadata.setCacheControl("no-cache");
// - 设置Content-Type
objectMetadata.setContentType(fileType);
//上传文件
PutObjectResult putResult = getCosClient().putObject(bucketName, key, inputStream, objectMetadata);
// 创建文件的网络访问路径
String url = rootSrc + key;
//关闭 cosClient,并释放 HTTP 连接的后台管理线程
getCosClient().shutdown();
return url;
} catch (Exception e) {
e.printStackTrace();
// 发生IO异常、COS连接异常等,返回空
return null;
}
}
}
...@@ -95,7 +95,8 @@ create table `pms_user_info` ...@@ -95,7 +95,8 @@ create table `pms_user_info`
id_no varchar(255) not null comment '身份证号码', id_no varchar(255) not null comment '身份证号码',
born_date varchar(50) not null comment '出生日期', born_date varchar(50) not null comment '出生日期',
phone_number varchar(255) not null comment '手机号码', phone_number varchar(255) not null comment '手机号码',
certificate_picture varchar(255) not null comment '证件图片', id_card_picture_front varchar(255) null comment '身份证图片正面',
id_card_picture_back varchar(255) null comment '身份证图片背面',
personal_info_filled varchar(50) not null default 'NO' comment '是否完善好个人信息 [YES.是 NO.否]', personal_info_filled varchar(50) not null default 'NO' comment '是否完善好个人信息 [YES.是 NO.否]',
delete_status varchar(50) not null default 'NO' comment '是否删除 [YES.是 NO.否]', delete_status varchar(50) not null default 'NO' comment '是否删除 [YES.是 NO.否]',
editor_id int(11) not null default 1 comment '操作人Id', editor_id int(11) not null default 1 comment '操作人Id',
...@@ -149,7 +150,7 @@ create table `pms_patient_info` ...@@ -149,7 +150,7 @@ create table `pms_patient_info`
relation varchar(50) not null default 'SELF' comment '就诊人关系 [SELF.本人 PARENT.父母 FRIEND.朋友 CHILDREN.孩子 OTHER.其他]', relation varchar(50) not null default 'SELF' comment '就诊人关系 [SELF.本人 PARENT.父母 FRIEND.朋友 CHILDREN.孩子 OTHER.其他]',
patient_name varchar(255) not null comment '就诊人姓名', patient_name varchar(255) not null comment '就诊人姓名',
sex varchar(50) not null default 'MALE' comment '性别 [MALE.男 FEMALE.女]', sex varchar(50) not null default 'MALE' comment '性别 [MALE.男 FEMALE.女]',
id_no varchar(255) not null comment '身份证号码', id_no varchar(255) null comment '身份证号码',
phone_number varchar(255) null comment '手机号码', phone_number varchar(255) null comment '手机号码',
born_date varchar(255) not null comment '出生日期', born_date varchar(255) not null comment '出生日期',
guardian_state varchar(50) not null default 'NO' comment '是否有监护人 [YES.是 NO.否]', guardian_state varchar(50) not null default 'NO' comment '是否有监护人 [YES.是 NO.否]',
...@@ -200,7 +201,7 @@ drop table if exists `pms_medical_report`; ...@@ -200,7 +201,7 @@ drop table if exists `pms_medical_report`;
create table `pms_medical_report` create table `pms_medical_report`
( (
id int(11) auto_increment not null comment 'Id', id int(11) auto_increment not null comment 'Id',
patient_name int(11) not null comment '患者姓名', patient_name varchar(32) not null comment '患者姓名',
patient_id_no varchar(32) not null comment '患者身份证号码', patient_id_no varchar(32) not null comment '患者身份证号码',
sex varchar(50) not null default 'MALE' comment '性别 [MALE.男 FEMALE.女]', sex varchar(50) not null default 'MALE' comment '性别 [MALE.男 FEMALE.女]',
age int(255) not null comment '患者年龄', age int(255) not null comment '患者年龄',
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
select="com.xwd.hospital.server.repository.UserMapper.selectById" /> select="com.xwd.hospital.server.repository.UserMapper.selectById" />
<association column="medical_qualification_id" property="medicalQualification" javaType="com.xwd.hospital.server.domain.MedicalQualifications" <association column="medical_qualification_id" property="medicalQualification" javaType="com.xwd.hospital.server.domain.MedicalQualifications"
select="com.xwd.hospital.server.repository.MedicalQualificationsMapper.selectById" /> select="com.xwd.hospital.server.repository.MedicalQualificationsMapper.selectById" />
<association column="id" property="serviceInfoList" javaType="list"
select="com.xwd.hospital.server.repository.DoctorServiceInfoMapper.selectByDoctorId"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
`id`, `user_id`, `medical_qualification_id`, `doctor_state`, `doctor_name`, `sex`, `id_no`, `born_date`, `phone_number`, `expertise_area`, `id_card_picture_front`, `id_card_picture_back`, `delete_status`, `editor_id`, `editor_name`, `create_time`, `update_time` `id`, `user_id`, `medical_qualification_id`, `doctor_state`, `doctor_name`, `sex`, `id_no`, `born_date`, `phone_number`, `expertise_area`, `id_card_picture_front`, `id_card_picture_back`, `delete_status`, `editor_id`, `editor_name`, `create_time`, `update_time`
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="com.xwd.hospital.server.repository.base.MedicalReportBaseMapper"> <mapper namespace="com.xwd.hospital.server.repository.base.MedicalReportBaseMapper">
<resultMap id="BaseResultMap" type="com.xwd.hospital.server.domain.MedicalReport"> <resultMap id="BaseResultMap" type="com.xwd.hospital.server.domain.MedicalReport">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="patient_name" jdbcType="BIGINT" property="patientName" /> <result column="patient_name" jdbcType="VARCHAR" property="patientName" />
<result column="patient_id_no" jdbcType="VARCHAR" property="patientIdNo" /> <result column="patient_id_no" jdbcType="VARCHAR" property="patientIdNo" />
<result column="sex" jdbcType="VARCHAR" property="sex" /> <result column="sex" jdbcType="VARCHAR" property="sex" />
<result column="age" jdbcType="INTEGER" property="age" /> <result column="age" jdbcType="INTEGER" property="age" />
...@@ -40,14 +40,14 @@ ...@@ -40,14 +40,14 @@
values values
<foreach collection="records" item="record" separator=","> <foreach collection="records" item="record" separator=",">
( (
#{record.patientName, jdbcType=BIGINT}, #{record.patientIdNo, jdbcType=VARCHAR}, #{record.sex, jdbcType=VARCHAR}, #{record.age, jdbcType=INTEGER}, #{record.reportItem, jdbcType=VARCHAR}, #{record.reportDeclare, jdbcType=VARCHAR}, #{record.reportHospital, jdbcType=VARCHAR}, #{record.reportDoctor, jdbcType=VARCHAR}, #{record.reportTime, jdbcType=TIMESTAMP}, #{record.reportState, jdbcType=VARCHAR}, #{record.doctorAsks, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR} #{record.patientName, jdbcType=VARCHAR}, #{record.patientIdNo, jdbcType=VARCHAR}, #{record.sex, jdbcType=VARCHAR}, #{record.age, jdbcType=INTEGER}, #{record.reportItem, jdbcType=VARCHAR}, #{record.reportDeclare, jdbcType=VARCHAR}, #{record.reportHospital, jdbcType=VARCHAR}, #{record.reportDoctor, jdbcType=VARCHAR}, #{record.reportTime, jdbcType=TIMESTAMP}, #{record.reportState, jdbcType=VARCHAR}, #{record.doctorAsks, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR}
) )
</foreach> </foreach>
</insert> </insert>
<update id="updateAllFieldsById" parameterType="com.xwd.hospital.server.domain.MedicalReport"> <update id="updateAllFieldsById" parameterType="com.xwd.hospital.server.domain.MedicalReport">
update pms_medical_report set update pms_medical_report set
<trim suffixOverrides=","> <trim suffixOverrides=",">
patient_name = #{et.patientName, jdbcType=BIGINT}, patient_name = #{et.patientName, jdbcType=VARCHAR},
patient_id_no = #{et.patientIdNo, jdbcType=VARCHAR}, patient_id_no = #{et.patientIdNo, jdbcType=VARCHAR},
sex = #{et.sex, jdbcType=VARCHAR}, sex = #{et.sex, jdbcType=VARCHAR},
age = #{et.age, jdbcType=INTEGER}, age = #{et.age, jdbcType=INTEGER},
......
...@@ -5,7 +5,12 @@ ...@@ -5,7 +5,12 @@
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="order_id" jdbcType="BIGINT" property="orderId" /> <result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="order_no" jdbcType="VARCHAR" property="orderNo" /> <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
<result column="patient_phone_no" jdbcType="VARCHAR" property="patientPhoneNo" />
<result column="proxy_phone_no" jdbcType="VARCHAR" property="proxyPhoneNo" />
<result column="mapping_id" jdbcType="VARCHAR" property="mappingId" />
<result column="mapping_state" jdbcType="VARCHAR" property="mappingState" />
<result column="phone_contact_time" jdbcType="VARCHAR" property="phoneContactTime" /> <result column="phone_contact_time" jdbcType="VARCHAR" property="phoneContactTime" />
<result column="phone_release_time" jdbcType="VARCHAR" property="phoneReleaseTime" />
<result column="editor_id" jdbcType="BIGINT" property="editorId" /> <result column="editor_id" jdbcType="BIGINT" property="editorId" />
<result column="editor_name" jdbcType="VARCHAR" property="editorName" /> <result column="editor_name" jdbcType="VARCHAR" property="editorName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
...@@ -16,19 +21,19 @@ ...@@ -16,19 +21,19 @@
select="com.xwd.hospital.server.repository.OrderMapper.selectById" /> select="com.xwd.hospital.server.repository.OrderMapper.selectById" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
`id`, `order_id`, `order_no`, `phone_contact_time`, `editor_id`, `editor_name`, `create_time`, `update_time` `id`, `order_id`, `order_no`, `patient_phone_no`, `proxy_phone_no`, `mapping_id`, `mapping_state`, `phone_contact_time`, `phone_release_time`, `editor_id`, `editor_name`, `create_time`, `update_time`
</sql> </sql>
<sql id="Base_Column_List_With_Prefix"> <sql id="Base_Column_List_With_Prefix">
t.`id`, t.`order_id`, t.`order_no`, t.`phone_contact_time`, t.`editor_id`, t.`editor_name`, t.`create_time`, t.`update_time` t.`id`, t.`order_id`, t.`order_no`, t.`patient_phone_no`, t.`proxy_phone_no`, t.`mapping_id`, t.`mapping_state`, t.`phone_contact_time`, t.`phone_release_time`, t.`editor_id`, t.`editor_name`, t.`create_time`, t.`update_time`
</sql> </sql>
<insert id="batchInsert"> <insert id="batchInsert">
insert into pms_phone_order_record ( insert into pms_phone_order_record (
`order_id`, `order_no`, `phone_contact_time`, `editor_id`, `editor_name` `order_id`, `order_no`, `patient_phone_no`, `proxy_phone_no`, `mapping_id`, `mapping_state`, `phone_contact_time`, `phone_release_time`, `editor_id`, `editor_name`
) )
values values
<foreach collection="records" item="record" separator=","> <foreach collection="records" item="record" separator=",">
( (
#{record.orderId, jdbcType=BIGINT}, #{record.orderNo, jdbcType=VARCHAR}, #{record.phoneContactTime, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR} #{record.orderId, jdbcType=BIGINT}, #{record.orderNo, jdbcType=VARCHAR}, #{record.patientPhoneNo, jdbcType=VARCHAR}, #{record.proxyPhoneNo, jdbcType=VARCHAR}, #{record.mappingId, jdbcType=VARCHAR}, #{record.mappingState, jdbcType=VARCHAR}, #{record.phoneContactTime, jdbcType=VARCHAR}, #{record.phoneReleaseTime, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR}
) )
</foreach> </foreach>
</insert> </insert>
...@@ -37,7 +42,12 @@ ...@@ -37,7 +42,12 @@
<trim suffixOverrides=","> <trim suffixOverrides=",">
order_id = #{et.orderId, jdbcType=BIGINT}, order_id = #{et.orderId, jdbcType=BIGINT},
order_no = #{et.orderNo, jdbcType=VARCHAR}, order_no = #{et.orderNo, jdbcType=VARCHAR},
patient_phone_no = #{et.patientPhoneNo, jdbcType=VARCHAR},
proxy_phone_no = #{et.proxyPhoneNo, jdbcType=VARCHAR},
mapping_id = #{et.mappingId, jdbcType=VARCHAR},
mapping_state = #{et.mappingState, jdbcType=VARCHAR},
phone_contact_time = #{et.phoneContactTime, jdbcType=VARCHAR}, phone_contact_time = #{et.phoneContactTime, jdbcType=VARCHAR},
phone_release_time = #{et.phoneReleaseTime, jdbcType=VARCHAR},
editor_id = #{et.editorId, jdbcType=BIGINT}, editor_id = #{et.editorId, jdbcType=BIGINT},
editor_name = #{et.editorName, jdbcType=VARCHAR}, editor_name = #{et.editorName, jdbcType=VARCHAR},
</trim> </trim>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论