小程序接口开发

master
gongzhenkun 2 years ago
parent 773421b462
commit 30e7d66dea

@ -2,19 +2,19 @@ package com.ruoyi.web.controller.api;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.system.domain.TDoctor;
import com.ruoyi.system.domain.THospital; import com.ruoyi.system.domain.THospital;
import com.ruoyi.system.domain.TPatientHospitalDoctor;
import com.ruoyi.system.domain.TRecord; import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.service.ITHospitalService; import com.ruoyi.system.service.*;
import com.ruoyi.system.service.ITRecordService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -32,6 +32,12 @@ public class AppController extends BaseController
@Autowired @Autowired
private ITHospitalService tHospitalService; private ITHospitalService tHospitalService;
@Resource
private ITDoctorService tDoctorService;
@Resource
private ITPatientHospitalDoctorService itPatientHospitalDoctorService;
/** /**
* AI * AI
@ -40,8 +46,8 @@ public class AppController extends BaseController
@GetMapping("/ai/finish") @GetMapping("/ai/finish")
public AjaxResult finish(Long id) public AjaxResult finish(Long id)
{ {
TRecord record= tRecordService.selectTRecordById(id); TRecord record = tRecordService.selectTRecordById(id);
if(record!=null) if (record != null)
{ {
record.setStatus("1"); record.setStatus("1");
} }
@ -54,4 +60,45 @@ public class AppController extends BaseController
List<THospital> tHospitals = tHospitalService.selectTHospitalList(new THospital()); List<THospital> tHospitals = tHospitalService.selectTHospitalList(new THospital());
return AjaxResult.success(tHospitals); return AjaxResult.success(tHospitals);
} }
/**
*
*
* @param doctorId id
* @return {@code AjaxResult}
*/
@ApiOperation("医生信息获取")
@GetMapping("/doctorInformation")
public AjaxResult doctorInformation(Long doctorId)
{
TDoctor tDoctor = tDoctorService.selectTDoctorById(doctorId);
return AjaxResult.success(tDoctor);
}
/**
*
*
* @param tPatientHospitalDoctor tPatientHospitalDoctor
* @return {@code AjaxResult}
*/
@ApiOperation("患者预约")
@GetMapping("/getDoctorInfo")
public AjaxResult patientsToMakeAnAppointment(TPatientHospitalDoctor tPatientHospitalDoctor)
{
// 患者预约新增t_record中的一条记录;判断关联表是否存在当前关系
TRecord tRecord = new TRecord();
tRecord.setHospitalId(tPatientHospitalDoctor.getHospitalId());
tRecord.setPatientId(tPatientHospitalDoctor.getPatientId());
tRecord.setDoctorId(tPatientHospitalDoctor.getDoctorId());
tRecord.setStatus("0");
tRecord.setCreateBy(getUsername());
tRecordService.insertTRecord(tRecord);
List<TPatientHospitalDoctor> tPHDs = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor);
if (tPHDs.isEmpty())
{
itPatientHospitalDoctorService.insertTPatientHospitalDoctor(tPatientHospitalDoctor);
}
return AjaxResult.success();
}
} }

Loading…
Cancel
Save