Kaynağa Gözat

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

Shi Kejing 3 yıl önce
ebeveyn
işleme
bc9456b8e1

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java

@ -517,7 +517,19 @@ public class DoctorDoorCoachOrderController extends BaseController {
        }
    }
    @PostMapping(value = "payOrder")
    @ApiOperation(value = "医生确认付款")
    public ObjEnvelop payOrder(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "payWay", value = "支付方式:1-微信支付,2-线下支付") @RequestParam(value = "payWay", required = false,defaultValue = "2") int payWay) {
        try {
            return ObjEnvelop.getSuccess("操作成功",doctorDoorCoachOrderService.payOrder(orderId, payWay));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询成功");
        }
    }
    /**
     * 获取服务项目

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

@ -0,0 +1,78 @@
package com.yihu.jw.care.endpoint.third.patient;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.service.WechatInfoService;
import io.swagger.annotations.Api;
import org.apache.axis.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * Created by Bing on 2021/5/28.
 */
@RestController
@RequestMapping(value = "/cloudCare/noLogin/patient")
@Api(value = "患者不用登陆访问控制类", description = "患者不用登陆访问控制类")
public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private WechatInfoService wechatInfoService;
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    /**
     * 获取微信openid
     *
     * @param code
     * @return
     */
    @RequestMapping(value = "/getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public Envelop getOpenidByCode(String code, @RequestParam(value = "patientId", required = false)String patientId) throws Exception {
        try {
            //通过redis获取openid, 获取不到,则调用微信接口去取
            String key = wxId+":code";
            String openid = redisTemplate.opsForValue().get(key);
            if(!StringUtils.isEmpty(openid)){
                return success(PatientRequestMapping.Wechat.api_success,openid);
            }
            openid = wechatInfoService.getOpenidByCode(code, wxId);
            if (!StringUtils.isEmpty(patientId)){
                List<BasePatientWechatDo> list = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patientId);
                if (list!=null&&list.size()>0){
                    for (BasePatientWechatDo basePatientWechatDo:list){
                        basePatientWechatDo.setOpenid(openid);
                        basePatientWechatDao.save(basePatientWechatDo);
                    }
                }else {
                    BasePatientWechatDo basePatientWechatDo = new BasePatientWechatDo();
                    basePatientWechatDo.setPatientId(patientId);
                    basePatientWechatDo.setWechatId(wxId);
                    basePatientWechatDo.setCreateTime(new Date());
                    basePatientWechatDo.setOpenid(openid);
                    basePatientWechatDao.save(basePatientWechatDo);
                }
            }
            redisTemplate.opsForValue().set(key,openid);
            redisTemplate.expire(key,10, TimeUnit.SECONDS);
            return success(PatientRequestMapping.Wechat.api_success,openid);
        } catch (Exception e){
            return  failedException(e);
        }
    }
}

+ 6 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java

@ -235,14 +235,14 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        List<Map<String,Object>> list = new ArrayList<>();
        //未入学
        String sql0 = "select Distinct sor.patient from base_course_sales_order_record sor INNER JOIN base_course bc on sor.course_id = bc.id " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =5 and not EXISTS (select DISTINCT rsr.patient " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =2 and not EXISTS (select DISTINCT rsr.patient " +
                " from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` and org.del=1 " +
                " INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=sor.patient and " +
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 3  )";
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 2  )";
        //已入学
        String sql1=" select DISTINCT rsr.patient from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " +
                "and rsr.del<>0  and rsr.`status` = 3 GROUP BY dh.doctor_code  ";
                "and rsr.del<>0  and rsr.`status` = 2 GROUP BY dh.doctor_code  ";
        String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 GROUP BY p.id ";
        String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
@ -282,14 +282,14 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        Map<String,Long> result = new HashMap<>();
        //未入学
        String sql0 = "select Distinct sor.patient from base_course_sales_order_record sor INNER JOIN base_course bc on sor.course_id = bc.id " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =5 and not EXISTS (select DISTINCT rsr.patient " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =2 and not EXISTS (select DISTINCT rsr.patient " +
                " from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` and org.del=1 " +
                " INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=sor.patient and " +
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 3  )";
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 2  )";
        //已入学
        String sql1=" select DISTINCT rsr.patient from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " +
                "and rsr.del<>0  and rsr.`status` = 3 GROUP BY dh.doctor_code  ";
                "and rsr.del<>0  and rsr.`status` = 2 GROUP BY dh.doctor_code  ";
        String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java

@ -1115,6 +1115,18 @@ public class DoctorDoorCoachOrderService {
        doctorStatusDao.save(doctorSwitch);
    }
    @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class)
    public boolean payOrder(String orderId,int payWay) {
        BaseDoorCoachOrderDO orderDO= wlyyDoorServiceOrderDao.findOne(orderId);
        if(null == orderDO){
            return false;
        }
        orderDO.setPayWay(payWay);
        orderDO.setPayTime(new Date());
        wlyyDoorServiceOrderDao.save(orderDO);
        return true;
    }
    /**
     * 门牌地址解析
     * @param url

+ 4 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -232,11 +232,11 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
    public List<Map<String,Object>> getTeacherOrgList(String patient){
        String sql = "select Distinct sor.org_code,org.name from base_course_sales_order_record sor " +
                "INNER JOIN base_org org on sor.org_code = org.code " +
                "where sor.patient ='"+patient+"' and sor.`status` =3 " +
                "where sor.patient ='"+patient+"' and sor.`status` =2 " +
                "UNION " +
                "select DISTINCT rsr.org_code,org.name from base_recruit_students_record rsr INNER JOIN  " +
                "base_org org on rsr.org_code = org.`code` and org.del=1 " +
                "where rsr.patient='"+patient+"' and rsr.del<>0 and rsr.`status` = 3";
                "where rsr.patient='"+patient+"' and rsr.del<>0 and rsr.`status` = 2";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
@ -258,12 +258,12 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        String sqlCondition = " from  " +
                "(select Distinct bc.doctor doctor,sor.org_code from base_course_sales_order_record sor INNER JOIN base_course bc on " +
                "sor.course_id = bc.id and bc.del=1 " +
                "where sor.patient ='"+patient+"'  and sor.`status` =3   GROUP BY bc.doctor  " +//购入课程
                "where sor.patient ='"+patient+"'  and sor.`status` =2   GROUP BY bc.doctor  " +//购入课程
                "UNION " +
                "select DISTINCT dh.doctor_code doctor,rsr.org_code from base_recruit_students_record rsr INNER JOIN  " +
                "base_org org on rsr.org_code = org.`code` and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code " +
                "and dh.del =1  " +
                "where rsr.patient='"+patient+"' and rsr.del<>0  and rsr.`status` = 3 GROUP BY dh.doctor_code " +//入学机构
                "where rsr.patient='"+patient+"' and rsr.del<>0  and rsr.`status` = 2 GROUP BY dh.doctor_code " +//入学机构
                ")A INNER JOIN base_doctor_hospital dh on A.doctor =dh.doctor_code and a.org_code = dh.org_code " +
                "INNER JOIN base_doctor doc on dh.doctor_code = doc.id LEFT JOIN dict_hospital_dept dict on dh.dept_code = dict.`code` " +
                "and dh.org_code = dict.org_code and dh.del=1 where 1=1 ";