添加服务预约相关接口;修改注册接口;

This commit is contained in:
mengkuiliang 2023-10-10 09:13:30 +08:00
parent 52ba21ab35
commit 96cfedc1db
19 changed files with 722 additions and 127 deletions

View File

@ -1,6 +1,11 @@
package com.xinelu.web.controller.applet;
import com.alibaba.fastjson2.JSONObject;
import com.xinelu.common.config.XinELuConfig;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.file.FileUploadUtils;
import com.xinelu.common.utils.file.MimeTypeUtils;
import com.xinelu.familydoctor.applet.pojo.body.PatientInfoBody;
import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo;
import com.xinelu.familydoctor.applet.service.IResidentPatientInfoService;
@ -14,10 +19,9 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.enums.BusinessType;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
@ -36,6 +40,8 @@ public class ResidentPatientInfoController extends BaseController {
@Resource
private IResidentPatientInfoService residentPatientInfoService;
@Resource
private XinELuConfig xinELuConfig;
@ApiOperation("获取OpenId")
@GetMapping("/getOpenId/{code}")
@ -57,9 +63,8 @@ public class ResidentPatientInfoController extends BaseController {
}
}
@ApiOperation("注册")
@Log(title = "居民小程序注册", businessType = BusinessType.INSERT)
@PostMapping("/")
@ApiOperation("注册完善信息")
@PostMapping("")
public R<String> register(@Validated @RequestBody PatientInfoBody body) {
try {
residentPatientInfoService.register(body);
@ -69,20 +74,19 @@ public class ResidentPatientInfoController extends BaseController {
}
}
@ApiOperation("修改注册信息")
@Log(title = "修改注册信息", businessType = BusinessType.UPDATE)
@PostMapping("/update")
public R<String> update(@Validated @RequestBody PatientInfo body) {
try {
residentPatientInfoService.updatePatientInfo(body);
return R.ok();
} catch (Exception e) {
return R.fail(e.getMessage());
}
}
// @ApiOperation("修改注册信息")
// @Log(title = "修改注册信息", businessType = BusinessType.UPDATE)
// @PostMapping("/update")
// public R<String> update(@Validated @RequestBody PatientInfo body) {
// try {
// residentPatientInfoService.updatePatientInfo(body);
// return R.ok();
// } catch (Exception e) {
// return R.fail(e.getMessage());
// }
// }
@ApiOperation("解绑")
@Log(title = "居民小程序解绑", businessType = BusinessType.UPDATE)
@GetMapping("/unbinding/{patientCode}")
public R<String> unbinding(@PathVariable String patientCode) {
residentPatientInfoService.unbinding(patientCode);
@ -119,4 +123,30 @@ public class ResidentPatientInfoController extends BaseController {
}
return R.ok(residentPatientInfoService.getCurrentResident(openid, cityCode));
}
/**
* @Author mengkuiliang
* @Description 居民头像上传
* @Date 2023-10-09 009 13:41
* @Param
* @return
**/
@ApiOperation("居民头像上传")
@PostMapping(value = "/headPictureUpload")
public AjaxResult headPictureUpload(MultipartFile file) throws Exception {
if (StringUtils.isBlank(file.getOriginalFilename())) {
return AjaxResult.error("请选择所要上传的头像!");
}
//获取路径名称
String uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getHeadPictureUrl();
//上传图片
String pictureName = FileUploadUtils.uploadNurseStationPath(uploadPathUrl, file, MimeTypeUtils.IMAGE_EXTENSION);
if (StringUtils.isBlank(pictureName)) {
throw new ServiceException(pictureName + "居民头像上传失败!");
}
//获取返回值
AjaxResult ajax = AjaxResult.success("上传成功!");
ajax.put("imgUrl", pictureName);
return ajax;
}
}

View File

