Browse Source

代码修改

LAPTOP-KB9HII50\70708 1 year ago
parent
commit
c5815ff0a9

+ 268 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/archives/MedicalRecordCopyingEndpoint.java

@ -1,13 +1,20 @@
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.entity.base.patient.BaseIdcardRecordDO;
import com.yihu.jw.entity.base.patient.BaseMedicalRecordCopyingApplyDO;
import com.yihu.jw.entity.hospital.record.HospitalPatientInpatientRecordDO;
import com.yihu.jw.hospital.record.service.HospitalPatientInpatientRecordService;
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.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.entity.ServiceException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
 * Created by yeshijie on 2022/11/28.
@ -30,6 +36,266 @@ public class MedicalRecordCopyingEndpoint extends EnvelopRestEndpoint {
    private HospitalPatientInpatientRecordService inpatientRecordService;
    @Autowired
    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")
    @ApiOperation(value = "获取病例分页")

+ 92 - 9
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/expressage/ExpressageEndpoint.java

@ -2,7 +2,6 @@ package com.yihu.jw.hospital.endpoint.expressage;
import com.yihu.jw.entity.hospital.prescription.WlyyExpressagePriceDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionExpressageService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -20,7 +19,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.net.URLDecoder;
import java.util.List;
@RestController
@ -48,7 +46,6 @@ public class ExpressageEndpoint extends EnvelopRestEndpoint {
            //返回接口异常信息处理结果
            return failed( "查询失败,"+e.getMessage());
        }
    }
