Quellcode durchsuchen

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

yeshijie vor 3 Jahren
Ursprung
Commit
b5d3c64a4e

+ 96 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/patient/PatientNoLoginEndPoint.java

@ -1,12 +1,21 @@
package com.yihu.jw.care.endpoint.third.patient;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.course.CourseService;
import com.yihu.jw.care.service.org.BaseOrgService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.service.third.patient.PatientNoLoginService;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.service.WechatInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.axis.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -33,6 +42,15 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private WechatInfoService wechatInfoService;
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @Autowired
    private CourseService courseService;
    @Autowired
    private BaseOrgService orgService;
    @Autowired
    private ServicePackageService servicePackageService;
    @Autowired
    private PatientNoLoginService patientNoLoginService;
    /**
     * 获取微信openid
     *
@ -75,4 +93,82 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            return  failedException(e);
        }
    }
    @GetMapping("getCourseByOrg")
    @ApiOperation(value = "在线报名-根据机构展示")
    public ObjEnvelop getCourseByOrg(
            @ApiParam(name = "longitude", value = "所在位置经度", defaultValue = "118.10388605") @RequestParam(value = "longitude", required = true) String longitude,
            @ApiParam(name = "latitude", value = "所在位置纬度", defaultValue = "24.48923061") @RequestParam(value = "latitude", required = true) String latitude
//            @ApiParam(name = "pageSize", value = "页面大小", defaultValue = "2") @RequestParam(value = "pageSize", required = true) int pageSize,
//            @ApiParam(name = "currentPage", value = "当前页面", defaultValue = "1") @RequestParam(value = "currentPage", required = true) int currentPage
    ) {
        try {
            JSONObject json = courseService.getCourseByOrg(longitude,latitude);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping("getOrgInfoById")
    @ApiOperation(value = "在线报名-获取机构详情")
    public ObjEnvelop getOrgInfoById(
            @ApiParam(name = "id", value = "机构id", defaultValue = "808080eb7861c327017861d18d070011") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient",required = false) String patient
    ) {
        try {
            JSONObject json = courseService.getOrgInfoById(id,patient);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping("getTecInfoById")
    @ApiOperation(value = "在线报名-获取教师详情(根据教师id)")
    public ObjEnvelop getTecInfoById(
            @ApiParam(name = "doctor", value = "教师id", defaultValue = "402803816babc778016babca89ea0032") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "orgCode", value = "机构code", defaultValue = "xm10086") @RequestParam(value = "orgCode", required = true) String orgCode,
            @ApiParam(name = "page", value = "page", defaultValue = "1") @RequestParam(value = "page", required = true) int page,
            @ApiParam(name = "size", value = "size", defaultValue = "10") @RequestParam(value = "size", required = true) int size
    ) {
        try {
            JSONObject json = courseService.getTecInfoById(doctor,orgCode,page,size);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @RequestMapping(value = "/findOrgList", method = RequestMethod.GET)
    @ApiOperation(value = "获取机构成员")
    public ListEnvelop findOrgList(@ApiParam(name = "type", value = "机构类型1. 等级医院2. 社区医院3.  养老机构")
                                   @RequestParam(value = "type", required = false) String type,
                                   @ApiParam(name = "name", value = "机构名称")
                                   @RequestParam(value = "name", required = false) String name,
                                   @ApiParam(name = "orgCode", value = "orgCode")
                                   @RequestParam(value = "orgCode", required = false) String orgCode) {
        try {
            return ListEnvelop.getSuccess("获取成功",orgService.findOrgList(type,name,orgCode));
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "findSignOrg")
    @ApiOperation(value = "查找签约机构")
    public ListEnvelop findSignOrg (
            @ApiParam(name = "patient", value = "医生code", required = false)
            @RequestParam(value = "patient",required = false) String patient,
            @ApiParam(name = "name", value = "机构名称", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "type", value = "类型 3 养老 4 教育,1 医疗", required = false)
            @RequestParam(value = "type",required = false) String type) throws Exception {
        try{
            return ListEnvelop.getSuccess("查询成功",patientNoLoginService.findSignOrg(patient,name,type));
        }catch (Exception e){
            return failedListEnvelopException(e);
        }
    }
}

+ 51 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/patient/PatientNoLoginService.java

@ -0,0 +1,51 @@
package com.yihu.jw.care.service.third.patient;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * Created by Bing on 2021/6/22.
 */
@Service
public class PatientNoLoginService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 查找签约机构
     * @param patient
     *  type 3 养老 4 教育,1 医疗
     * @return
     */
    public List<BaseOrgDO> findSignOrg(String patient, String name, String type){
        String sql = "SELECT " +
                " DISTINCT o.* " +
                "FROM " +
                " base_service_package_record r, " +
                " base_service_package_item i, " +
                " base_org o " +
                "WHERE " +
                " r.service_package_id = i.service_package_id " +
                "AND i.del = 1 " +
                "and i.org_code = o.code " ;
        if("1".equals(type)){
            sql += " and (o.type =1 or o.type = 2) ";
        }else if("3".equals(type)){
            sql += " and o.type =3 ";
        }
        if (StringUtils.isNotBlank(name)){
            sql += " and o.name like '%"+name+"%' ";
        }
        //type =4 新生儿
        List<BaseOrgDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseOrgDO.class));
        return list;
    }
}