| | |
| | | //最大人数 |
| | | int maxPeople = MapUtils.getIntValue(map, "maxPeople"); |
| | | //预约时间 |
| | | String appointmments = JSONArray.toJSONString(map.get("appointments")); |
| | | List<AppointmentTime> appointmments = JSONArray.parseArray(JSONArray.toJSONString(map.get("appointments")), AppointmentTime.class); |
| | | |
| | | AdvisoryDoctorInfo advisoryDoctorInfo = baseMapper.selectById(Long.parseLong(id)); |
| | | if (advisoryDoctorInfo == null) { |
| | | return ResultBody.failed().msg("查询医生信息失败"); |
| | | } |
| | | |
| | | AdvisoryDoctorInfo adi = new AdvisoryDoctorInfo(); |
| | | adi.setId(Long.parseLong(id)); |
| | | adi.setPrice(price); |
| | | adi.setMaxPeople(maxPeople); |
| | | advisoryDoctorInfo.setPrice(price); |
| | | advisoryDoctorInfo.setMaxPeople(maxPeople); |
| | | |
| | | int b = baseMapper.updateById(adi); |
| | | int b = baseMapper.updateById(advisoryDoctorInfo); |
| | | if (b == 0) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return ResultBody.failed().msg("操作失败"); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(appointmments)) { |
| | | if (appointmments != null && appointmments.size() > 0) { |
| | | appointmentTimeService.delByAdvisoryId(Long.parseLong(id)); |
| | | List<AppointmentTime> times = JSONArray.parseArray(appointmments, AppointmentTime.class); |
| | | for (AppointmentTime time : times) { |
| | | for (AppointmentTime time : appointmments) { |
| | | time.setAdvisoryId(Long.parseLong(id)); |
| | | appointmentTimeService.saveOrUpdate(time); |
| | | } |
| | | |
| | | } |
| | | |
| | | return ResultBody.ok().msg("操作成功"); |
| | |
| | | JSONArray array = new JSONArray(); |
| | | JSONObject obj = null; |
| | | for (AppointmentTime app : byAdvisoryId) { |
| | | obj = new JSONObject(); |
| | | obj.put("name", app.getName()); |
| | | obj.put("afternoon", app.getAfternoon()); |
| | | obj.put("evening", app.getEvening()); |
| | | obj.put("morning", app.getMorning()); |
| | | boolean flag = true; |
| | | for (int i = 0; i < array.size(); i++) { |
| | | JSONObject jsonObject = array.getJSONObject(i); |
| | | if (jsonObject.getString("name").equals(app.getName())) { |
| | | if (app.getAfternoon() == 1) { |
| | | jsonObject.put("afternoon", 1); |
| | | } else if (app.getEvening() == 1) { |
| | | jsonObject.put("evening", 1); |
| | | } else if (app.getMorning() == 1) { |
| | | jsonObject.put("morning", 1); |
| | | } |
| | | flag = false; |
| | | array.add(jsonObject); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | array.add(obj); |
| | | if (flag) { |
| | | obj = new JSONObject(); |
| | | obj.put("name", app.getName()); |
| | | obj.put("afternoon", app.getAfternoon()); |
| | | obj.put("evening", app.getEvening()); |
| | | obj.put("morning", app.getMorning()); |
| | | array.add(obj); |
| | | } |
| | | } |
| | | json.put("appointments", array); |
| | | } |
| | |
| | | json.put("specialty", adi.getSpecialty()); |
| | | json.put("service", adi.getService()); |
| | | json.put("id", String.valueOf(adi.getId())); |
| | | String distance = getDistance(Double.parseDouble(adi.getLatitude()), Double.parseDouble(adi.getLongitude()), lat, lon); |
| | | double lat1 = StringUtils.isNotBlank(adi.getLatitude()) ? Double.parseDouble(adi.getLatitude()) : 0d; |
| | | double lon1 = StringUtils.isNotBlank(adi.getLongitude()) ? Double.parseDouble(adi.getLongitude()) : 0d; |
| | | String distance = getDistance(lat1, lon1, lat, lon); |
| | | json.put("distance", distance); |
| | | |
| | | ResultBody byId1 = doctorService.findById(adi.getDoctorId()); |