|
@ -1,13 +1,20 @@
|
|
package com.yihu.jw.hospital.endpoint.archives;
|
|
package com.yihu.jw.hospital.endpoint.archives;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.yihu.jw.common.CommonSmsService;
|
|
import com.yihu.jw.contant.CommonContant;
|
|
import com.yihu.jw.contant.CommonContant;
|
|
import com.yihu.jw.entity.base.patient.BaseIdcardRecordDO;
|
|
import com.yihu.jw.entity.base.patient.BaseIdcardRecordDO;
|
|
|
|
import com.yihu.jw.entity.base.patient.BaseMedicalRecordCopyingApplyDO;
|
|
import com.yihu.jw.entity.hospital.record.HospitalPatientInpatientRecordDO;
|
|
import com.yihu.jw.entity.hospital.record.HospitalPatientInpatientRecordDO;
|
|
import com.yihu.jw.hospital.record.service.HospitalPatientInpatientRecordService;
|
|
import com.yihu.jw.hospital.record.service.HospitalPatientInpatientRecordService;
|
|
import com.yihu.jw.patient.dao.BaseIdcardRecordDao;
|
|
import com.yihu.jw.patient.dao.BaseIdcardRecordDao;
|
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
|
import com.yihu.jw.util.entity.ServiceException;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
@ -15,8 +22,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by yeshijie on 2022/11/28.
|
|
* Created by yeshijie on 2022/11/28.
|
|
@ -30,6 +36,266 @@ public class MedicalRecordCopyingEndpoint extends EnvelopRestEndpoint {
|
|
private HospitalPatientInpatientRecordService inpatientRecordService;
|
|
private HospitalPatientInpatientRecordService inpatientRecordService;
|
|
@Autowired
|
|
@Autowired
|
|
private BaseIdcardRecordDao idcardRecordDao;
|
|
private BaseIdcardRecordDao idcardRecordDao;
|
|
|
|
@Autowired
|
|
|
|
private CommonSmsService commonSmsService;
|
|
|
|
|
|
|
|
private static final Integer expire = 600;//5分钟
|
|
|
|
|
|
|
|
@PostMapping(value = "cancelApply")
|
|
|
|
@ApiOperation(value = "取消复印")
|
|
|
|
public Envelop cancelApply (
|
|
|
|
@ApiParam(name = "id", value = "申请id")
|
|
|
|
@RequestParam(value = "id", required = true) String id) {
|
|
|
|
try {
|
|
|
|
inpatientRecordService.cancelApply(id);
|
|
|
|
return Envelop.getSuccess(CommonContant.Message.OPERATE_SUCCESS);
|
|
|
|
}catch (ServiceException se){
|
|
|
|
return Envelop.getError(se.getMessage());
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
return Envelop.getError(CommonContant.Message.GET_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping(value = "changePickupWay")
|
|
|
|
@ApiOperation(value = "改为自取")
|
|
|
|
public Envelop changePickupWay (
|
|
|
|
@ApiParam(name = "id", value = "申请id")
|
|
|
|
@RequestParam(value = "id", required = true) String id) {
|
|
|
|
try {
|
|
|
|
inpatientRecordService.changePickupWay(id);
|
|
|
|
return Envelop.getSuccess(CommonContant.Message.OPERATE_SUCCESS);
|
|
|
|
}catch (ServiceException se){
|
|
|
|
return Envelop.getError(se.getMessage());
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
return Envelop.getError(CommonContant.Message.GET_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "applyDetail")
|
|
|
|
@ApiOperation(value = "申请详情")
|
|
|
|
public ObjEnvelop applyDetail (
|
|
|
|
@ApiParam(name = "id", value = "申请id")
|
|
|
|
@RequestParam(value = "id", required = true) String id) {
|
|
|
|
try {
|
|
|
|
return ObjEnvelop.getSuccess("获取成功",inpatientRecordService.applyDetail(id));
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
return ObjEnvelop.getError(CommonContant.Message.GET_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "applyPage")
|
|
|
|
@ApiOperation(value = "复印病案申请列表")
|
|
|
|
public PageEnvelop applyPage (
|
|
|
|
@ApiParam(name = "patient", value = "居民id")
|
|
|
|
@RequestParam(value = "patient", required = false) String patient,
|
|
|
|
@ApiParam(name = "name", value = "姓名")
|
|
|
|
@RequestParam(value = "name", required = false) String name,
|
|
|
|
@ApiParam(name = "status", value = "状态")
|
|
|
|
@RequestParam(value = "status", required = false) String status,
|
|
|
|
@ApiParam(name = "startTime", value = "开始时间")
|
|
|
|
@RequestParam(value = "startTime", required = false) String startTime,
|
|
|
|
@ApiParam(name = "endTime", value = "结束时间")
|
|
|
|
@RequestParam(value = "endTime", required = false) String endTime,
|
|
|
|
@ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
|
@RequestParam(value = "page") Integer page,
|
|
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
|
@RequestParam(value = "size") Integer size) {
|
|
|
|
try {
|
|
|
|
return inpatientRecordService.applyPage(patient, page, size,name,status,startTime,endTime);
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
return PageEnvelop.getError(CommonContant.Message.GET_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("通用发送短信验证码")
|
|
|
|
@PostMapping(value = "sendSms")
|
|
|
|
public MixEnvelop sendCaptcha(@ApiParam(name = "jsonData", value = "jsonData", required = false)
|
|
|
|
@RequestParam(value = "jsonData", required = false) String jsonData) throws Exception {
|
|
|
|
try {
|
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
|
JSONObject obj = JSONObject.parseObject(jsonData);
|
|
|
|
String client_id = obj.getString("client_id");
|
|
|
|
String type = obj.getString("type");//类型 idInfoFilling 身份证信息填写
|
|
|
|
String phoneNum = obj.getString("phoneNum");
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(client_id)) {
|
|
|
|
mixEnvelop.setStatus(468);
|
|
|
|
mixEnvelop.setMessage("client_id不能为空");
|
|
|
|
return mixEnvelop;
|
|
|
|
}
|
|
|
|
if (StringUtils.isEmpty(type)) {
|
|
|
|
mixEnvelop.setStatus(468);
|
|
|
|
mixEnvelop.setMessage("类型不能为空");
|
|
|
|
return mixEnvelop;
|
|
|
|
}
|
|
|
|
if (StringUtils.isEmpty(phoneNum)) {
|
|
|
|
mixEnvelop.setStatus(468);
|
|
|
|
mixEnvelop.setMessage("电话号不能为空");
|
|
|
|
return mixEnvelop;
|
|
|
|
}
|
|
|
|
if (phoneNum.length() > 12) {
|
|
|
|
mixEnvelop.setStatus(468);
|
|
|
|
mixEnvelop.setMessage("请输入正确的手机号");
|
|
|
|
return mixEnvelop;
|
|
|
|
}
|
|
|
|
//验证请求间隔超时,防止频繁获取验证码
|
|
|
|
if (!commonSmsService.isIntervalTimeout(client_id, phoneNum,type)) {
|
|
|
|
throw new IllegalAccessException("SMS request frequency is too fast");
|
|
|
|
//发送短信获取验证码
|
|
|
|
}
|
|
|
|
mixEnvelop = commonSmsService.sendSms(client_id,phoneNum,expire,type,mixEnvelop);
|
|
|
|
return mixEnvelop;
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
return MixEnvelop.getError("短信发送失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping(value = "apply")
|
|
|
|
@ApiOperation(value = "申请病案复印")
|
|
|
|
public Envelop apply(@ApiParam(name = "jsonData", value = "json入参")
|
|
|
|
@RequestParam(value = "jsonData", required = true) String jsonData){
|
|
|
|
try {
|
|
|
|
BaseMedicalRecordCopyingApplyDO applyDO = JSONObject.parseObject(jsonData,BaseMedicalRecordCopyingApplyDO.class);
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(applyDO.getPatientId())){
|
|
|
|
return Envelop.getError("参数错误-未选择就诊人");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyDO.getUseTo())){
|
|
|
|
return Envelop.getError("参数错误-未选择复印用途");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyDO.getPatientRelation())){
|
|
|
|
return Envelop.getError("参数错误-未选择与就诊人关系");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyDO.getAppendix1())){
|
|
|
|
return Envelop.getError("参数错误-未上传患者证件头像面");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyDO.getAppendix2())){
|
|
|
|
return Envelop.getError("参数错误-未上传患者证件国徽面");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyDO.getAppendix3())){
|
|
|
|
return Envelop.getError("参数错误-未上传患者手持头像面");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyDO.getAppendix4())){
|
|
|
|
return Envelop.getError("参数错误-未上传申请人证件头像面");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyDO.getAppendix5())){
|
|
|
|
return Envelop.getError("参数错误-未上传申请人证件国徽面");
|
|
|
|
}
|
|
|
|
if(!"1".equals(applyDO.getPatientRelation())){
|
|
|
|
if(StringUtils.isBlank(applyDO.getApplyName())){
|
|
|
|
return Envelop.getError("参数错误-未填写申请人姓名");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyDO.getApplyIdcard())){
|
|
|
|
return Envelop.getError("参数错误-未填写申请人身份证");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyDO.getApplyMobile())){
|
|
|
|
return Envelop.getError("参数错误-未填写手机号码");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyDO.getCaseId())){
|
|
|
|
return Envelop.getError("参数错误-未选择住院病例");
|
|
|
|
}
|
|
|
|
if(applyDO.getApplyTypeList()==null||applyDO.getApplyTypeList().size()==0){
|
|
|
|
return Envelop.getError("参数错误-未选择复印内容");
|
|
|
|
}
|
|
|
|
if(applyDO.getExpressageDO()==null){
|
|
|
|
return Envelop.getError("参数错误-未填写取件信息");
|
|
|
|
}
|
|
|
|
|
|
|
|
inpatientRecordService.apply(applyDO);
|
|
|
|
return Envelop.getSuccess("申请提交成功");
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
return Envelop.getError("操作失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping(value = "idInfoFilling")
|
|
|
|
@ApiOperation(value = "身份信息填写")
|
|
|
|
public Envelop idInfoFilling(@ApiParam(name = "jsonData", value = "json入参")
|
|
|
|
@RequestParam(value = "jsonData", required = true) String jsonData){
|
|
|
|
try {
|
|
|
|
JSONObject json = JSON.parseObject(jsonData);
|
|
|
|
String patientId = json.getString("patientId");
|
|
|
|
String patientName = json.getString("patientName");
|
|
|
|
String patientIdcard = json.getString("patientIdcard");
|
|
|
|
String useTo = json.getString("useTo");
|
|
|
|
String patientRelation = json.getString("patientRelation");
|
|
|
|
String applyName = json.getString("applyName");
|
|
|
|
String applyIdcard = json.getString("applyIdcard");
|
|
|
|
String applyMobile = json.getString("applyMobile");
|
|
|
|
String captcha = json.getString("captcha");
|
|
|
|
String client_id = json.getString("client_id");
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(client_id)){
|
|
|
|
return Envelop.getError("参数错误");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(patientId)){
|
|
|
|
return Envelop.getError("请选择就诊人");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(useTo)){
|
|
|
|
return Envelop.getError("请选择复印用途");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(patientRelation)){
|
|
|
|
return Envelop.getError("请选择与就诊人关系");
|
|
|
|
}
|
|
|
|
if(!"1".equals(patientRelation)){
|
|
|
|
if(StringUtils.isBlank(applyName)){
|
|
|
|
return Envelop.getError("请填写申请人姓名");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyIdcard)){
|
|
|
|
return Envelop.getError("请填写申请人身份证");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(applyMobile)){
|
|
|
|
return Envelop.getError("请填写手机号码");
|
|
|
|
}
|
|
|
|
if(StringUtils.isBlank(captcha)){
|
|
|
|
return Envelop.getError("请填写验证码");
|
|
|
|
}
|
|
|
|
//判断验证码
|
|
|
|
boolean checkCode = commonSmsService.verification(client_id, applyMobile, captcha,"1");
|
|
|
|
if(!checkCode){
|
|
|
|
return Envelop.getError("验证码错误");
|
|
|
|
}
|
|
|
|
//判断居民是否有住院记录-对接第三方
|
|
|
|
|
|
|
|
|
|
|
|
return Envelop.getSuccess("操作成功");
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
return Envelop.getError("操作失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "hospitalRecordPage")
|
|
|
|
@ApiOperation(value = "住院记录分页")
|
|
|
|
public PageEnvelop hospitalRecordPage (
|
|
|
|
@ApiParam(name = "patient", value = "居民id")
|
|
|
|
@RequestParam(value = "patient", required = true) String patient,
|
|
|
|
@ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
|
@RequestParam(value = "page") Integer page,
|
|
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
|
@RequestParam(value = "size") Integer size) {
|
|
|
|
try {
|
|
|
|
List<Map<String,Object>> recordDOS = new ArrayList<>();
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
|
map.put("id","1");
|
|
|
|
map.put("deptName","骨科一病区");//科室名称
|
|
|
|
map.put("hospitalNum","1");//住院次数
|
|
|
|
map.put("outpatientTime","2023-12-27 08:58:00");//出院时间
|
|
|
|
recordDOS.add(map);
|
|
|
|
return PageEnvelop.getSuccessListWithPage(CommonContant.Message.GET_SUCCESS,recordDOS,page,size,1L);
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
return PageEnvelop.getError(CommonContant.Message.GET_ERROR);
|
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "page")
|
|
@GetMapping(value = "page")
|
|
@ApiOperation(value = "获取病例分页")
|
|
@ApiOperation(value = "获取病例分页")
|