|
@ -0,0 +1,101 @@
|
|
|
package com.yihu.jw.hospital.endpoint.consult;
|
|
|
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalConsultPriceDO;
|
|
|
import com.yihu.jw.hospital.service.consult.ConsultPriceService;
|
|
|
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalConsultPriceVO;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created by Trick on 2019/5/16.
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("internet/consult/price" )
|
|
|
@Api(tags = "医院咨询计费价目表", description = "互联网医院")
|
|
|
public class ConsultPriceEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
|
private ConsultPriceService consultPriceService;
|
|
|
|
|
|
/**
|
|
|
* 新增咨询计费信息
|
|
|
* @param jsonData
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@PostMapping(value = "/create", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@ApiOperation(value = "新增咨询计费信息", notes = "新增咨询计费信息")
|
|
|
public Envelop createConsultPrice(
|
|
|
@ApiParam(name = "json_data", value = "Json数据", required = true)
|
|
|
@RequestBody String jsonData) throws Exception {
|
|
|
|
|
|
int flag = -1;
|
|
|
WlyyHospitalConsultPriceDO wlyyHospitalConsultPriceDO = new WlyyHospitalConsultPriceDO();
|
|
|
Map dataDetail = JSONObject.fromObject(jsonData);
|
|
|
String hospital = dataDetail.get("hospital").toString();
|
|
|
// 获取到职称及服务对象列表,拆分成json数组,再进行处理
|
|
|
String data = dataDetail.get("data") == "" ? "": dataDetail.get("data") .toString();
|
|
|
JSONArray array = JSONArray.fromObject(data);
|
|
|
if (array.size() > 0) {
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
wlyyHospitalConsultPriceDO = consultPriceService.saveConsultPrice(jsonObject,hospital);
|
|
|
if(wlyyHospitalConsultPriceDO != null){
|
|
|
flag = 0;
|
|
|
}else{
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(flag == 0){
|
|
|
return success("新增咨费成功!");
|
|
|
}else{
|
|
|
return failed("新增咨费失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/search")
|
|
|
@ApiOperation(value = "获取分页")
|
|
|
public PageEnvelop<WlyyHospitalConsultPriceVO> page(
|
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
|
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
|
@RequestParam(value = "filters", required = false) String filters,
|
|
|
@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
|
|
|
@RequestParam(value = "sorts", required = false) String sorts,
|
|
|
@ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
@RequestParam(value = "page") int page,
|
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
@RequestParam(value = "size") int size) throws Exception {
|
|
|
|
|
|
List<WlyyHospitalConsultPriceDO> wlyyHospitalConsultPriceDOS = consultPriceService.search(fields, filters, sorts, page, size);
|
|
|
int count = (int) consultPriceService.getCount(filters);
|
|
|
return success(wlyyHospitalConsultPriceDOS, count, page, size, WlyyHospitalConsultPriceVO.class);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/delete", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@ApiOperation(value = "删除指定ID的咨费记录", notes = "新增咨询计费信息")
|
|
|
public Envelop deleteConsultPrice(
|
|
|
@ApiParam(name = "id", value = "唯一标识ID")
|
|
|
@RequestParam(value = "id", required = false) String id) {
|
|
|
|
|
|
consultPriceService.deleteConsultPrice(id);
|
|
|
return success("删除成功!");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|