Browse Source

集成地址

wangzhinan 10 months ago
parent
commit
85a625903d

+ 45 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -29,6 +29,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientAddressInfoDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.servicePackage.ServiceItemPlanDO;
@ -84,6 +85,7 @@ import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BasePatientAddressInfoDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.rehabilitation.ServiceItemPlanDao;
@ -363,6 +365,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private OutpatientHospitalizationDao outpatientHospitalizationDao;
    @Autowired
    private HealthCareNewService healthCareNewService;
    @Autowired
    private BasePatientAddressInfoDao addressInfoDao;
    //已就诊医生列表
    public PageEnvelop visitedDoctorPage(String patientId,String startTime,String endTime,Integer page,Integer size){
@ -15835,4 +15839,45 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    /**
     * 地址转坐标及详细信息
     * @param id
     * @return
     */
    public List<BasePatientAddressInfoDO> getAddressToStreet(Integer id){
        List<BasePatientAddressInfoDO> addressInfoDOS = new ArrayList<>();
        if (id!=null){
            BasePatientAddressInfoDO addressInfoDO = addressInfoDao.findById(id).get();
            addressInfoDOS.add(addressInfoDO);
        }else {
            addressInfoDOS = addressInfoDao.findAll();
        }
        for (BasePatientAddressInfoDO addressInfoDO:addressInfoDOS){
            String url = "https://restapi.amap.com/v3/geocode/geo?city=厦门市&address="+addressInfoDO.getAddress()+"&output=JSON&key=60a518937bd4cc128a5e15c1613e5d56";
            String rest = httpClientUtil.get(url,"utf-8");
            if (!org.springframework.util.StringUtils.isEmpty(rest)){
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(rest);
                if (object.getString("infocode").equals("10000")){
                    com.alibaba.fastjson.JSONObject jsonObject = object.getJSONArray("geocodes").getJSONObject(0);
                    //通过经纬度获取具体详情地址
                    String res = httpClientUtil.get("https://restapi.amap.com/v3/geocode/regeo?output=JSON&location="+jsonObject.getString("location")+"&key=60a518937bd4cc128a5e15c1613e5d56&radius=0&extensions=all","utf-8");
                    if (StringUtils.isNoneBlank(res)){
                        com.alibaba.fastjson.JSONObject jsonObject1 = com.alibaba.fastjson.JSONObject.parseObject(res);
                        if (jsonObject1.getString("infocode").equals("10000")){
                            com.alibaba.fastjson.JSONObject resjson = jsonObject1.getJSONObject("regeocode").getJSONObject("addressComponent");
                            String street = resjson.getString("township");
                            String town = resjson.getString("district");
                            addressInfoDO.setTown(town);
                            addressInfoDO.setStreet(street);
                            addressInfoDao.save(addressInfoDO);
                        }
                    }
                }
            }
        }
        return addressInfoDOS;
    }
}

+ 19 - 0
business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientAddressInfoDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.base.patient.BasePatientAddressInfoDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2018/8/31.
 */
public interface BasePatientAddressInfoDao extends JpaRepository<BasePatientAddressInfoDO, Integer>, JpaSpecificationExecutor<BasePatientAddressInfoDO> {
}

+ 60 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientAddressInfoDO.java

@ -0,0 +1,60 @@
package com.yihu.jw.entity.base.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * 居民地址转换
 *
 * @author Administrator on  2018年09月05日
 */
@Entity
@Table(name = "patient_address_info")
public class BasePatientAddressInfoDO extends IntegerIdentityEntity {
    private String name;
    private String address;
    private String town;
    private String street;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getStreet() {
        return street;
    }
    public void setStreet(String street) {
        this.street = street;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
}

+ 13 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -3903,5 +3903,18 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping("/getAddressToStreet")
    @ApiOperation(value = "地址转坐标及详细信息", notes = "地址转坐标及详细信息")
    public Envelop selectHospitalizationByOutpatientId(
            @ApiParam(name = "id", value = "唯一id", required = false)
            @RequestParam(value = "id",required = false)Integer id) {
        try {
            return success("操作成功", prescriptionService.getAddressToStreet(id));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
}