liubing 3 years ago
parent
commit
bb6782e056

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

@ -4,6 +4,7 @@ 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;
@ -47,6 +48,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private BaseOrgService orgService;
    @Autowired
    private ServicePackageService servicePackageService;
    @Autowired
    private PatientNoLoginService patientNoLoginService;
    /**
     * 获取微信openid
@ -111,7 +114,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @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 = true) String patient
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient",required = false) String patient
    ) {
        try {
            JSONObject json = courseService.getOrgInfoById(id,patient);
@ -155,14 +158,14 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = "findSignOrg")
    @ApiOperation(value = "查找签约机构")
    public ListEnvelop findSignOrg (
            @ApiParam(name = "patient", value = "医生code", required = true)
            @RequestParam(value = "patient",required = true) String patient,
            @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("查询成功",servicePackageService.findSignOrg(patient,name,type));
            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;
    }
}