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

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

# Conflicts:
#	common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java
wangzhinan пре 4 година
родитељ
комит
f2a1f6d0e2

+ 6 - 0
business/base-service/pom.xml

@ -53,6 +53,12 @@
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
        <!--易惠支付接口-->
        <dependency>
            <groupId>com.ylz</groupId>
            <artifactId>jdk7-onepay-java-sdk</artifactId>
            <version>20190425</version>
        </dependency>
        <!-- xlsx  依赖这个包 -->
        <dependency>
            <groupId>org.apache.poi</groupId>

+ 152 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -0,0 +1,152 @@
package com.yihu.jw.hospital.ykyy.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.http.HttpClientUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
 *
 * 眼科通接口
 *
 * Created by wangzhinan on 2020/4/11.
 */
@Service
public class YkyyService {
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private BasePatientDao patientDao;
    private static String yktUrl = "http://www.yanketong.com:133/api/";
    public String selectCards(String patient) throws Exception {
        String response = null;
        BasePatientDO basePatientDO  = patientDao.findById(patient);
        if (basePatientDO!=null){
            String userId = basePatientDO.getUserId();
            if (StringUtils.isNoneBlank(userId)){
               response = selectCardList(userId);
            }else {
               String response1 = getShortMessage("1",basePatientDO.getMobile());
                JSONObject jsonObject = JSONObject.parseObject(response1);
                if (jsonObject.getString("code").equalsIgnoreCase("10000")){
                    String code = jsonObject.getString("value");
                    String r =getRegisterUser(basePatientDO.getMobile(),"123456",code,"a01522","xmijk","xmijk");
                    JSONObject object = JSONObject.parseObject(r);
                    if (object.getString("code").equalsIgnoreCase("200")){
                        JSONObject object1 = object.getJSONObject("data");
                        if (object1!=null){
                            userId = object1.getString("ID");
                            basePatientDO.setUserId(userId);
                            patientDao.save(basePatientDO);
                            response = selectCardList(userId);
                        }
                    }else {
                        throw new Exception("用户注册失败");
                    }
                }else {
                    throw new Exception("获取验证码失败");
                }
            }
        }
        return response;
    }
    /**
     * 互联网-添加就诊卡
     * @param patient
     * @param card
     * @param userId
     * @param type
     * @return
     */
    public String addYkCard(String patient,String card,String userId,String type){
        String response = null;
        BasePatientDO patientDO = patientDao.findById(patient);
        String user_id=null;
        if (StringUtils.isNoneBlank(userId)){
            user_id=userId;
        }else {
            user_id=patientDO.getUserId();
        }
        response = addCard(user_id,patientDO.getName(),card,"7A585AB3-ED33-B40D-C3E3-A8BB0A1195D8","厦门大学附属厦门眼科中心思北院区",type,"1");
        return response;
    }
    /**
     * 眼科通验证码
     * @param type
     * @param phone
     * @return
     */
    public String getShortMessage(String type,String phone){
        String response="";
        String url = yktUrl+"verification_code/short_message?type="+type+"&telephone="+phone;
        response = httpClientUtil.get(url,"GBK");
        return response;
    }
    /**
     * telephone=15578008051&patient_pwd=123456&code=513970&invite_code=a01522&equipment_type=ios&equipment_guid=12312321
     * 眼科通用户注册
     *
     * @param telephone
     * @param patientPwd
     * @param code
     * @return
     */
    public String getRegisterUser(String telephone,String patientPwd,String code,String inviteCode,String equipmentType,String equipmentGuid){
        String response="";
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
                "&equipment_guid="+equipmentGuid;
        response = httpClientUtil.get(url,"GBK");
        return response;
    }
    /**
     * 获取就诊卡数据接口
     * @param userId
     * @return
     */
    public String selectCardList(String userId){
        String response="";
        Map<String,Object> param = new HashedMap();
        param.put("user_id",userId);
        String url = yktUrl+"patient/get_patient_card_list?user_id="+userId;
        response = httpClientUtil.get(url,"GBK");
        return response;
    }
    /**
     * user_id=1a6a0016-a788-3c84-82e0-f1283e891ccc&patient_name=wangzhinan&card=12345678901&hospital_id=7A585AB3-ED33-B40D-C3E3-A8BB0A1195D8&hospital_name=厦门大学附属厦门眼科中心思北院区&type=0&hos_num=1
     *
     * 添加就诊卡接口
     *
     *
     */
    public String addCard(String userId,String patientName,String card,String hospitalId,String hospitalName,String type,String hosNum){
        String response="";
        String url = yktUrl+"patient/add_card?user_id="+userId+"&patient_name="+patientName+"&card="+card+"&hospital_id="+hospitalId+
                "&hospital_name="+hospitalName+"&type="+type+"&hos_num="+hosNum;
        response = httpClientUtil.get(url,"GBK");
        return response;
    }
}

