Преглед изворни кода

监管平台数据上报服务

hill9868 пре 5 година
родитељ
комит
4834acae31

+ 226 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/internet/InternetController.java

@ -0,0 +1,226 @@
package com.yihu.jw.hospital.endpoint.internet;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.internet.service.InternetService;
import com.yihu.jw.org.service.BaseOrgInfoService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping(value ="/internetUp")
@Api(value = "监管平台数据上传", description = "监管平台数据上传", tags = {"监管平台数据上传"})
public class InternetController extends EnvelopRestEndpoint {
    private Logger logger = LoggerFactory.getLogger(InternetController.class);
    @Autowired
    private InternetService internetService;
    @Autowired
    private BaseOrgInfoService baseOrgInfoService;
    @PostMapping(value = "/upNsUserToken")
    @ApiOperation(value = "2.1 获取监管平台token数据")
    public ObjEnvelop upNsUserToken() {
        ObjEnvelop env = new ObjEnvelop();
        Map map = new HashMap();
        try {
            String token =  internetService.upNsUserToken();
            if("".equals(token)){
                return ObjEnvelop.getError("用户更新失败! ");
            }else{
                return ObjEnvelop.getSuccess("用户更新成功!",token);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("用户更新失败! " + e.getMessage());
        }
    }
    @PostMapping(value = "/upNsOrganBas")
    @ApiOperation(value = "2.2 医院基本信息")
    public ObjEnvelop upNsOrganBas(
            @ApiParam(name = "orgCode", value = "机构编码 350211A1002", required = true)
            @RequestParam(value = "orgCode") String orgCode)throws Exception {
        ObjEnvelop env = new ObjEnvelop();
        Map map = new HashMap();
        try {
            BaseOrgDO baseOrgDO = baseOrgInfoService.getBaseOrgByCode(orgCode);
            String res =  internetService.upNsOrganBas(baseOrgDO);
            JSONObject resJson = (JSONObject) JSONObject.parse(res);
            if("200".equals(resJson.get("msg").toString())) {
                return ObjEnvelop.getSuccess("医院信息更新成功!",res);
            }else {
                return ObjEnvelop.getError(resJson.get("reqContent").toString());
            }
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("医院信息更新失败! " + e.getMessage());
        }
    }
    @PostMapping(value = "/upNsDoctorRecord")
    @ApiOperation(value = "2.3 医生信息上传")
    public Envelop upNsDoctorRecord(
            @ApiParam(name = "startDate", value = "上报起始日期", required = false)
            @RequestParam(value = "startDate") String startDate,
            @ApiParam(name = "endDate", value = "上报结束日期", required = false)
            @RequestParam(value = "endDate") String endDate) {
        Envelop env = new Envelop();
        Map map = new HashMap();
        String res = "";
        try {
            res =  internetService.upNsDoctorRecord(startDate,endDate);
            return ObjEnvelop.getSuccess(res);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("医生信息更新失败! " + e.getMessage());
        }
    }
    @PostMapping(value = "/achNsDoctorRecord")
    @ApiOperation(value = "2.4 获取监管平台医师唯一标识 micc.achNsDoctorRecord")
    public Envelop achNsDoctorRecord(
            @ApiParam(name = "idCard", value = "医生身份证号", required = true)
            @RequestParam(value = "idCard") String idCard) {
        Envelop env = new Envelop();
        Map map = new HashMap();
        String res = "";
        try {
            res =  internetService.achNsDoctorRecord(idCard);
            JSONObject resJson = (JSONObject) JSONObject.parse(res);
            if("200".equals(resJson.get("msg").toString())){
                return ObjEnvelop.getSuccess("获取成功! ",resJson);
            }else{
                return ObjEnvelop.getError("获取失败! ");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("获取失败! " + e.getMessage());
        }
    }
    @PostMapping(value = "/upAppointmentOnline")
    @ApiOperation(value = "2.5 网上预约挂号")
    public Envelop upAppointmentOnline(
            @ApiParam(name = "startDate", value = "上报起始日期", required = false)
            @RequestParam(value = "startDate") String startDate,
            @ApiParam(name = "endDate", value = "上报结束日期", required = false)
            @RequestParam(value = "endDate") String endDate){
        Envelop env = new Envelop();
        Map map = new HashMap();
        String res = "";
        try {
            res = internetService.upAppointmentOnline(startDate,endDate);
            return  ObjEnvelop.getSuccess("预约挂号信息上传状况如下: " + res );
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("网上预约挂号上传失败! " + e.getMessage());
        }
    }
    @PostMapping(value = "/upNsDoctorScore")
    @ApiOperation(value = "2.7. 医生评价信息")
    public String upNsDoctorScore(
            @ApiParam(name = "startDate", value = "上报起始日期", required = false)
            @RequestParam(value = "startDate") String startDate,
            @ApiParam(name = "endDate", value = "上报结束日期", required = false)
            @RequestParam(value = "endDate") String endDate) throws  Exception{
        Envelop env = new Envelop();
        Map map = new HashMap();
        String res = "";
        try {
            // 获取机构内评价列表信息
            res = internetService.upNsDoctorScore(startDate,endDate);
            return  res;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    @PostMapping(value = "/upNsOnlineAsk")
    @ApiOperation(value = "2.8 网络咨询服务信息 micc.upNsOnlineAsk")
    public ObjEnvelop upNsOnlineAsk(
            @ApiParam(name = "startDate", value = "上报起始日期", required = false)
            @RequestParam(value = "startDate") String startDate,
            @ApiParam(name = "endDate", value = "上报结束日期", required = false)
            @RequestParam(value = "endDate") String endDate)throws Exception {
        ObjEnvelop env = new ObjEnvelop();
        Map map = new HashMap();
        try {
            String res =  internetService.upNsOnlineAsk(startDate,endDate);
            if(res != null) {
                return ObjEnvelop.getSuccess("网络咨询服务上报成功!",res);
            }else{
                return ObjEnvelop.getError("网络咨询服务上报失败! ");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("网络咨询服务上报失败! " + e.getMessage());
        }
    }
    @PostMapping(value = "/upPrescription")
    @ApiOperation(value = "10 电子处方表 micc.upPrescription")
    public ObjEnvelop upPrescription(
            @ApiParam(name = "startDate", value = "上报起始日期", required = false)
            @RequestParam(value = "startDate") String startDate,
            @ApiParam(name = "endDate", value = "上报结束日期", required = false)
            @RequestParam(value = "endDate") String endDate)throws Exception {
        ObjEnvelop env = new ObjEnvelop();
        Map map = new HashMap();
        try {
            String res =  internetService.upPrescription(startDate,endDate);
            if(res != null) {
                return ObjEnvelop.getSuccess("电子处方更新成功!",res);
            }else{
                return ObjEnvelop.getError("电子处方更新失败! ");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("电子处方更新失败! " + e.getMessage());
        }
    }
    @PostMapping(value = "/upPrescriptionDrug")
    @ApiOperation(value = "2.11. 电子处方_药品明细表")
    public ObjEnvelop upPrescriptionDrug(
            @ApiParam(name = "startDate", value = "上报起始日期", required = false)
            @RequestParam(value = "startDate") String startDate,
            @ApiParam(name = "endDate", value = "上报结束日期", required = false)
            @RequestParam(value = "endDate") String endDate)throws Exception {
        ObjEnvelop env = new ObjEnvelop();
        Map map = new HashMap();
        try {
            String res =  internetService.upPrescriptionDrug(startDate,endDate);
            if(res != null) {
                return ObjEnvelop.getSuccess("电子处方_药品明细表更新成功!",res);
            }else{
                return ObjEnvelop.getError("电子处方_药品明细表更新失败! ");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("电子处方_药品明细表更新失败! " + e.getMessage());
        }
    }
}