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

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev-1.3.7

trick9191 пре 7 година
родитељ
комит
0359ea5ef5

+ 2 - 2
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/SignController.java

@ -105,9 +105,9 @@ public class SignController {
    @RequestMapping(value = "getSickMedicalSimpleListInfo",method = RequestMethod.POST)
    @ApiOperation("查询老年人体检记录接口")
    public Result getSickMedicalSimpleListInfo (
            @ApiParam(name="TIME_START",value="修改的开始时间",defaultValue = "2017-6-6 00:00:00")
            @ApiParam(name="TIME_START",value="修改的开始时间",defaultValue = "2012-2-6 00:00:00")
            @RequestParam(value="TIME_START",required = false) String TIME_START,
            @ApiParam(name="TIME_END",value="修改的开始时间",defaultValue = "2017-6-7 23:59:59")
            @ApiParam(name="TIME_END",value="修改的开始时间",defaultValue = "2012-2-7 23:59:59")
            @RequestParam(value="TIME_END",required = false) String TIME_END){
        try {
            String response = signZYService.getSickMedicalSimpleListInfo(TIME_START,TIME_END);

+ 112 - 114
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -786,72 +786,71 @@ public class ConsultTeamService extends ConsultService {
     * @throws Exception
     */
    public int addTeamConsult(ConsultTeam ct, String patient,String agent) throws Exception {
        if (exist(patient, ct.getType())) {//判断是否有未结束的咨询移到同步方法中
            return -3;
        }
        synchronized (patient.intern()){//新增同步块,防止居民网络不好时多次点击,或者im服务器响应慢导致同时发起多个咨询
            if (exist(patient, ct.getType())) {//判断是否有未结束的咨询移到同步方法中
                return -3;
            }
        JSONObject users = new JSONObject();
            JSONObject users = new JSONObject();
        if(patient.equals(agent)){
            agent = null;
        }
            if(patient.equals(agent)){
                agent = null;
        // 咨询三师
        if (ct.getType() == 1) {
            // 查询三师签约信息
            SignFamily sc = signFamilyDao.findBySanshiPatientYes(patient);
            if (sc == null) {
                // 不存在三师签约
                return -2;
            }
            // 咨询三师
            if (ct.getType() == 1) {
                // 查询三师签约信息
                SignFamily sc = signFamilyDao.findBySanshiPatientYes(patient);
                if (sc == null) {
                    // 不存在三师签约
                    return -2;
                }
                ct.setTeam(sc.getTeamCode());
                // 设置健康管理师,三师咨询默认给健康管理师处理
                //查找病人所在的团队
                DoctorTeam doctorTeam = doctorTeamDao.findBySanshiParientCode(patient);
                //得到团队的健康管理师
                DoctorTeamMember doctorTeamMemberHealthy = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 3);
                DoctorTeamMember doctorTeamMember = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 2);
                if (doctorTeamMemberHealthy == null) {
                    ct.setDoctor(doctorTeamMember.getMemberCode());
                    users.put(doctorTeamMember.getMemberCode(), 0);
                } else {
                    users.put(doctorTeamMemberHealthy.getMemberCode(), 0);
                    if (doctorTeamMember != null) {
                        if (users.isNull(doctorTeamMember.getMemberCode())) {
                            users.put(doctorTeamMember.getMemberCode(), 1);
                        }
            ct.setTeam(sc.getTeamCode());
            // 设置健康管理师,三师咨询默认给健康管理师处理
            //查找病人所在的团队
            DoctorTeam doctorTeam = doctorTeamDao.findBySanshiParientCode(patient);
            //得到团队的健康管理师
            DoctorTeamMember doctorTeamMemberHealthy = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 3);
            DoctorTeamMember doctorTeamMember = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 2);
            if (doctorTeamMemberHealthy == null) {
                ct.setDoctor(doctorTeamMember.getMemberCode());
                users.put(doctorTeamMember.getMemberCode(), 0);
            } else {
                users.put(doctorTeamMemberHealthy.getMemberCode(), 0);
                if (doctorTeamMember != null) {
                    if (users.isNull(doctorTeamMember.getMemberCode())) {
                        users.put(doctorTeamMember.getMemberCode(), 1);
                    }
                    ct.setDoctor(doctorTeamMemberHealthy.getMemberCode());
                }
                // 设置家庭医生
                ct.setDoctor(doctorTeamMemberHealthy.getMemberCode());
            }
            // 设置家庭医生
                ct.setAdminTeamId(sc.getAdminTeamId());
            } else if (ct.getType() == 2) {
                // 咨询家庭医生
                SignFamily sf = signFamilyDao.findByjiatingPatient(patient);
            ct.setAdminTeamId(sc.getAdminTeamId());
        } else if (ct.getType() == 2) {
            // 咨询家庭医生
            SignFamily sf = signFamilyDao.findByjiatingPatient(patient);
                if (sf == null) {
                    // 不存在家庭签约
                    return -1;
                }
                ct.setTeam(sf.getTeamCode());
                // 设置健康管理师,家庭医生咨询默认给健康管理师处理
                //查找病人所在的团队
                //1.3.3.2 更改从签约记录判断团队成员,分配建管师
                if(StringUtils.isNotBlank(sf.getDoctorHealth())) {
                    users.put(sf.getDoctorHealth(), 0);
                    ct.setDoctor(sf.getDoctorHealth());
                    if (StringUtils.isNotBlank(sf.getDoctor())) {
                        if (users.isNull(sf.getDoctor())) {
                            users.put(sf.getDoctor(), 1);
                        }
            if (sf == null) {
                // 不存在家庭签约
                return -1;
            }
            ct.setTeam(sf.getTeamCode());
            // 设置健康管理师,家庭医生咨询默认给健康管理师处理
            //查找病人所在的团队
            //1.3.3.2 更改从签约记录判断团队成员,分配建管师
            if(StringUtils.isNotBlank(sf.getDoctorHealth())) {
                users.put(sf.getDoctorHealth(), 0);
                ct.setDoctor(sf.getDoctorHealth());
                if (StringUtils.isNotBlank(sf.getDoctor())) {
                    if (users.isNull(sf.getDoctor())) {
//                        users.put(sf.getDoctor(), 1); 全科默认也收到消息
                        users.put(sf.getDoctor(), 0);
                    }
                } else {
                    ct.setDoctor(sf.getDoctor());
                    users.put(sf.getDoctor(), 0);
                }
            } else {
                ct.setDoctor(sf.getDoctor());
                users.put(sf.getDoctor(), 0);
            }
//            DoctorTeam doctorTeam = doctorTeamDao.findByParientCode(patient);
//            //得到团队的健康管理师
@ -871,69 +870,68 @@ public class ConsultTeamService extends ConsultService {
//                ct.setDoctor(doctorTeamMemberHealthy.getMemberCode());
//            }
                // 设置家庭医生
                ct.setAdminTeamId(sf.getAdminTeamId());
            }
            // 设置患者信息
            ct.setPatient(patient);
            // 查询患者信息
            Patient tempPatient = patientDao.findByCode(patient);
            // 设置患者姓名
            ct.setName(tempPatient.getName());
            // 设置患者生日
            ct.setBirthday(tempPatient.getBirthday());
            //新增性别
            ct.setSex(tempPatient.getSex());
            // 设置患者头像
            ct.setPhoto(tempPatient.getPhoto());
            // 设置操作日期
            ct.setCzrq(new Date());
            ct.setDel("1");
            ct.setStatus(0);
            ct.setEvaluate(0);
            // 医生未读数量为1
            ct.setDoctorRead(1);
            // 添加咨询记录
            Consult consult = addConsult(ct.getPatient(), null, ct.getSymptoms(), ct.getImages(), ct.getType());
            // 设置关联指导
            consult.setGuidance(ct.getGuidance());
            // 设置咨询标识
            ct.setConsult(consult.getCode());
            // 设置家庭医生
            ct.setAdminTeamId(sf.getAdminTeamId());
        }
        // 设置患者信息
        ct.setPatient(patient);
        // 查询患者信息
        Patient tempPatient = patientDao.findByCode(patient);
        // 设置患者姓名
        ct.setName(tempPatient.getName());
        // 设置患者生日
        ct.setBirthday(tempPatient.getBirthday());
        //新增性别
        ct.setSex(tempPatient.getSex());
        // 设置患者头像
        ct.setPhoto(tempPatient.getPhoto());
        // 设置操作日期
        ct.setCzrq(new Date());
        ct.setDel("1");
        ct.setStatus(0);
        ct.setEvaluate(0);
        // 医生未读数量为1
        ct.setDoctorRead(1);
        // 添加咨询记录
        Consult consult = addConsult(ct.getPatient(), null, ct.getSymptoms(), ct.getImages(), ct.getType());
        // 设置关联指导
        consult.setGuidance(ct.getGuidance());
        // 设置咨询标识
        ct.setConsult(consult.getCode());
            //推送给IM去创建议题,取得成员消息
        //推送给IM去创建议题,取得成员消息
//        JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), "咨询问题:"+consult.getSymptoms(), consult.getImages());
            JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(),agent);
            users.put(patient, 0);//+ " "+(tempPatient.getSex()==1?"(男 ":"(女 ") + IdCardUtil.getAgeForIdcard(tempPatient.getIdcard())+")"
            JSONObject obj = ImUtill.createTopics(patient + "_" + ct.getTeam() + "_" + ct.getType(), consult.getCode(), tempPatient.getName(), users, messages, ImUtill.SESSION_TYPE_MUC);
            if (obj == null) {
                throw new RuntimeException("IM消息发送异常!");
            }
            if(obj.getInt("status")==-1){//im议题创建失败
                throw new RuntimeException(obj.getString("message"));
            }
            ct.setStartMsgId(obj.get("start_msg_id").toString());
            consultTeamDao.save(ct);
            consultDao.save(consult);
            for (String key : users.keySet()) {
                if (patient.equals(key)) {
                    continue;
                }
                //记录咨询的医生详情误删
                ConsultTeamDoctor cd = new ConsultTeamDoctor();
                cd.setConsult(consult.getCode());
                cd.setDel("1");
                cd.setCzrq(new Date());
                cd.setTo(key);
                consultTeamDoctorDao.save(cd);
        JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(),agent);
        users.put(patient, 0);//+ " "+(tempPatient.getSex()==1?"(男 ":"(女 ") + IdCardUtil.getAgeForIdcard(tempPatient.getIdcard())+")"
        JSONObject obj = ImUtill.createTopics(patient + "_" + ct.getTeam() + "_" + ct.getType(), consult.getCode(), tempPatient.getName(), users, messages, ImUtill.SESSION_TYPE_MUC);
        if (obj == null) {
            throw new RuntimeException("IM消息发送异常!");
        }
        if(obj.getInt("status")==-1){//im议题创建失败
            throw new RuntimeException(obj.getString("message"));
        }
        ct.setStartMsgId(obj.get("start_msg_id").toString());
        consultTeamDao.save(ct);
        consultDao.save(consult);
        for (String key : users.keySet()) {
            if (patient.equals(key)) {
                continue;
            }
            //记录咨询的医生详情误删
            ConsultTeamDoctor cd = new ConsultTeamDoctor();
            cd.setConsult(consult.getCode());
            cd.setDel("1");
            cd.setCzrq(new Date());
            cd.setTo(key);
            consultTeamDoctorDao.save(cd);
        }
            // 保存医生咨询信息
            // 添加咨询转发记录
            // 添加医生咨询日志
            String content = addLogs(ct);
        // 保存医生咨询信息
        // 添加咨询转发记录
        // 添加医生咨询日志
        String content = addLogs(ct);
            return 1;
        }
        return 1;
    }
    /**

+ 54 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java

@ -2,15 +2,18 @@ package com.yihu.wlyy.service.app.prenatalInspector;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.device.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.prenatal.PrenatalInspectorPlan;
import com.yihu.wlyy.entity.patient.prenatal.PrenatalInspectorPlanLibrary;
import com.yihu.wlyy.entity.patient.prenatal.PrenatalInspectorPreCard;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.third.jw.JwMaternalChildService;
import com.yihu.wlyy.service.third.jw.ZyDictService;
@ -18,6 +21,8 @@ import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -34,6 +39,8 @@ import java.util.Map;
@Transactional(rollbackFor = Exception.class)
public class PrenatalInspectorPreCardService extends BaseService {
    private static Logger logger = LoggerFactory.getLogger(PrenatalInspectorPreCardService.class);
    @Autowired
    private PrenatalInspectorPreCardDao prenatalInspectorPreCardDao;
    @Autowired
@ -56,6 +63,10 @@ public class PrenatalInspectorPreCardService extends BaseService {
    private DoctorDao doctorDao;
    @Autowired
    private ZyDictService zyDictService;
    @Autowired
    private PatientHealthIndexService healthIndexService;
    @Autowired
    private DevicePatientHealthIndexDao healthIndexDao;
//    public
@ -164,7 +175,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
                        //计算距离下次产检时间
                        Long nextExamDay = 0l;
                        for (PrenatalInspectorPlan plan:plans) {
                            Long temp = DateUtil.getDays(date,plan.getInspectionStartTime());
                            Long temp = DateUtil.getDays(plan.getInspectionTime(),date);
                            if(nextExamDay==0||nextExamDay>temp){
                                nextExamDay = temp;
                            }
@ -249,7 +260,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
                            //计算距离下次产检时间
                            Long nextExamDay = 0l;
                            for (PrenatalInspectorPlan plan:plans) {
                                Long temp = DateUtil.getDays(date,plan.getInspectionStartTime());
                                Long temp = DateUtil.getDays(plan.getInspectionTime(),date);
                                if(nextExamDay==0||nextExamDay>temp){
                                    nextExamDay = temp;
                                }
@ -352,8 +363,8 @@ public class PrenatalInspectorPreCardService extends BaseService {
     * @param patientCode
     * @return
     */
    public String reExamRecode(String patientCode,String pregnancyNo){
        String re = "";
    public JSONArray reExamRecode(String patientCode,String pregnancyNo){
        JSONArray re = new JSONArray();
        try {
            SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
            String hospital = null;
@ -363,7 +374,15 @@ public class PrenatalInspectorPreCardService extends BaseService {
            Patient patient = patientDao.findByCode(patientCode);
            String response = jwMaternalChildService.getEhrMaternalReExamRecord(patient.getIdcard(),hospital,pregnancyNo);
            return response;
            JSONObject json = JSONObject.parseObject(response);
            JSONArray data = null;
            if(json.getInteger("status")==200){
                data = json.getJSONObject("data").getJSONArray("DATA");
            }
            if(data!=null&&data.size()>0){
                return data;
            }
            return re;
        }catch (Exception e){
            e.printStackTrace();
        }
@ -513,9 +532,9 @@ public class PrenatalInspectorPreCardService extends BaseService {
     * 新建产检预建卡
     */
    @Transactional
    public String addPrenatalInspectorPreCard(PrenatalInspectorPreCard preCard,String patientcCode){
    public String addPrenatalInspectorPreCard(PrenatalInspectorPreCard preCard,String patientCode){
        SignFamily signFamily = signFamilyDao.findByPatient(patientcCode);
        SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
        if(signFamily==null){
            return "-1";
        }
@ -588,4 +607,32 @@ public class PrenatalInspectorPreCardService extends BaseService {
        return preCard.getCode();
    }
    /**
     * 保存体征数据 有保存体征数据才更新
     * @param preCard
     * @param patientCode
     */
    public void saveHealthIndex(PrenatalInspectorPreCard preCard,String patientCode){
        if(StringUtils.isNotBlank(preCard.getHeight())&&StringUtils.isNotBlank(preCard.getWeight())){
            //先判断体征数据是否变更
            DevicePatientHealthIndex index = healthIndexDao.findLastData(patientCode, 3);
            String height = index.getValue2();
            String weight = index.getValue1();
            if(!preCard.getHeight().equals(height)||!preCard.getWeight().equals(weight)){
                //更新体征数据
                JSONObject json = new JSONObject();
                json.put("time",DateUtil.dateToStrLong(preCard.getCzrq()));
                json.put("height",preCard.getHeight());
                json.put("weight",preCard.getWeight());
                try {
                    healthIndexService.addPatientHealthIndex(json.toString(), "3", patientCode, null);
                }catch (Exception e){
                    e.printStackTrace();
                    logger.error("预建卡时 保存体征数据失败。。。");
                }
            }
        }
    }
}

+ 33 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -469,6 +469,10 @@ public class PatientPrescriptionPayService extends BaseService {
            e.printStackTrace();
            isSuccess = false;
            response.getWriter().write(e.getMessage());
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        System.out.println("recipeReturnUrl result: " + resultMap);
        //记录支付log日志到数据库  支付
@ -760,6 +764,10 @@ public class PatientPrescriptionPayService extends BaseService {
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        //                记录log日志到数据库
        logger.info("api - " + config.getReceiveRecipeNotify());
@ -1092,12 +1100,24 @@ public class PatientPrescriptionPayService extends BaseService {
//            易联众新增字段代支付v1.3.7
            map.put("principalCardNo", ssc); //实际结算卡号( 默认为绑卡主体卡号)
            if (!patient.equals(repUid)) {
                String principalCardNo = null;
                Patient person = patientDao.findByCode(repUid);
                String repOpenId = person.getOpenid();
                BindCard repCard = onePayService.ownerCard(repOpenId);
                String repSsc = repCard.getAttachCardNo();
                map.put("principalCardNo", repSsc); //实际签约卡号( 默认为绑卡主体卡号)
                prescriptionPay.setPrincipalCardNo(repSsc);
                String repSsc = person.getSsc();
                List<BindCard> repCard = onePayService.bindCardList(openid);
                for (BindCard cards : repCard) {
                    String attachCardNo = cards.getAttachCardNo();
                    if (StringUtil.isNotEmpty(attachCardNo) && StringUtil.isNotEmpty(repSsc) && repSsc.equals(attachCardNo)) {
                        principalCardNo = repSsc;
                    }
                }
                if (StringUtils.isNotEmpty(principalCardNo)){
                    map.put("principalCardNo", principalCardNo); //实际签约卡号( 默认为绑卡主体卡号)
                    prescriptionPay.setPrincipalCardNo(principalCardNo);
                }else {
                    resultMap.put("status", "-4");
                    return resultMap;
                }
            }
            params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体
            logger.info("================================>" + "Before msBody");
@ -1403,7 +1423,7 @@ public class PatientPrescriptionPayService extends BaseService {
        return result;
    }
    
    public String getSignFamilyPayResult(String outChargeNo, String accessToken, String appId, String appSecret) throws Exception {
        PayConfigura config = configuraDao.findWorkConfigura();
        int flag = 0;
@ -1415,7 +1435,7 @@ public class PatientPrescriptionPayService extends BaseService {
//      ***************************  测通流程 ***************************************
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
    
        try {
            RequestParams requestParams = new RequestParams();
            requestParams.setAppId(appId);
@ -1423,12 +1443,12 @@ public class PatientPrescriptionPayService extends BaseService {
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
            requestParams.setTransType(config.getChargeQueryType());
        
            //业务参数
            JSONObject params = new JSONObject();
            params.put("outChargeNo", outChargeNo);  //接入应用结算业务流水号
            params.put("wxToken", accessToken);
        
            requestParams.setParam(params);
            msgBody = JSON.toJSONString(requestParams);
@ -1436,13 +1456,13 @@ public class PatientPrescriptionPayService extends BaseService {
            //执行支付 返回原生返回值
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            response = JSON.toJSONString(res);
        
            if (OnepayDefaultClient.isSuccessful(res)) {
                //业务处理*******************
//                只返回业务出参
                flag = 1;
                result = JSON.toJSONString(res.getParam());
            
                logger.info("请求成功,返回参数: " + result);
            } else {
                isSuccess = false;
@ -1455,7 +1475,7 @@ public class PatientPrescriptionPayService extends BaseService {
            ex.printStackTrace(pw);
            error = sw.toString();
        }
    
        //type = 3易联众接口保存http日志
        logger.info("api - " + config.getChargeQueryType());
        logger.info("request - " + msgBody);
@ -1465,7 +1485,7 @@ public class PatientPrescriptionPayService extends BaseService {
        if (!isSuccess) {
            throw new Exception(error);
        }
    
        return result;
    }
}

+ 20 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -25,6 +25,8 @@ import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -130,7 +132,7 @@ public class OnePayService {
    /**
     * 查询绑卡信息(所有卡)
     */
    private List<BindCard> bindCardList(String openid) throws Exception {
    public List<BindCard> bindCardList(String openid) throws Exception {
        Boolean isSuccess = true;
        String msgBody = "";
        String response = "";
@ -322,12 +324,23 @@ public class OnePayService {
            map.put("principalCardNo", ssc); //实际签约卡号( 默认为绑卡主体卡号)
            charge.setPrincipalSsc(ssc);
            if (!patient.equals(repUid)) {
                Patient people = patientDao.findByCode(repUid);
                String repOpenId = people.getOpenid();
                BindCard repCard = ownerCard(repOpenId);
                String repSsc = repCard.getAttachCardNo();
                map.put("principalCardNo", repSsc); //实际签约卡号( 默认为绑卡主体卡号)
                charge.setPrincipalSsc(repSsc);
                String principalCardNo = null;
                Patient person = patientDao.findByCode(repUid);
                String repSsc = person.getSsc();
                List<BindCard> repCard = bindCardList(openid);
                for (BindCard cards : repCard) {
                    String attachCardNo = cards.getAttachCardNo();
                    if (StringUtil.isNotEmpty(attachCardNo) && StringUtil.isNotEmpty(repSsc) && repSsc.equals(attachCardNo)) {
                        principalCardNo = repSsc;
                    }
                }
                if (StringUtils.isNotEmpty(principalCardNo)){
                    map.put("principalCardNo", principalCardNo); //实际签约卡号( 默认为绑卡主体卡号)
                    charge.setPrincipalSsc(principalCardNo);
                }else {
                    return "-1";
                }
            }
            params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prenatalInspector/PrenatalController.java

@ -60,8 +60,8 @@ public class PrenatalController extends BaseController{
                                             @ApiParam(name = "patient", value = "居民code", defaultValue = "d9de442323324a759ac82857c4692184")
                                             @RequestParam(value = "patient", required = true) String patient){
        try {
            String response = preCardService.reExamRecode(patient,pregnancyNo);
            return response;
            JSONArray response = preCardService.reExamRecode(patient,pregnancyNo);
            return write(200, "查询成功!", "data", response);
        }catch (Exception e){
            error(e);
            return error(-1,"查询失败");

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prenatalInspector/PrenatalInspectorContoller.java

@ -41,7 +41,8 @@ public class PrenatalInspectorContoller extends BaseController{
            if("-1".equals(code)){
                return error(-1,"居民未签约,无法添加预建卡信息");
            }
            String re = preCardService.uploadPreExam(code);
            preCardService.saveHealthIndex(preCard,getRepUID());//保存体征数据
            String re = preCardService.uploadPreExam(code);//上传智业
            if(StringUtils.isNotBlank(re)){
                System.out.println("re======"+re);
                return error(-1,re);
@ -85,9 +86,8 @@ public class PrenatalInspectorContoller extends BaseController{
    public String getEhrMaternalReExamRecord(@ApiParam(name = "pregnancyNo", value = "产检号", defaultValue = "")
                                             @RequestParam(value = "pregnancyNo", required = true) String pregnancyNo){
        try {
            String response = preCardService.reExamRecode(getUID(),pregnancyNo);
//            String response = preCardService.reExamRecode("d9de442323324a759ac82857c4692184",pregnancyNo);
            return response;
            JSONArray response = preCardService.reExamRecode(getUID(),pregnancyNo);//-- d9de442323324a759ac82857c4692184
            return write(200, "查询成功!", "data", response);
        }catch (Exception e){
            error(e);
            return error(-1,"查询失败");

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -92,6 +92,8 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
                return error(-1, "续方居民信息挂号号或处方号不存在!");
            } else if ("-3".equals(result.get("status").toString())) {
                return error(-1, "您没有需要待结算的信息!");
            } else if ("-4".equals(result.get("status").toString())) {
                return error(-1, "附属卡未绑定!");
            } else {
                return write(200, "支付成功!", "data", result);
            }
@ -117,9 +119,10 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return error(-1, "获取失败!");
        }
    }
    
    /**
     * 查询家庭签约支付结果
     *
     * @return
     */
    @RequestMapping(value = "/getSignFamilyPayResult", method = RequestMethod.GET)
@ -133,7 +136,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            @ApiParam(value = "易联众app secret", name = "appSecret") String appSecret) throws Exception {
        try {
            String accessToken = getAccessToken();
            String result = payService.getSignFamilyPayResult(outChargeNo, accessToken,appId,appSecret);
            String result = payService.getSignFamilyPayResult(outChargeNo, accessToken, appId, appSecret);
            return write(200, "获取成功!", "data", result);
        } catch (Exception e) {
            error(e);

+ 48 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java

@ -86,21 +86,48 @@ public class OnePayController extends WeixinBaseController {
    @ResponseBody
    public String bindCard() throws Exception {
        try {
            String repUid = getRepUID();
            JSONObject json = new JSONObject();
            String msg = null;
            String uid = getUID();
            String openid = getOpenid();
            String repUid = getRepUID();
            String patient = uid;
            Patient people = patientDao.findByCode(uid);
            String ssc = people.getSsc();
            String createType = "sicard";
            if (!repUid.equals(uid)) {
                patient = repUid;
                createType = "family";
                people = patientDao.findByCode(repUid);
                ssc = people.getSsc();
            }
            Patient people = patientDao.findByCode(patient);
            String openid = people.getOpenid();
            BindCard bindCard = pay.bindCard(patient, openid);
            String sicardUrl = pay.createSicard(patient, openid, createType);
            if (bindCard != null) {
//            BindCard bindCard = pay.bindCard(patient, openid);
            List<BindCard> bindCard = pay.bindCardList(openid);
            String sicardUrl = pay.createSicard(uid, openid, createType);
            for (BindCard cards : bindCard) {
                String attachCardNo = cards.getAttachCardNo();
                if (StringUtil.isNotEmpty(attachCardNo) && StringUtil.isNotEmpty(ssc) && ssc.equals(attachCardNo)) {
                    String attachRelation = cards.getAttachRelation();
                    String attachIdType = cards.getAttachIdType();
                    String attachIdNo = cards.getAttachIdNo();
                    String attachName = cards.getAttachName();
                    json.put("attachRelation", attachRelation);
                    json.put("attachCardNo", attachCardNo);
                    json.put("attachIdType", attachIdType);
                    json.put("attachIdNo", attachIdNo);
                    json.put("attachName", attachName);
                    json.put("bindStatus", "000000");
                    json.put("sicardUrl", sicardUrl);
                    msg = "查询绑卡信息成功!";
                    return write(200, "", "data", json);
                } else {
                    json.put("sicardUrl", sicardUrl);
                    json.put("bindStatus", "030007");
                    msg = "生成电子社保卡成功!";
                }
            }
            return write(200, msg, "data", json);
            /*if (bindCard != null) {
                JSONObject json = new JSONObject(bindCard);
                json.put("bindStatus", "000000");
                json.put("sicardUrl", sicardUrl);
@ -111,7 +138,8 @@ public class OnePayController extends WeixinBaseController {
                json.put("sicardUrl", sicardUrl);
                json.put("bindStatus", "030007");
                return write(200, "生成电子社保卡成功!", "data", json);
            }
            }*/
        } catch (Exception e) {
            error(e);
            return write(-1, "查询电子社保卡失败!");
@ -139,6 +167,9 @@ public class OnePayController extends WeixinBaseController {
            if (StringUtils.isNotEmpty(openId)) {
                String settleNo = pay.charge(orgCode, chargeType, chargeRelation, totalAmount, patient, repUid, openId, getAccessToken());
                if ("-1".equals(settleNo)){
                    return write(-1, "附属卡未绑定!");
                }
                return write(200, "家庭医生签约支付成功!", "data", settleNo);
            } else {
                return write(-1, "openId为空!");
@ -388,6 +419,10 @@ public class OnePayController extends WeixinBaseController {
        } catch (Exception e) {
            isSuccess = false;
            response.getWriter().write(e.getMessage());
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        //                记录log日志到数据库
        logService.saveHttpLog(isSuccess, config.getReturnUrl(), "支付页面跳转", "POST", null, "", responses, error, logService.onepayType);
@ -563,6 +598,10 @@ public class OnePayController extends WeixinBaseController {
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        //                记录log日志到数据库
        logService.saveHttpLog(isSuccess, config.getReceiveNotify(), "异步支付通知", "POST", null, params, responses, error, logService.onepayType);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu.txt

@ -51,7 +51,7 @@
        },
        {
            "type":"view",
            "name":"妇幼保健",
            "name":"孕检计划",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2ffybj%2fhtml%2fyunjianjihua.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        }
	  ]