+ 38 - 0
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java

@ -298,4 +298,42 @@ public class HttpClientUtil {
        return null;
    }
    public  String get(String url, String chatSet,Map<String,Object> headerMap) {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            // 创建httpget.
            url= url.replaceAll(" ", "%20");
            HttpGet httpget = new HttpGet(url);
            for(String str:headerMap.keySet()){
                httpget.addHeader(str,headerMap.get(str).toString());
            }
            // 执行get请求.
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                // 获取响应实体
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
}

+ 0 - 124
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/service/YkyyService.java

@ -1,124 +0,0 @@
package com.yihu.jw.entrance.service;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.http.HTTPClient;
import com.yihu.jw.util.http.HTTPResponse;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailParseException;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
 *
 * 眼科通接口
 *
 * Created by wangzhinan on 2020/4/11.
 */
@Service
public class YkyyService {
    @Autowired
    private HTTPClient httpClient;
    @Autowired
    private BasePatientDao patientDao;
    private static String yktUrl = "http://www.yanketong.com:133/api/";
    /**
     * 眼科通验证码
     * @param type
     * @param phone
     * @return
     */
    public String getShortMessage(String type,String phone){
        String response="";
        Map<String,String> param = new HashedMap();
        param.put("type",type);
        param.put("telephone",phone);
        String url = yktUrl+"verification_code/short_message";
        HTTPResponse httpResponse = httpClient.get(url,param);
        if (httpResponse.getStatusCode()==200){
            response= httpResponse.getBody();
        }
        return response;
    }
    /**
     * telephone=15578008051&patient_pwd=123456&code=513970&invite_code=a01522&equipment_type=ios&equipment_guid=12312321
     * 眼科通用户注册
     *
     * @param telephone
     * @param patientPwd
     * @param code
     * @return
     */
    public String getRegisterUser(String telephone,String patientPwd,String code,String inviteCode,String equipmentType,String equipmentGuid){
        String response="";
        Map<String,String> param = new HashedMap();
        param.put("telephone",telephone);
        param.put("patient_pwd",patientPwd);
        param.put("code",code);
        param.put("invite_code",inviteCode);
        param.put("equipment_type",equipmentType);
        param.put("equipment_guid",equipmentGuid);
        String url = yktUrl+"user_center/patient_register01";
        HTTPResponse httpResponse = httpClient.get(url,param);
        if (httpResponse.getStatusCode()==200){
            response= httpResponse.getBody();
        }
        return response;
    }
    /**
     * 获取就诊卡数据接口
     * @param userId
     * @return
     */
    public String selectCardList(String userId){
        String response="";
        Map<String,String> param = new HashedMap();
        param.put("user_id",userId);
        String url = yktUrl+"patient/get_patient_card_list";
        HTTPResponse httpResponse = httpClient.get(url,param);
        if (httpResponse.getStatusCode()==200){
            response= httpResponse.getBody();
        }
        return response;
    }
    /**
     * user_id=1a6a0016-a788-3c84-82e0-f1283e891ccc&patient_name=wangzhinan&card=12345678901&hospital_id=7A585AB3-ED33-B40D-C3E3-A8BB0A1195D8&hospital_name=厦门大学附属厦门眼科中心思北院区&type=0&hos_num=1
     *
     * 添加就诊卡接口
     *
     *
     */
    public String addCard(String userId,String patientName,String card,String hospitalId,String hospitalName,String type,String hosNum){
        String response="";
        Map<String,String> param = new HashedMap();
        param.put("user_id",userId);
        param.put("patient_name",patientName);
        param.put("card",card);
        param.put("hospital_id",hospitalId);
        param.put("hospital_name",hospitalName);
        param.put("type",type);
        param.put("hos_num",hosNum);
        String url = yktUrl+"patient/add_card";
        HTTPResponse httpResponse = httpClient.get(url,param);
        if (httpResponse.getStatusCode()==200){
            response= httpResponse.getBody();
        }
        return response;
    }
}

