Jelajahi Sumber

Merge branch 'dev' of yeshijie/patient-co-management into dev

yeshijie 7 tahun lalu
induk
melakukan
d74da18af1

+ 45 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/GuahaoController.java

@ -478,4 +478,49 @@ public class GuahaoController {
	/**
	 * =============================计免预约挂号相关接口======================================END
	 */
	@RequestMapping(value = "/imm/getToken",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取口令")
	public Result getToken()
	{
		try {
			String data = guahaoService.getToken();
			return Result.success("获取口令成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "/imm/ymjsAll",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取社区疫苗字典")
	public Result ymjsAll()
	{
		try {
			String data = guahaoService.ymjsAll();
			return Result.success("获取社区疫苗字典成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "/imm/findWzymBymykh",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取计划免疫接种记录")
	public Result findWzymBymykh()
	{
		try {
			String data = guahaoService.findWzymBymykh();
			return Result.success("获取计划免疫接种记录成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
}

+ 109 - 10
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/guahao/GuahaoService.java

@ -1,13 +1,10 @@
package com.yihu.wlyy.service.service.guahao;
import cn.com.zoe.crypto.jna.CryptoKey;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.common.http.HttpApiException;
import com.yihu.wlyy.service.common.util.DateUtil;
import com.yihu.wlyy.service.common.util.SOAPUtil;
import com.yihu.wlyy.service.common.util.StringUtil;
import com.yihu.wlyy.service.dao.*;
import com.yihu.wlyy.service.entity.Patient;
import com.yihu.wlyy.service.entity.PatientReservation;
@ -19,19 +16,14 @@ import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.hibernate.validator.internal.util.privilegedactions.GetResource;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.crypto.Cipher;
import java.io.*;
import java.security.PublicKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.security.KeyFactory;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.*;
@ -1467,4 +1459,111 @@ public class GuahaoService {
    
        return result;
    }
     /***************************************易联众计免接口**********************************************************/
    /**
     * 计免预约Post接口
     */
    private String ylzImmGetSecond(String apistr,String content, Map<String,String> params) throws Exception
    {
        String re = "";
        ZysoftApi api = ZysoftApi.getSingleton();
        //新增日志
        String method = "GET";
        Boolean isSuccess = true;
        String error = "";
        int times = 0;
        try {
            re = api.get(immUrl+"/"+apistr, params, null,false);
            //---结果验证,并保存日志 ---START
            if (StringUtils.isEmpty(re)) {
                // 请求失败
                //保存http日志
                logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,"接口返回的结果为空");
                throw new Exception("接口返回的结果为空");
            } else if (StringUtils.startsWith(re, "System-Error")) {
                // 调用失败
                //保存http日志
                error = re.substring(re.indexOf(":") + 1, re.length());
                logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
                throw new Exception(error);
            } else if (StringUtils.startsWith(re, "Error")) {
                // 调用失败
                //保存http日志
                error = re.substring(re.indexOf(":") + 1, re.length());
                logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
                throw new Exception(error);
            }
            //---结果验证,并保存日志 ---END
            //保存http日志
            logService.saveHttpLog(isSuccess,apistr,content,method,apistr, net.sf.json.JSONObject.fromObject(params).toString(),re,error);
        }
        catch (Exception ex)
        {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
            isSuccess = false;
            //保存http日志
            logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
            }
            else{
                throw new HttpApiException(-1,ex.getMessage());
            }
        }
        return re;
    }
    private String apiString = "Action";
    /**
     * 获取口令,4小时有效,465439011
     * @return
     */
    public String getToken() throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("act", "getToken");
        params.put("accId", "q9Bt3TE00KaigEW5EJVIMA==");
        return ylzImmGetSecond(apiString,"计免预约-获取口令",params);
    }
    /**
     * 获取社区疫苗字典
     * @return
     */
    public String ymjsAll() throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("act", "ymjsAll");
        params.put("accId", "q9Bt3TE00KaigEW5EJVIMA==");
        params.put("_token", "525870222");
        return ylzImmGetSecond(apiString,"计免预约-获取社区疫苗字典",params);
    }
    /**
     * 获取计划免疫接种记录
     * @return
     */
    public String findWzymBymykh() throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("act", "findWzymBymykh");
        params.put("accId", "q9Bt3TE00KaigEW5EJVIMA==");
        params.put("_token", "525870222");
        params.put("etmykh", "0052182708");
        return ylzImmGetSecond(apiString,"计免预约-获取计划免疫接种记录",params);
    }
}

+ 13 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheduling/DoctorWorkTimeService.java

@ -4,7 +4,6 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.schedule.DoctorFamousConsultTimesRemain;
import com.yihu.wlyy.entity.doctor.schedule.WlyyDoctorWorkTime;
import com.yihu.wlyy.entity.doctor.schedule.WlyyDoctorWorkWeek;
import com.yihu.wlyy.entity.message.MessageNoticeSetting;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorWorkTimeDao;
import com.yihu.wlyy.repository.doctor.DoctorWorkWeekDao;
@ -13,13 +12,11 @@ import com.yihu.wlyy.repository.message.MessageNoticeSettingDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.message.MessageService;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.eval.StringValueEval;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.print.Doc;
import javax.transaction.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
@ -69,11 +66,6 @@ public class DoctorWorkTimeService extends BaseService {
        if (doc == null) {
            throw new Exception("doctor not exist");
        }
        WlyyDoctorWorkTime workTime = doctorWorkTimeDao.findDoctorWorkTime(doctor);
        List<WlyyDoctorWorkWeek> workWeekList = doctorWorkWeekDao.findDoctorWorkWeeks(doctor);
        result.put("workTime", workTime != null ? new JSONObject(workTime) : "");
        result.put("workWeeks", workWeekList != null ? new JSONArray(workWeekList) : "");
        JSONObject docJson = new JSONObject(doc);
        if (docJson.has("password")) {
            docJson.remove("password");
@ -83,6 +75,17 @@ public class DoctorWorkTimeService extends BaseService {
        }
        result.put("doctor", doc != null ? docJson : "");
        WlyyDoctorWorkTime workTime = doctorWorkTimeDao.findDoctorWorkTime(doctor);
        if(workTime!=null&&"0".equals(workTime.getReceiveConsult())){
            result.put("workTime", "");
            result.put("workWeeks", "");
        }else{
            List<WlyyDoctorWorkWeek> workWeekList = doctorWorkWeekDao.findDoctorWorkWeeks(doctor);
            result.put("workTime", workTime != null ? new JSONObject(workTime) : "");
            result.put("workWeeks", workWeekList != null ? new JSONArray(workWeekList) : "");
        }
        return result;
    }
@ -775,12 +778,12 @@ public class DoctorWorkTimeService extends BaseService {
                    json.put("msg","全科医生和健管师当前都不在工作时间");
                }
                //健管师在工作时间,全科不在
                if ("2".equals(doctorStatus) && "1".equals(doctorHealthStatus)){
                if ("2".equals(doctorStatus) || "0".equals(doctorStatus)){
                    json.put("status","3");
                    json.put("msg","全科医生当前不在工作时间");
                }
                //全科在工作时间,健管师不在
                if ("1".equals(doctorStatus) && "2".equals(doctorHealthStatus)){
                if ("0".equals(doctorHealthStatus) || "2".equals(doctorHealthStatus)){
                    json.put("status","4");
                    json.put("msg","健管师当前不在工作时间");
                }