@ -7,6 +7,7 @@ import com.xinelu.common.exception.ServiceException;
import com.xinelu.familydoctor.applet.pojo.body.ResidentServiceApplyBody;
import com.xinelu.familydoctor.applet.pojo.query.ApplyQuery;
import com.xinelu.familydoctor.applet.pojo.vo.ResidentServiceApplyVo;
import com.xinelu.familydoctor.applet.pojo.vo.ScreeningProjectVo;
import com.xinelu.familydoctor.applet.service.IResidentServiceAppletService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -14,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author mengkuiliang
@ -69,7 +71,7 @@ public class ResidentServiceApplyController extends BaseController {
@ApiOperation("获取个性服务包和筛查项目")
@GetMapping("/getForm/{identity}")
public R<?> getForm(@PathVariable String identity) {
return R.ok(residentServiceAppletService.getForm(identity));
public R<List<ScreeningProjectVo>> getForm(@PathVariable String identity, @RequestHeader("region") String region) {
return R.ok(residentServiceAppletService.getForm(identity, region));
}
}

View File

@ -38,7 +38,6 @@ public class FDController {
@PostMapping("/performanceBooking/list")
public R<PageInfo<ResidentServiceApplyVo>> performanceBookingList(@RequestBody ApplyQuery query) {
PageHelper.startPage(query.getPageNum(), query.getPageSize());
// query.setBookingStatus("0");
return R.ok(PageInfo.of(residentServiceAppletService.findList(query)));
}
@ApiOperation("服务申请详情")

View File

@ -149,7 +149,7 @@ token:
# 令牌有效期默认30分钟
expireTime: 1440
#请求拦截白名单
ant-matchers: /applet/test/**,/nurseApplet/**,/nurseApp/**,/applet/**,webSocket/**,
ant-matchers: /nurseApplet/**,/nurseApp/**,/applet/**,webSocket/**
# MyBatis-Plus配置
mybatis-plus:
@ -222,7 +222,7 @@ swagger:
pathMapping: /dev-api
swagger-ui:
base-url: com.xinelu.web
base-url: com.xinelu
# 防止XSS攻击
xss:
@ -233,19 +233,15 @@ xss:
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
# 微信小程序配置
# 家医签约附近的机构
applet:
wxAppid: wxccb16a452ab5e4b4
wxSecret: 72e11a5757e578c47ee935c00f49e8bf
grantType: authorization_code
openIDUrl: https://api.weixin.qq.com/sns/jscode2session
# 附近机构,多少公里内
# 多少公里内
distance: 100.00
# 家医请求地址
fd:
dy: http://192.168.124.10:8001/fd/mp
dz: http://192.168.124.10:8002/fd/mp
dy: http://192.168.124.6:8001/fd/mp
dz: http://192.168.124.6:8001/fd/mp
# 腾讯云音视频
trtc:
@ -257,9 +253,9 @@ trtc:
# 微信小程序参数配置信息
applet-chat-config:
# 微信小程序idwxdec3416aa3d60cab
applet-id: wxdc32268eca6b78f9
applet-id: wxccb16a452ab5e4b4
# 微信小程序密钥f58e19be0380c2ebc6e9e9684c0dacce
secret: 0d0e41432908750460aef2bf0aa871ae
secret: 72e11a5757e578c47ee935c00f49e8bf
# 微信小程序返回国家语言
lang: zh_CN
# 微信小程序授权类型
@ -297,4 +293,4 @@ applet-page-config:
# 积分页面跳转路径
integral-page-url: pages/integral/integral
# 护理结构详情页面跳转路径
nursestation-details-page-url: pages/nursestation/nursestation
nursestation-details-page-url: pages/nursestation/nursestation

View File

@ -35,5 +35,9 @@
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.xinelu</groupId>
<artifactId>xinelu-nurse-manage</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,8 +1,10 @@
package com.xinelu.familydoctor.applet.pojo.body;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -179,7 +181,7 @@ public class PatientInfoBody extends BaseEntity {
/**
* 会员累计签到天数
*/
@ApiModelProperty(value = "会员累计签到天数")
@ApiModelProperty(value = "会员累计签到天数", hidden = true)
private Integer totalSignInDays;
/**
@ -195,11 +197,6 @@ public class PatientInfoBody extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd")
private Date birthDate;
/**
* 是否删除标识01
*/
private Integer delFlag;
/**
* 小程序个人微信二维码图片存放地址
*/
@ -218,6 +215,20 @@ public class PatientInfoBody extends BaseEntity {
@ApiModelProperty(value = "失能原因")
private String disablingReason;
/**
* 基础疾病1高血压2高血糖3高血脂0
*/
@ApiModelProperty(value = "基础疾病1高血压2高血糖3高血脂0")
@Excel(name = "基础疾病1高血压2高血糖3高血脂0")
private String disease;
/**
* 基础疾病集合
*/
@ApiModelProperty(value = "基础疾病集合")
@Excel(name = "基础疾病集合")
private List<String> diseaseList;
/**
* 绑定城市(1德州 2东营)
*/
@ -229,14 +240,14 @@ public class PatientInfoBody extends BaseEntity {
/**
* 小程序绑定时间
*/
@ApiModelProperty(value = "小程序绑定时间")
@ApiModelProperty(value = "小程序绑定时间", hidden = true)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date bindingTime;
/**
* 当前是否选中(0 1)
*/
@ApiModelProperty(value = "当前是否选中(0 否 1是)")
@ApiModelProperty(value = "当前是否选中(0 否 1是)", hidden = true)
private String isChecked;
}

View File

@ -1,6 +1,7 @@
package com.xinelu.familydoctor.applet.pojo.entity;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.core.domain.BaseEntity;
@ -251,6 +252,20 @@ public class PatientInfo extends BaseEntity {
@Excel(name = "失能原因")
private String disablingReason;
/**
* 基础疾病1高血压2高血糖3高血脂0
*/
@ApiModelProperty(value = "基础疾病1高血压2高血糖3高血脂0")
@Excel(name = "基础疾病1高血压2高血糖3高血脂0")
private String disease;
/**
* 基础疾病集合
*/
@ApiModelProperty(value = "基础疾病集合")
@Excel(name = "基础疾病集合")
private List<String> diseaseList;
/**
* 绑定城市(1德州 2东营)
*/

View File

@ -0,0 +1,150 @@
package com.xinelu.familydoctor.applet.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author mengkuiliang
* @Description 机构展示对象
* @Date 2023-10-09 009 15:38
* @Param
* @return
**/
@ApiModel("机构展示对象")
@Data
public class OrgDetailVo {
/**
* 机构业务主键
*/
@ApiModelProperty("机构业务主键")
private String orgNo;
/**
* 上级机构业务主键
*/
@ApiModelProperty("上级机构业务主键")
private String parentNo;
/**
* 上级机构名称
*/
@ApiModelProperty("上级机构名称")
private String parentName;
/**
* 所有上级机构业务主键
*/
@ApiModelProperty("所有上级机构业务主键")
private String ancestors;
/**
* 机构名称
*/
@ApiModelProperty("机构名称")
private String orgName;
/**
* 公卫授权码
*/
@ApiModelProperty("公卫授权码")
private String phAuthCode;
/**
* 公卫机构id
*/
@ApiModelProperty("公卫机构id")
private String phOrgId;
/**
* 公卫机构编码
*/
@ApiModelProperty("公卫机构编码")
private String phOrgCode;
/**
* 机构类型0卫健委1卫健局2医院3乡镇卫生院4街道卫生服务中心5社区服务站6村卫生室
*/
@ApiModelProperty("机构类型0卫健委1卫健局2医院3乡镇卫生院4街道卫生服务中心5社区服务站6村卫生室")
private String orgType;
/**
* 机构地址
*/
@ApiModelProperty("机构地址")
private String address;
/**
* 经度
*/
@ApiModelProperty("经度")
private BigDecimal lng;
/**
* 纬度
*/
@ApiModelProperty("纬度")
private BigDecimal lat;
/**
* 机构联系方式
*/
@ApiModelProperty("机构联系方式")
private String phone;
/**
* 机构公章路径
*/
@ApiModelProperty("机构公章路径")
private String sealPath;
/**
* 机构介绍
*/
@ApiModelProperty("机构介绍")
private String introduction;
/**
* 行政级别0-4等级依次降低4级不能创建子机构
*/
@ApiModelProperty("行政级别0-4等级依次降低4级不能创建子机构")
private Integer orgLevel;
/**
* 所属区县级的行政区划编号
*/
@ApiModelProperty("所属区县级的行政区划编号")
private Long areaCode;
/**
* 所属区县级的行政区划名称
*/
@ApiModelProperty("所属区县级的行政区划名称")
private String areaName;
/**
* 后缀用于分表查询
*/
@ApiModelProperty(value = "后缀,用于分表查询", hidden=true)
private String suffix;
/**
* 系统版本0公卫随访版本 1家医签约版本 2精细化履约版本 3三高共管版本
*/
@ApiModelProperty(value = "系统版本0公卫随访版本 1家医签约版本 2精细化履约版本 3三高共管版本", hidden=true)
private String sysVersion;
/**
* 是否可用 0停用1正常
*/
@ApiModelProperty("是否可用")
private Boolean usable;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
}

View File

@ -0,0 +1,236 @@
package com.xinelu.familydoctor.applet.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author mengkuiliang
* @Description 履约明细展示类
* @Date 2023-10-09 009 15:16
* @Param
* @return
**/
@ApiModel("履约明细展示类")
@Data
public class PerformanceDetailVo {
/**
* 履约明细业务主键
*/
@ApiModelProperty(value = "履约明细业务主键")
private String performanceDetailNo;
/**
* 签约编号
*/
@ApiModelProperty(value = "签约编号")
private String signNo;
/**
* 居民用户业务主键
*/
@ApiModelProperty(value = "居民用户业务主键")
private String residentNo;
/**
* 姓名
*/
@ApiModelProperty(value = "姓名")
private String residentName;
/**
* 身份证号
*/
@ApiModelProperty(value = "身份证号")
private String identity;
/**
* 服务包编号
*/
@ApiModelProperty(value = "服务包编号")
private String packageNo;
/**
* 服务包名称
*/
@ApiModelProperty(value = "服务包名称")
private String packageName;
/**
* 服务包明细编号
*/
@ApiModelProperty(value = "服务包明细编号")
private String packageDetailNo;
/**
* 服务项表单编号
*/
@ApiModelProperty(value = "服务项表单编号")
private String formNo;
/**
* 服务项表单名称
*/
@ApiModelProperty(value = "服务项表单名称")
private String formName;
/**
* 价格单位#0.00
*/
@ApiModelProperty(value = "价格(单位:元,#0.00")
private BigDecimal packCost;
/**
* 优惠价格单位#0.00
*/
@ApiModelProperty(value = "优惠价格(单位:元,#0.00")
private BigDecimal packCostCheap;
/**
* 签约价格单位#0.00
*/
@ApiModelProperty(value = "签约价格(单位:元,#0.00")
private BigDecimal packSignCost;
/**
* 服务包类型0基本公共卫生服务包 1家医服务包 2精细化服务包
*/
@ApiModelProperty(value = "服务包类型0基本公共卫生服务包 1家医服务包 2精细化服务包")
private String packType;
/**
* 服务包类别0基础服务包 1个性化服务包
* */
@ApiModelProperty(value = "服务包类别0基础服务包 1个性化服务包")
private String packCategory;
/**
* 是否精细化表单
*/
@ApiModelProperty("是否精细化表单")
private Boolean refineForm;
/**
* 是否公卫表单01
*/
@ApiModelProperty(value = "是否公卫表单01")
private Boolean phForm;
/**
* 公卫类型是公卫表单时不能为空12孕产妇产后访视 14新生儿随访 28高血压 29糖尿病 30高血压高危人群 32精神障碍
*/
@ApiModelProperty(value = "公卫类型是公卫表单时不能为空12孕产妇产后访视 14新生儿随访 28高血压 29糖尿病 30高血压高危人群 32精神障碍")
private String phType;
/**
* PC端路径
*/
@ApiModelProperty(value = "PC端路径")
private String pcFormPath;
/**
* APP端路径
*/
@ApiModelProperty(value = "APP端路径")
private String appFormPath;
/**
* 应服务次数
*/
@ApiModelProperty(value = "应服务次数")
private Integer serviceFreq;
/**
* 已履约次数
*/
@ApiModelProperty(value = "已履约次数")
private Integer performanceCount;
/**
* 机构业务编号
*/
@ApiModelProperty(value = "机构业务编号")
private String orgNo;
/**
* 机构名称
*/
@ApiModelProperty(value = "机构名称", required = true)
private String orgName;
/**
* 团队业务编号
*/
@ApiModelProperty(value = "团队业务编号", required = true)
private String teamNo;
/**
* 团队名称
*/
@ApiModelProperty(value = "团队名称", required = true)
private String teamName;
/**
* 是否已完成0 1
*/
@ApiModelProperty(value = "是否已完成0否 1")
private Boolean complete;
/**
* 履约医生编号
*/
@ApiModelProperty(value = "履约医生编号")
private String userNo;
/**
* 履约医生姓名
*/
@ApiModelProperty(value = "履约医生姓名")
private String userName;
/**
* 最后履约时间
*/
@ApiModelProperty(value = "最后履约时间")
private Date lastDate;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createDate;
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateDate;
/**
* 删除标识 0正常1已删除
*/
@ApiModelProperty(value = "删除标识( 0正常1已删除")
private Boolean delete;
}

View File

@ -1,12 +1,10 @@
package com.xinelu.familydoctor.applet.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author mengkuiliang
@ -19,10 +17,28 @@ import java.util.Date;
@ApiModel("筛查项目展示对象")
public class ScreeningProjectVo {
/**
* 项目来源
*/
@ApiModelProperty("项目来源1 家医个性服务包 2 筛查包)")
private String sourceType;
/**
* 服务包编码
*/
@ApiModelProperty("服务包编码")
private String packageId;
/**
* 服务包名称
*/
@ApiModelProperty("服务包名称")
private String packageName;
/**
* 项目编码
*/
@ApiModelProperty("项目业务主键")
@ApiModelProperty("项目编号=码")
private String projectId;
/**
@ -32,21 +48,15 @@ public class ScreeningProjectVo {
private String projectName;
/**
* 类型0其他项目 1常规项目 2履约项目
* 机构ID
*/
@ApiModelProperty("类型0其他项目 1常规项目 2履约项目")
private String projectType;
/**
* 所属机构ID
*/
@ApiModelProperty("所属机构ID")
@ApiModelProperty("机构ID")
private String deptId;
/**
* 所属机构名称
*/
@ApiModelProperty("所属机构名称")
@ApiModelProperty("机构名称")
private String deptName;
/**
@ -54,6 +64,7 @@ public class ScreeningProjectVo {
*/
@ApiModelProperty("服务内容")
private String serviceContent;
/**
* 单价/
*/
@ -67,47 +78,51 @@ public class ScreeningProjectVo {
private String discount;
/**
* 显示排序
* 优惠后价格
*/
@ApiModelProperty("显示排序")
private Integer orderNum;
@ApiModelProperty("优惠后价格")
private BigDecimal discountPrice;
/**
* 项目状态0正常1停用
* 应服务次数
*/
@ApiModelProperty("项目状态0正常1停用")
private String status;
@ApiModelProperty(value = "应服务次数")
private Integer serviceFreq;
/**
* 删除标识0存在1删除
* 已履约次数
*/
@ApiModelProperty(value = "删除标识0存在1删除", hidden = true)
private String delFlag;
@ApiModelProperty(value = "已服务次数")
private Integer performanceCount;
/**
* 创建者
* 团队业务编号
*/
private String createBy;
@ApiModelProperty(value = "团队业务编号", required = true)
private String teamNo;
/**
* 创建时间
* 团队名称
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "团队名称", required = true)
private String teamName;
/**
* 更新者
* 是否已完成0 1
*/
private String updateBy;
@ApiModelProperty(value = "是否已完成0否 1")
private Boolean complete;
/**
* 更新时间
* 履约医生编号
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@ApiModelProperty(value = "服务医生编号")
private String userNo;
/**
* 备注
* 履约医生姓名
*/
private String remark;
@ApiModelProperty(value = "服务医生姓名")
private String userName;
}

View File

@ -64,7 +64,7 @@ public interface IResidentPatientInfoService {
/**
* @return void
* @Author mengkuiliang
* @Description 注册
* @Description 注册和完善信息
* @Date 2023-09-21 021 10:13
* @Param [body]
**/

View File

@ -4,6 +4,7 @@ import com.xinelu.familydoctor.applet.pojo.body.ApprovalBody;
import com.xinelu.familydoctor.applet.pojo.body.ResidentServiceApplyBody;
import com.xinelu.familydoctor.applet.pojo.query.ApplyQuery;
import com.xinelu.familydoctor.applet.pojo.vo.ResidentServiceApplyVo;
import com.xinelu.familydoctor.applet.pojo.vo.ScreeningProjectVo;
import java.util.List;
import java.util.Map;
@ -103,5 +104,5 @@ public interface IResidentServiceAppletService {
* @Param [identity]
* @return java.lang.Object
**/
List<?> getForm(String identity);
List<ScreeningProjectVo> getForm(String identity, String region);
}

View File

@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.xinelu.common.config.AppletChatConfig;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.common.utils.http.HttpService;
@ -38,15 +39,8 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
private ResidentPatientInfoMapper residentPatientInfoMapper;
@Resource
private HttpService httpService;
@Value("${applet.wxAppid}")
private String WX_APPID;
@Value("${applet.wxSecret}")
private String WX_SECRET;
@Value("${applet.grantType}")
private String GRANTTYPE;
@Value("${applet.openIDUrl}")
private String OPENID_URL;
@Resource
private AppletChatConfig appletChatConfig;
/**
* @return com.xinelu.familydoctor.applet.pojo.entity.PatientInfo
@ -83,9 +77,9 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
public String getOpenId(String code) {
try {
SslUtils.ignoreSsl();
String params = "appid=" + WX_APPID + "&secret=" + WX_SECRET + "&js_code=" + code + "&grant_type=" + GRANTTYPE;
String params = "appid=" + appletChatConfig.getAppletId() + "&secret=" + appletChatConfig.getSecret() + "&js_code=" + code + "&grant_type=" + appletChatConfig.getGrantType();
log.info("获取openID请求参数{}", params);
String result = HttpUtils.sendPost(OPENID_URL, params);
String result = HttpUtils.sendPost("https://api.weixin.qq.com/sns/jscode2session", params);
JSONObject json = JSONObject.parseObject(result);
// {"errcode":40029,"errmsg":"invalid code, rid: 650bf9c3-31a6c960-2b437029"}
log.info("获取openID响应结果{}", json.toJSONString());
@ -112,7 +106,7 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
JSONObject result;
// 获取token
String token_url = String.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", WX_APPID, WX_SECRET);
String token_url = String.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", appletChatConfig.getAppletId(), appletChatConfig.getSecret());
SslUtils.ignoreSsl();
String tokenResult = HttpUtils.sendGet(token_url);
if (tokenResult == null) {
@ -159,40 +153,57 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
/**
* @return void
* @Author mengkuiliang
* @Description 注册
* @Description 注册和完善信息
* @Date 2023-09-21 021 10:14
* @Param [body]
**/
@Override
public void register(PatientInfoBody body) {
if (ObjectUtils.isNotEmpty(body.getCardNo())) {
// 获取当前微信绑定的居民
List<PatientInfo> list = residentPatientInfoMapper.getList(body.getOpenid(), body.getCityCode());
PatientInfo patientInfo = residentPatientInfoMapper.isRegisterByCardNo(body.getCardNo());
if (patientInfo == null) {
PatientInfo entity = new PatientInfo();
BeanUtils.copyBeanProp(entity, body);
entity.setPatientCode(IdUtils.fastSimpleUUID());
entity.setBindingTime(new Date());
entity.setIsChecked((list == null || list.size() == 0) ? "1" : "0");
entity.setCreateTime(new Date());
entity.setCreateBy(body.getCardNo());
residentPatientInfoMapper.insertPatientInfo(entity);
} else {
if (!StringUtils.isBlank(patientInfo.getOpenid())) {
throw new ServiceException("该身份证号已被注册");
// 修改
if(!StringUtils.isBlank(body.getPatientCode())) {
PatientInfo patientInfo = residentPatientInfoMapper.getByCardNo(body.getCardNo());
BeanUtils.copyBeanProp(patientInfo, body);
if(body.getDiseaseList() != null) {
patientInfo.setDisease(body.getDiseaseList().stream().collect(Collectors.joining(",")));
}
updatePatientInfo(patientInfo);
// 注册
} else {
// 获取当前微信绑定的居民
List<PatientInfo> list = residentPatientInfoMapper.getList(body.getOpenid(), body.getCityCode());
PatientInfo patientInfo = residentPatientInfoMapper.isRegisterByCardNo(body.getCardNo());
if (patientInfo == null) {
PatientInfo entity = new PatientInfo();
BeanUtils.copyBeanProp(entity, body);
if(body.getDiseaseList() != null) {
entity.setDisease(body.getDiseaseList().stream().collect(Collectors.joining(",")));
}
entity.setPatientCode(IdUtils.fastSimpleUUID());
entity.setBindingTime(new Date());
entity.setIsChecked((list == null || list.size() == 0) ? "1" : "0");
entity.setCreateTime(new Date());
entity.setCreateBy(body.getCardNo());
residentPatientInfoMapper.insertPatientInfo(entity);
} else {
if (!StringUtils.isBlank(patientInfo.getOpenid())) {
throw new ServiceException("该身份证号已被注册");
}
patientInfo.setIsChecked((list == null || list.size() == 0) ? "1" : "0");
patientInfo.setOpenid(body.getOpenid());
patientInfo.setUnionid(body.getUnionid());
patientInfo.setPatientName(body.getPatientName());
patientInfo.setPhone(body.getPhone());
patientInfo.setAddress(body.getAddress());
patientInfo.setUpdateTime(new Date());
patientInfo.setUpdateBy(body.getCardNo());
patientInfo.setHeadPictureUrl(body.getHeadPictureUrl());
patientInfo.setDelFlag(0);
if(body.getDiseaseList() != null) {
patientInfo.setDisease(body.getDiseaseList().stream().collect(Collectors.joining(",")));
}
residentPatientInfoMapper.updatePatientInfo(patientInfo);
}
patientInfo.setIsChecked((list == null || list.size() == 0) ? "1" : "0");
patientInfo.setOpenid(body.getOpenid());
patientInfo.setUnionid(body.getUnionid());
patientInfo.setPatientName(body.getPatientName());
patientInfo.setPhone(body.getPhone());
patientInfo.setAddress(body.getAddress());
patientInfo.setUpdateTime(new Date());
patientInfo.setUpdateBy(body.getCardNo());
patientInfo.setHeadPictureUrl(body.getHeadPictureUrl());
patientInfo.setDelFlag(0);
residentPatientInfoMapper.updatePatientInfo(patientInfo);
}
}
}

View File

@ -1,6 +1,8 @@
package com.xinelu.familydoctor.applet.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.common.utils.StringUtils;
@ -14,10 +16,13 @@ import com.xinelu.familydoctor.applet.pojo.dto.ResidentServiceFormApplyDto;
import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo;
import com.xinelu.familydoctor.applet.pojo.entity.ResidentServiceApplyEntity;
import com.xinelu.familydoctor.applet.pojo.query.ApplyQuery;
import com.xinelu.familydoctor.applet.pojo.vo.ResidentServiceApplyVo;
import com.xinelu.familydoctor.applet.pojo.vo.SignInfoDetailVo;
import com.xinelu.familydoctor.applet.pojo.vo.*;
import com.xinelu.familydoctor.applet.service.IResidentPatientInfoService;
import com.xinelu.familydoctor.applet.service.IResidentServiceAppletService;
import com.xinelu.manage.domain.hospitalinfo.HospitalInfo;
import com.xinelu.manage.domain.screeningproject.ScreeningProject;
import com.xinelu.manage.service.hospitalinfo.IHospitalInfoService;
import com.xinelu.manage.service.screeningproject.IScreeningProjectService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -40,6 +45,10 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe
private HttpService httpService;
@Resource
private IResidentPatientInfoService patientInfoService;
@Resource
private IHospitalInfoService hospitalInfoService;
@Resource
private IScreeningProjectService screeningProjectService;
/**
* 新增服务申请
@ -61,7 +70,7 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe
}
ResidentServiceApplyEntity entity;
PatientInfo patientInfo = null;
if(StringUtils.isBlank(body.getPatientId())) {
if (StringUtils.isBlank(body.getPatientId())) {
patientInfo = patientInfoService.getByCardNo(body.getIdentity());
if (patientInfo == null) {
throw new ServiceException("未查询到注册信息");
@ -69,11 +78,11 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe
}
List<ResidentServiceApplyEntity> serviceApplyList = new ArrayList<>();
for(ResidentServiceFormApplyDto form: body.getFormList()) {
if(!StringUtils.isBlank(form.getFormNo())) {
for (ResidentServiceFormApplyDto form : body.getFormList()) {
if (!StringUtils.isBlank(form.getFormNo())) {
entity = new ResidentServiceApplyEntity();
BeanUtils.copyProperties(body, entity);
if(patientInfo != null) {
if (patientInfo != null) {
entity.setPatientId(patientInfo.getPatientCode());
}
entity.setApplyTime(new Date());
@ -89,7 +98,7 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe
serviceApplyList.add(entity);
}
}
if(serviceApplyList.size() == 0) {
if (serviceApplyList.size() == 0) {
throw new ServiceException("服务项目不能为空");
}
residentServiceApplyMapper.batchInsert(serviceApplyList);
@ -178,9 +187,9 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe
throw new ServiceException("未查询到申请记录");
}
if (!StringUtils.isBlank(residentServiceApplyVo.getBookingStatus())) {
if(residentServiceApplyVo.getBookingStatus().equals("1")) {
if (residentServiceApplyVo.getBookingStatus().equals("1")) {
throw new ServiceException("已完成,不能取消");
} else if(residentServiceApplyVo.getBookingStatus().equals("2")) {
} else if (residentServiceApplyVo.getBookingStatus().equals("2")) {
throw new ServiceException("不能重复取消");
}
}
@ -242,19 +251,90 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe
}
/**
* @return java.util.List<?>
* @Author mengkuiliang
* @Description 获取个性服务包和筛查项目
* @Date 2023-10-09 009 10:55
* @Param [identity]
* @return java.util.List<?>
**/
@Override
public List<?> getForm(String identity) {
public List<ScreeningProjectVo> getForm(String identity, String region) {
List<ScreeningProjectVo> projectList = new ArrayList<>();
// 获取签约信息
String result = (String) httpService.get(SpringUtils.getFdUrl(region) + "/resident/signinfo/detail/" + identity, null, String.class);
JSONObject jsonObject = JSONObject.parseObject(result);
if (!"1".equals(jsonObject.get("code"))) {
throw new ServiceException(jsonObject.get("msg").toString());
}
if (!jsonObject.containsKey("data") || jsonObject.get("data") == null) {
throw new ServiceException("未查询到签约信息");
}
SignInfoDetailVo signInfo = JSONObject.parseObject(jsonObject.getJSONObject("data").toJSONString(), SignInfoDetailVo.class);
if (signInfo == null) {
throw new ServiceException("未查询到签约信息!");
}
// 获取家医个性服务包
result = (String) httpService.get(SpringUtils.getFdUrl(region) + "/package/getPackageOfGX/" + identity, null, String.class);
jsonObject = JSONObject.parseObject(result);
if (!"1".equals(jsonObject.get("code"))) {
throw new ServiceException(jsonObject.get("msg").toString());
}
if (jsonObject.containsKey("data") && jsonObject.get("data") != null) {
List<PerformanceDetailVo> perList = JSONArray.parseArray(jsonObject.getJSONArray("data").toJSONString()).toJavaList(PerformanceDetailVo.class);
if (perList.size() > 0) {
ScreeningProjectVo sp;
for (PerformanceDetailVo per : perList) {
sp = new ScreeningProjectVo();
sp.setDeptId(per.getOrgNo());
sp.setDeptName(per.getOrgName());
sp.setPackageId(per.getPackageNo());
sp.setPackageName(per.getPackageName());
sp.setProjectId(per.getFormNo());
sp.setProjectName(per.getFormName());
sp.setPrice(per.getPackCost());
sp.setDiscountPrice(per.getPackSignCost());
sp.setServiceFreq(per.getServiceFreq());
sp.setPerformanceCount(per.getPerformanceCount());
projectList.add(sp);
}
}
}
// 获取签约机构下的筛查项目
// 获取家医机构详情
result = (String) httpService.get(SpringUtils.getFdUrl(region) + "/org/getOrgDetail/" + signInfo.getOrgNo(), null, String.class);
jsonObject = JSONObject.parseObject(result);
if ("1".equals(jsonObject.get("code"))) {
if (jsonObject.containsKey("data") && jsonObject.get("data") != null) {
OrgDetailVo org = JSONObject.parseObject(jsonObject.getJSONObject("data").toJSONString(), OrgDetailVo.class);
if (org != null && !StringUtils.isBlank(org.getPhOrgCode())) {
// 根据机构编码获取筛查机构
HospitalInfo Hospital = hospitalInfoService.getHosptalByOrgCode(org.getPhOrgCode());
if(Hospital != null) {
// 获取筛查项目
ScreeningProject query = new ScreeningProject();
query.setDeptId(Hospital.getHospitalCode());
List<ScreeningProject> screeningProjectList = screeningProjectService.findList(query);
if(screeningProjectList != null && screeningProjectList.size() > 0) {
ScreeningProjectVo sp;
for(ScreeningProject project: screeningProjectList) {
sp = new ScreeningProjectVo();
sp.setDeptId(project.getDeptId());
sp.setDeptName(project.getDeptName());
sp.setProjectId(project.getProjectId());
sp.setProjectName(project.getProjectName());
sp.setPrice(project.getPrice());
sp.setDiscountPrice(project.getDiscountPrice());
projectList.add(sp);
}
}
}
return null;
}
}
}
return projectList;
}
}

View File

@ -41,6 +41,7 @@
<result property="personalWechatCodeUrl" column="personal_wechat_code_url"/>
<result property="disablingCondition" column="disabling_condition"/>
<result property="disablingReason" column="disabling_reason"/>
<result property="disease" column="disease"/>
<result property="cityCode" column="city_code"/>
<result property="bindingTime" column="binding_time"/>
<result property="isChecked" column="is_checked"/>
@ -83,6 +84,7 @@
personal_wechat_code_url,
disabling_condition,
disabling_reason,
disease,
city_code,
binding_time,
is_checked
@ -196,6 +198,9 @@
</if>
<if test="disablingReason != null">disabling_reason,
</if>
<if test="disease != null">
disease,
</if>
<if test="cityCode != null and cityCode != ''">city_code,
</if>
<if test="bindingTime != null">binding_time,
@ -274,6 +279,7 @@
</if>
<if test="disablingReason != null">#{disablingReason},
</if>
<if test="disease != null">#{disease},</if>
<if test="cityCode != null and cityCode != ''">#{cityCode},
</if>
<if test="bindingTime != null">#{bindingTime},
@ -388,6 +394,9 @@
<if test="disablingReason != null">disabling_reason =
#{disablingReason},
</if>
<if test="disease != null">
disease = #{disease},
</if>
<if test="cityCode != null and cityCode != ''">city_code =
#{cityCode},
</if>

View File

@ -74,4 +74,13 @@ public interface HospitalInfoMapper {
* @return List<HospitalInfo>
*/
List<HospitalInfo> selectHospitalList(Long[] ids);
/**
* @Author mengkuiliang
* @Description 根据家医机构编码查询医院
* @Date 2023-10-09 009 15:47
* @Param [orgCode]
* @return com.xinelu.manage.domain.hospitalinfo.HospitalInfo
**/
HospitalInfo getHosptalByOrgCode(String orgCode);
}

View File

@ -59,4 +59,13 @@ public interface IHospitalInfoService {
* @return 结果
*/
int deleteHospitalInfoById(Long id);
/**
* @Author mengkuiliang
* @Description 根据家医机构编码查询医院
* @Date 2023-10-09 009 15:46
* @Param
* @return
**/
HospitalInfo getHosptalByOrgCode(String orgCode);
}

View File

@ -198,5 +198,17 @@ public class HospitalInfoServiceImpl implements IHospitalInfoService {
}
}
}
/**
* @Author mengkuiliang
* @Description 根据家医机构编码查询医院
* @Date 2023-10-09 009 15:47
* @Param [orgCode]
* @return com.xinelu.manage.domain.hospitalinfo.HospitalInfo
**/
@Override
public HospitalInfo getHosptalByOrgCode(String orgCode) {
return hospitalInfoMapper.getHosptalByOrgCode(orgCode);
}
}

View File

@ -176,4 +176,10 @@
#{ids}
</foreach>
</select>
<!-- 根据家医机构编码查询医院 -->
<select id="getHosptalByOrgCode" resultType="com.xinelu.manage.domain.hospitalinfo.HospitalInfo">
<include refid="selectHospitalInfoVo"/>
where ph_org_code = #{orgCode} limit 1
</select>
</mapper>