+ 61 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java

@ -0,0 +1,61 @@
package com.yihu.jw.hospital.endpoint.ykyy;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.restmodel.web.ListEnvelop;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
 * Created by Trick on 2020/1/19.
 */
@RestController
@RequestMapping(value ="/ykyy")
@Api(value = "眼科医院", description = "眼科医院", tags = {"眼科医院"})
public class YkyyController extends EnvelopRestEndpoint {
    @Autowired
    private YkyyService ykyyService;
    @GetMapping(value = "/selectCardList")
    @ApiOperation(value = "查询就诊卡")
    public ObjEnvelop selectCardList(@ApiParam(name = "patient", value = "sql语句", required = true)
                                      @RequestParam(value = "patient",required = true)String patient){
        try {
            return ObjEnvelop.getSuccess("ok",ykyyService.selectCards(patient));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = "/addYkCard")
    @ApiOperation(value = "添加就诊卡")
    public ObjEnvelop addYkCard(@ApiParam(name = "patient", value = "sql语句", required = true)
                                     @RequestParam(value = "patient",required = true)String patient,
                                     @ApiParam(name = "card", value = "卡号", required = true)
                                     @RequestParam(value = "card",required = true)String card,
                                     @ApiParam(name = "type", value = "卡类型(0社保卡,1就诊卡)", required = true)
                                         @RequestParam(value = "type",required = true)String type,
                                    @ApiParam(name = "userId", value = "", required = false)
                                    @RequestParam(value = "userId",required = false)String userId){
        try {
            return ObjEnvelop.getSuccess("ok",ykyyService.addYkCard(patient,card,userId,type));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
}

+ 23 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityService.java

@ -214,6 +214,29 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
               taskPatientDetailDO.setStatus(1);
               taskPatientDetailDao.save(taskPatientDetailDO);
           }
       }else {
           List<TaskDO> taskDOS = taskDao.selectByActivityId(activityDO.getId());
           if (taskDOS!=null&&taskDOS.size()!=0){
               TaskDO taskDO = taskDOS.get(0);
               TaskPatientDetailDO taskPatientDetailDO = taskPatientDetailDao.selectByTaskIdAndPatientId(taskDO.getId(),patient);
               if (taskPatientDetailDO==null){
                   taskPatientDetailDO = new TaskPatientDetailDO();
                   taskPatientDetailDO.setSaasId("dev");
                   taskPatientDetailDO.setTaskId(taskDO.getId());
                   taskPatientDetailDO.setActivityId(activityDO.getId());
                   taskPatientDetailDO.setPatientIdcard(idcard);
                   taskPatientDetailDO.setPatientId(patient);
                   taskPatientDetailDO.setHospital(hospital);
                   taskPatientDetailDO.setHospitalName(hospitalName);
                   taskPatientDetailDO.setCreateTime(new Date());
                   taskPatientDetailDO.setUpdateTime(new Date());
                   taskPatientDetailDO.setTotal(0L);
                   taskPatientDetailDO.setCouponTotal(0L);
                   taskPatientDetailDO.setStatus(1);
                   taskPatientDetailDao.save(taskPatientDetailDO);
               }
           }
       }
       envelop.setObj(activityDO);
       return envelop;