| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.common.annotation.Anonymous; |
| | | import com.ruoyi.common.core.domain.entity.ServiceOrderAppResultVo; |
| | | import com.ruoyi.common.core.domain.entity.ServiceOrderAppVo; |
| | | import com.ruoyi.common.utils.civilAviation.ServiceOrderUtil; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 新增orders |
| | | * 提供外部接口可以调用 |
| | | * @param tbOrders |
| | | * @return |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:orders:add')") |
| | | @Log(title = "orders", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody TbOrders tbOrders) |
| | | { |
| | | return toAjax(tbOrdersService.insertTbOrders(tbOrders)); |
| | | // @Anonymous(needSign = true) |
| | | @Anonymous |
| | | // @Log(title = "orders", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody TbOrders tbOrders) { |
| | | try { |
| | | if (tbOrders == null || tbOrders.getOrderID() == null) { |
| | | return AjaxResult.error("传输数据为空!"); |
| | | } |
| | | |
| | | tbOrders.setCreateTime(new Date()); |
| | | |
| | | int insertNum = tbOrdersService.insertTbOrders(tbOrders); |
| | | if(insertNum<1) |
| | | { |
| | | return AjaxResult.error("上传失败!"); |
| | | } |
| | | |
| | | ServiceOrderAppVo model = new ServiceOrderAppVo(); |
| | | model.setMethod("ServiceOrder_APP"); // 设置接口名称 |
| | | model.setAppId("GDS-000001"); // 设置商户 APPID |
| | | model.setOrdType(tbOrders.getTypeCode().intValue()); |
| | | model.setCoPhone(tbOrders.getLinkTel()); // 客户联系电话 |
| | | model.setCoName(tbOrders.getLinkPerson()); // 客户姓名 |
| | | // model.setCoTies("家属"); // 随机设置客户联系人与患者关系 |
| | | // 设置预约时间为一天后 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd%20HH:mm"); |
| | | model.setApptDate(sdf.format(tbOrders.getBookingDate())); // 格式化预约运送时间 |
| | | |
| | | model.setPtName(tbOrders.getPatientName()); // 患者姓名 |
| | | model.setPtAge(tbOrders.getAge()); // 随机生成患者年龄 |
| | | model.setPtSex(tbOrders.getSex() == 1 ? "男" : "女"); // 随机生成患者性别 |
| | | // model.setPtNat("中国"); // 设置患者国籍 |
| | | model.setOutHosp(tbOrders.getLocalAddress()); // 设置转出医院 |
| | | model.setInHosp(tbOrders.getSendAddress()); // 设置转入医院 |
| | | // model.setPtServices("科室" + (int) (Math.random() * 10)); // 随机设置患者所在科室 |
| | | model.setPtDiagnosis(tbOrders.getComplaint()); // 设置诊断信息 |
| | | model.setCondition(tbOrders.getRemark()); // 设置备注信息 |
| | | // model.setDoctor("医生" + (int) (Math.random() * 10)); // 随机设置患者医生 |
| | | // model.setDoctorPhone("13" + (int) (Math.random() * 900000000 + 100000000)); // 随机生成患者医生电话 |
| | | model.setOfferPrice(tbOrders.getBookingPrice().doubleValue()); // 随机生成报价 |
| | | // model.setReferrals("推介人" + (int) (Math.random() * 10)); // 随机设置推介人信息 |
| | | // model.setUnitRemarks("商户随机备注信息"); // 随机设置商户备注 |
| | | // model.setPayQRcodeURL("https://example.com/qrcode/" + (int) (Math.random() * 100)); // 随机生成外部支付二维码链接 |
| | | |
| | | ServiceOrderAppResultVo result = ServiceOrderUtil.CreateServiceOrder(model); |
| | | |
| | | if (result.getResult() == 1) { |
| | | return AjaxResult.success(result); |
| | | } else { |
| | | return AjaxResult.error("提交失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("提交失败"); |
| | | } |
| | | } |
| | | |
| | | /** |