@ -183,14 +180,100 @@ public class ExpressageEndpoint extends EnvelopRestEndpoint {
    }
    @RequestMapping(value="/test",method = RequestMethod.GET)
    @ApiOperation("test")
    public Envelop test(String test){
    /****************************common****************************************/
    @RequestMapping(value="/sfrouteserviceSearchCommon",method = RequestMethod.GET)
    @ApiOperation("通过关联编号查询顺丰物流派送记录")
    public Envelop SFRouteServiceSearchCommon(@ApiParam(name="relationType", value="关联类型 类型1 病案复印(关联病案复印申请id)")
                                              @RequestParam(value = "relationType",required = true) String relationType,
                                              @ApiParam(name="relationCode", value="关联id")
                                              @RequestParam(value = "relationCode",required = true) String relationCode){
        try {
            List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByRelationCode(relationCode,relationType);
            if(CollectionUtils.isEmpty(expressageDOList)){
                return failed("没有物流信息!");
            }
            WlyyPrescriptionExpressageDO sfexpress_obj = expressageDOList.get(0);
            String result  = sfexpressService.getRoutInfosSearch(sfexpress_obj);
            return success(result);
        }catch (Exception e){
            //返回接口异常信息处理结果
            return failed( "查询失败,"+e.getMessage());
        }
    }
    @RequestMapping(value="/sforderserviceCommon",method = RequestMethod.POST)
    @ApiOperation("向顺丰快递下订单")
    public Envelop SFOrderServiceCommon(@ApiParam(name="relationType", value="关联类型 类型1 病案复印(关联病案复印申请id)")
                                            @RequestParam(value = "relationType",required = true) String relationType,
                                        @ApiParam(name="relationCode", value="关联id")
                                            @RequestParam(value = "relationCode",required = true) String relationCode){
        try {
//            sfexpressService.test();
            return success("ok");
            List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByRelationCode(relationCode,relationType);
            if(CollectionUtils.isEmpty(expressageDOList)){
                return failed("顺丰快递下单失败,未找到派送地址!");
            }else{
                WlyyPrescriptionExpressageDO sfexpress_obj = expressageDOList.get(0);
                //如果该处方的快递单号已生成,则说明已经下单成功,不需要重复下单,直接返回成功
                if(StringUtils.isNotBlank(sfexpress_obj.getMailno())){
                    return success("顺丰快递下单成功!");
                }else{
                    //如果该处方的快递单号未生成,则继续下单
                    //根据业务订单号判断是否已经下单成功
                    boolean go_on = sfexpressService.sfOrderSearchService(sfexpress_obj);
                    //如果该业务订单号未下单成功过,则重新下单
                    if(go_on){
                        //请求顺丰接口下单,成功下单后,返回快递单号
                        sfexpress_obj = sfexpressService.postSFOrderServiceCommon(sfexpress_obj);
                        //保存快递单号和增加处方物流记录为配送
                        sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
                    }
                    return success(sfexpress_obj);
                }
            }
        }catch (Exception e){
            //返回接口异常信息处理结果
            return failed(e.getMessage());
        }
    }
    @RequestMapping(value="/sfgetorderinfoserviceCommon",method = RequestMethod.GET)
    @ApiOperation("通过编号查询顺丰快递单信息(不包含物流记录)")
    public Envelop SFGetOrderInfoCommon(@ApiParam(name="relationType", value="关联类型 类型1 病案复印(关联病案复印申请id)")
                                            @RequestParam(value = "relationType",required = true) String relationType,
                                        @ApiParam(name="relationCode", value="关联id")
                                            @RequestParam(value = "relationCode",required = true) String relationCode){
        try {
            List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByRelationCode(relationCode,relationType);
            if(CollectionUtils.isEmpty(expressageDOList)){
                return failed( "不存在快递信息");
            }
            WlyyPrescriptionExpressageDO sfexpress_obj = expressageDOList.get(0);
            return success(sfexpress_obj);
        }catch (Exception e) {
            return failed("异常," + e.getMessage());
            return failed("查询失败," + e.getMessage());
        }
    }
    @RequestMapping(value="/sfordersearchserviceCommon",method = RequestMethod.GET)
    @ApiOperation("通过编号查询顺丰快递是否下单成功")
    public Envelop SFOrderSearchServiceCommon(@ApiParam(name="relationType", value="关联类型 类型1 病案复印(关联病案复印申请id)")
                                                  @RequestParam(value = "relationType",required = true) String relationType,
                                              @ApiParam(name="relationCode", value="关联id")
                                                  @RequestParam(value = "relationCode",required = true) String relationCode){
        List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByRelationCode(relationCode,relationType);
        if(CollectionUtils.isEmpty(expressageDOList)){
            return failed( "没有顺丰快递信息");
        }
        try {
            WlyyPrescriptionExpressageDO sfexpress_obj = expressageDOList.get(0);
            boolean go_on = sfexpressService.sfOrderSearchServiceJustSearch(sfexpress_obj);
            return success(go_on);
        }catch (Exception e) {
            return failed("查询失败," + e.getMessage());
        }
    }

+ 93 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/NatEndpoint.java

@ -0,0 +1,93 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.contant.CommonContant;
import com.yihu.jw.hospital.prescription.service.NatService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.entity.ServiceException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created by yeshijie on 2023/12/28.
 */
@RestController
@RequestMapping(value = "natItem")
@Api(value = "专项医技预约管理", description = "专项医技预约管理", tags = {"专项医技预约管理"})
public class NatEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private NatService natService;
    @PostMapping(value = "createOrUpd")
    @ApiOperation(value = "新增或修改医技预约项目")
    public ObjEnvelop createOrUpd (
            @ApiParam(name = "jsonData", value = "json格式")
            @RequestParam(value = "jsonData", required = true) String jsonData) {
        try {
            return ObjEnvelop.getSuccess(CommonContant.Message.SAVE_SUCCESS,natService.createOrUpd(jsonData));
        }catch (ServiceException se){
            return ObjEnvelop.getError(se.getMessage());
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError(CommonContant.Message.SAVE_ERROR);
    }
    @GetMapping(value = "findDetailById")
    @ApiOperation(value = "获取医技预约项目详情")
    public ObjEnvelop findDetailById (
            @ApiParam(name = "id", value = "id")
            @RequestParam(value = "id", required = true) String id) {
        try {
            return ObjEnvelop.getSuccess("获取成功",natService.findDetailById(id));
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError(CommonContant.Message.GET_ERROR);
    }
    @PostMapping(value = "updStatus")
    @ApiOperation(value = "修改状态")
    public ObjEnvelop updStatus (
            @ApiParam(name = "id", value = "id")
            @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = true) String status) {
        try {
            return ObjEnvelop.getSuccess(CommonContant.Message.SAVE_SUCCESS,natService.updStatus(id,status));
        }catch (ServiceException se){
            return ObjEnvelop.getError(se.getMessage());
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError(CommonContant.Message.SAVE_ERROR);
    }
    @GetMapping(value = "natItemPage")
    @ApiOperation(value = "医技预约项目分页")
    public PageEnvelop natItemPage (
            @ApiParam(name = "name", value = "项目名称")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = false) String status,
            @ApiParam(name = "suitableCrowd", value = "适用人群")
            @RequestParam(value = "suitableCrowd", required = false) String suitableCrowd,
            @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 natService.natItemPage(name,status,suitableCrowd, page, size);
        }catch (Exception e){
            e.printStackTrace();
        }
        return PageEnvelop.getError(CommonContant.Message.GET_ERROR);
    }
}