Browse Source

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

liubing 3 years ago
parent
commit
370995ab5c

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

@ -3524,73 +3524,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else {
            sql = sql + "date_format(p.pay_time,'%Y-%m-%d %H:%i:%S' )  AS \"payTime\",";
        }
        sql = sql + "p.create_time\n" +
                "as time,\n" +
                "e. NAME\n" +
                "as NAME,\n" +
                "p.pay_time\n" +
                "as pay_time,\n" +
                "p.real_order\n" +
                "as realOrder,\n" +
                "o.patient_name\n" +
                "as patientName,\n" +
                "i.drug_name\n" +
                "as infoName,\n" +
                " CASE p.create_time\n" +
                "WHEN NULL THEN\n" +
                "\t'否'\n" +
                "ELSE\n" +
                "\t'是'\n" +
                "END \"create_time\",\n" +
                " CASE e.oneself_pickup_flg\n" +
                "WHEN 1 THEN\n" +
                "\t'自取'\n" +
                "WHEN 2 THEN\n" +
                "\t'快递配送'\n" +
                "ELSE\n" +
                "\t' '\n" +
                "END \"oneself_pickup_flg\",\n" +
                " CASE p. STATUS\n" +
                "WHEN - 4 THEN\n" +
                "\t'已作废'\n" +
                "WHEN - 3 THEN\n" +
                "\t'支付过期取消'\n" +
                "WHEN - 2 THEN\n" +
                "\t'患者自己取消'\n" +
                "WHEN - 1 THEN\n" +
                "\t'医生取消'\n" +
                "WHEN 0 THEN\n" +
                "\t'候诊中'\n" +
                "WHEN 10 THEN\n" +
                "\t'诊断中'\n" +
                "WHEN 11 THEN\n" +
                "\t'药师审核失败 / 调整中'\n" +
                "WHEN 12 THEN\n" +
                "\t'药师审核完成'\n" +
                "WHEN 13 THEN\n" +
                "\t'开方失败/调整中'\n" +
                "WHEN 20 THEN\n" +
                "\t'诊断完成/开方成功/待支付'\n" +
                "WHEN 30 THEN\n" +
                "\t'支付成功/等待配药'\n" +
                "WHEN 31 THEN\n" +
                "\t'配药成功/等待取药'\n" +
                "WHEN 32 THEN\n" +
                "\t'配送中'\n" +
                "WHEN 100 THEN\n" +
                "\t'已完成/未评价'\n" +
                "WHEN 101 THEN\n" +
                "\t'已完成/已经评价'\n" +
                "ELSE\n" +
                "\t' '\n" +
                "END STATUS\n" +
                "FROM\n" +
                "\twlyy_outpatient o\n" +
                "LEFT JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
                "LEFT JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id\n" +
                "LEFT JOIN wlyy_prescription_info i ON i.prescription_id = p.id\n" +
                "WHERE\n" +
                "\t1 = 1";
        sql = sql + " e.name as \"name\", " +
                " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
                " o.id AS \"outpatientId\", " +
                " o.icd10_name AS \"icd10Name\", " +
                " p.status as \"status\", " +
                " p.id AS \"prescriptionId\" ," +
                " e.id AS \"expressageId\" ,"+
                " p.real_order AS \"realOrder\" ,"+
                " p.origin_real_order AS \"originRealOrder\"," +
                " o.patient_name as \"patientName\" "+
                " FROM " +
                " wlyy_outpatient o " +
                " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
                " JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id " +
                " WHERE" +
                " 1=1";
        if (StringUtils.isNotBlank(status)) {
            sql += " AND p.status in(" + status + ") ";
        }
@ -3631,14 +3580,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql +=" order by p.create_time desc ";
        /*       sql += " LIMIT " + (page - 1) * size + "," + size + "";*/
        List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(sql,page,size);
        for (Map<String, Object> map : mapList) {
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, page, size);
        for (Map<String, Object> map : list) {
            if (map.get("prescriptionId") != null) {
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(map.get("prescriptionId").toString(), 1);
                map.put("info", wlyyPrescriptionInfoDOS);
            }
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, mapList,page,size,count);
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
    public Boolean setMailno(String mailno, String expressageId) {
@ -12287,7 +12238,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                baseNatAppointmentDO.setDoctorId(staffNo);
                baseNatAppointmentDO.setConsumer(consumer);
                baseNatAppointmentDO.setDoctorName(staffName);
                baseNatAppointmentDO.setAppointmentTime(new Date());
                baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
                logger.info("BaseNatAppointmentDO保存结束"+baseNatAppointmentDO.getId());
                //添加订单
@ -13558,4 +13509,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    /**
     *
     * @param receiverType 1医生、2患者
     * @param oupatientId
     * @param sendType 1系统、2短信、3全部
     * @return
     */
    public String sendMessageManger(String receiver,String receiverType,String oupatientId,String businessType,String sendType){
        String msg = "";
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(oupatientId);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(wlyyOutpatientDO.getDoctor());
        if (StringUtils.isNoneBlank(receiverType)&&receiver.equalsIgnoreCase("1")){
            if (sendType.equalsIgnoreCase("2")){
                ykyySMSService.sendSmsByTempcode("outpatient_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
            }else if (sendType.equalsIgnoreCase("1")){
                wxTempalteJPush("remind_doctor_pickup",wlyyOutpatientDO,null,"","","","");
            }else if (sendType.equalsIgnoreCase("3")){
                ykyySMSService.sendSmsByTempcode("outpatient_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
                wxTempalteJPush("remind_doctor_pickup",wlyyOutpatientDO,null,"","","","");
            }
        }else if (StringUtils.isNoneBlank(receiverType)&&receiver.equalsIgnoreCase("2")){
            if (sendType.equalsIgnoreCase("2")){
                ykyySMSService.sendSmsByTempcode("outpatient_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
            }else if (sendType.equalsIgnoreCase("1")){
                wxTempalteJPush("remind_doctor_pickup",wlyyOutpatientDO,null,"","","","");
            }else if (sendType.equalsIgnoreCase("3")){
                ykyySMSService.sendSmsByTempcode("outpatient_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
                wxTempalteJPush("remind_doctor_pickup",wlyyOutpatientDO,null,"","","","");
            }
        }
        return "成功";
    }
}

+ 40 - 24
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1967,7 +1967,6 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                " t.yk_order_id as \"ykOrderId\","+
                " b.idcard as \"idcard\", "+
                " b.mobile as \"mobile\", "+
                " t.order_type as \"orderType\", "+
                " case t.order_category when '2' then '2' when '3' then '2' else t.order_category end  as \"orderCategory\" "+
                " from base_business_order_pay t" +
                " left join base_patient b on t.patient = b.id  where 1=1  ";
@ -2025,6 +2024,17 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        sql+=" order by t.create_time desc ";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        for (Map<String,Object> map:list){
            if (map.get("orderCategory")!=null){
                String orderCategoryFlag = map.get("orderCategory").toString();
                if (!orderCategoryFlag.equalsIgnoreCase("5")){
                    Double price = Double.parseDouble(map.get("payPrice").toString());
                    Double prie = price/100;
                    logger.info("price"+prie);
                    map.put("payPrice",prie);
                }
            }
        }
        /*for (Map<String,Object> map:list){
            if (map.get("createTime")!=null){
                map.put("createTime",);
@ -2049,25 +2059,25 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                "\t' '\n" +
                "ELSE\n" +
                "\tt.id\n" +
                "END id,\n" +
                "END \"id\",\n" +
                " CASE t.patient\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.patient\n" +
                "END patient,\n" +
                "END \"patient\",\n" +
                " CASE t.patient_name\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.patient_name\n" +
                "END patientName,\n" +
                "END \"patientName\",\n" +
                " CASE t.order_no\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.order_no\n" +
                "END orderNo,\n" +
                "END \"orderNo\",\n" +
                /*" CASE t.order_type\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
@ -2079,85 +2089,85 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                "\t' '\n" +
                "ELSE\n" +
                "\tt.relation_code\n" +
                "END relationCode,\n" +
                "END \"relationCode\",\n" +
                " CASE t.relation_name\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.relation_name\n" +
                "END relationName,\n" +
                "END \"relationName\",\n" +
                " CASE t.description\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.description\n" +
                "END description,\n" +
                "END \"description\",\n" +
                " CASE t.pay_type\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.pay_type\n" +
                "END payType,\n" +
                "END \"payType\",\n" +
                " CASE t.pay_price\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.pay_price\n" +
                "END payPrice,\n" +
                "END \"payPrice\",\n" +
                " CASE t.pay_time\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.pay_time\n" +
                "END payTime,\n" +
                "END \"payTime\",\n" +
                " CASE t.upload_status\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.upload_status\n" +
                "END uploadStatus,\n" +
                "END \"uploadStatus\",\n" +
                " CASE t.create_time\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.create_time\n" +
                "END createTime,\n" +
                "END \"createTime\",\n" +
                " CASE t.remark\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.remark\n" +
                "END remark,\n" +
                "END \"remark\",\n" +
                " CASE t.relation_code\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.relation_code\n" +
                "END medicard,\n" +
                "END \"medicard\",\n" +
                " CASE t.yk_order_no\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.yk_order_no\n" +
                "END ykOrderNo,\n" +
                "END \"ykOrderNo\",\n" +
                " CASE t.yk_order_id\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.yk_order_id\n" +
                "END ykOrderId,\n" +
                "END \"ykOrderId\",\n" +
                " CASE b.idcard\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tb.idcard\n" +
                "END idcard,\n" +
                "END \"idcard\",\n" +
                " CASE b.mobile\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tb.mobile\n" +
                "END mobile,\n" +
                "END \"mobile\",\n" +
                " CASE t. STATUS\n" +
                "WHEN 0 THEN\n" +
                "\t'未支付'\n" +
@ -2189,7 +2199,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                "\t' '\n" +
                "ELSE\n" +
                "\tt.order_category\n" +
                "END orderCategory\n" +
                "END \"orderCategory\" \n" +
                "FROM\n" +
                "\tbase_business_order_pay t\n" +
                "LEFT JOIN base_patient b ON t.patient = b.id\n" +
@ -2249,11 +2259,17 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        sql+=" order by t.create_time desc ";
        List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql);
        /*for (Map<String,Object> map:list){
            if (map.get("createTime")!=null){
                map.put("createTime",);
        for (Map<String,Object> map:mapList){
            if (map.get("orderCategory")!=null){
                String orderCategoryFlag = map.get("orderCategory").toString();
                if (!orderCategoryFlag.equalsIgnoreCase("5")){
                    Double price = Double.parseDouble(map.get("payPrice").toString());
                    Double prie = price/100;
                    logger.info("price"+prie);
                    map.put("payPrice",prie);
                }
            }
        }*/
        }
        return MixEnvelop.getSuccessListWithPage2(BaseHospitalRequestMapping.Prescription.api_success, mapList);
    }

+ 13 - 0
common/common-entity/sql记录

@ -1553,3 +1553,16 @@ CREATE TABLE `base_yunxing_channel` (
-- 2021-10-14 ysj
ALTER table wlyy_devices add column collect_num int(20) default null COMMENT '采集数据次数';
ALTER table wlyy_devices add column abnormal_num int(20) default null COMMENT '异常指标数据次数';
-- 2021-10-16 ysj
CREATE TABLE `base_child_activity_registration` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) DEFAULT NULL,
  `patient_name` varchar(50) DEFAULT NULL,
  `activity_type` varchar(2) DEFAULT NULL COMMENT '活动类型',
  `org_code` varchar(50) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='幼儿活动报名表';

+ 57 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/activity/ChildActivityRegistrationDO.java

@ -0,0 +1,57 @@
package com.yihu.jw.entity.care.activity;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 幼儿活动报名表
 * Created by yeshijie on 2021/10/16.
 */
@Entity
@Table(name="base_child_activity_registration")
public class ChildActivityRegistrationDO extends UuidIdentityEntityWithCreateTime {
    private String patient;
    private String patientName;
    private String activityType;
    private String orgCode;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "activity_type")
    public String getActivityType() {
        return activityType;
    }
    public void setActivityType(String activityType) {
        this.activityType = activityType;
    }
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
}

+ 20 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/activity/ChildActivityRegistrationDao.java

@ -0,0 +1,20 @@
package com.yihu.jw.care.dao.activity;
import com.yihu.jw.entity.care.activity.ChildActivityRegistrationDO;
import com.yihu.jw.entity.care.consult.BaseYunxingChannelDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/10/16.
 */
public interface ChildActivityRegistrationDao extends PagingAndSortingRepository<ChildActivityRegistrationDO,String>,
        JpaSpecificationExecutor<ChildActivityRegistrationDO> {
    @Query("select a from ChildActivityRegistrationDO a where a.patient = ?1 and a.activityType = ?2 ")
    ChildActivityRegistrationDO findByPatientAndActivityType(String patient,String activityType);
    @Query("select a from ChildActivityRegistrationDO a where a.patient = ?1 ")
    ChildActivityRegistrationDO findByPatient(String patient);
}

+ 76 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/activity/ChildActivityEndpoint.java

@ -0,0 +1,76 @@
package com.yihu.jw.care.endpoint.activity;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.activity.ChildActivityRegistrationService;
import com.yihu.jw.entity.care.activity.ChildActivityRegistrationDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
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.*;
/**
 * Created by yeshijie on 2021/10/16.
 */
@RestController
@RequestMapping("childActivity" )
@Api(tags = "幼儿活动", description = "幼儿活动")
public class ChildActivityEndpoint  extends EnvelopRestEndpoint {
    @Autowired
    private ChildActivityRegistrationService activityRegistrationService;
    @GetMapping(value = "childActivityRegistrationList")
    @ApiOperation(value = "活动报名列表查询")
    public PageEnvelop childActivityRegistrationList(
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = false) String patient,
            @ApiParam(name = "activityType", value = "活动类型 1小鬼来当家 2秋游去 3我喜欢我自己 4乡村音乐") @RequestParam(value = "activityType", required = false) String status,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
        try{
            return activityRegistrationService.childActivityRegistrationList(patient, status, page, size);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @GetMapping(value = "isActivityRegist")
    @ApiOperation(value = "活动报名查询")
    public ObjEnvelop isActivityRegist(
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = true) String patient) {
        try{
            ChildActivityRegistrationDO registrationDO = activityRegistrationService.isActivityRegist(patient);
            if(registrationDO==null){
                return ObjEnvelop.getSuccess("查询成功",0);
            }else {
                return ObjEnvelop.getSuccess("查询成功",1);
            }
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping("applyActivity")
    @ApiOperation(value = "在线报名-根据教师展示")
    public ObjEnvelop applyActivity(
            @ApiParam(name = "patient", value = "居民id")
            @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "activityType", value = "活动类型 1小鬼来当家 2秋游去 3我喜欢我自己 4乡村音乐")
            @RequestParam(value = "activityType", required = true) String activityType
    ) {
        try {
            JSONObject result = activityRegistrationService.applyActivity(patient,activityType);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg),-1);
            }
            return success(result.get("resultMsg"));
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
}

+ 20 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java

@ -131,8 +131,26 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取教师")
    public ListEnvelop findDoctorByOrg (
            @ApiParam(name = "orgCode", value = "机构code")
            @RequestParam(value = "orgCode", required = false) String orgCode) throws Exception {
        return success(courseService.findDoctorByOrg(orgCode));
            @RequestParam(value = "orgCode", required = false) String orgCode){
        try {
            return success(courseService.findDoctorByOrg(orgCode));
        }catch (Exception e){
            e.printStackTrace();
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping(value = "findDoctorByOrgLimit")
    @ApiOperation(value = "查找机构的老师 奶牛城堡时限制教师")
    public ListEnvelop findDoctorByOrgLimit (
            @ApiParam(name = "orgCode", value = "机构code")
            @RequestParam(value = "orgCode", required = false) String orgCode) {
        try {
            return success(courseService.findDoctorByOrgLimit(orgCode));
        }catch (Exception e){
            e.printStackTrace();
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping("getCourseByteacher")

+ 95 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/activity/ChildActivityRegistrationService.java

@ -0,0 +1,95 @@
package com.yihu.jw.care.service.activity;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.activity.ChildActivityRegistrationDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.activity.ChildActivityRegistrationDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/10/16.
 */
@Service
public class ChildActivityRegistrationService {
    @Autowired
    private ChildActivityRegistrationDao childActivityRegistrationDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 幼儿申请活动
     * @param patient
     * @param activityType
     * @return
     */
    public JSONObject applyActivity(String patient, String activityType){
        JSONObject result = new JSONObject();
        ChildActivityRegistrationDO activityRegistrationDO = childActivityRegistrationDao.findByPatient(patient);
        if(activityRegistrationDO != null){
            String failMsg = "您已报名过改类型的活动,请勿重复报名!";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, failMsg);
            return result;
        }
        BasePatientDO patientDO = patientDao.findById(patient);
        activityRegistrationDO = new ChildActivityRegistrationDO();
        activityRegistrationDO.setActivityType(activityType);
        activityRegistrationDO.setPatient(patient);
        activityRegistrationDO.setPatientName(patientDO.getName());
        childActivityRegistrationDao.save(activityRegistrationDO);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, activityRegistrationDO);
        return result;
    }
    /**
     * 活动报名列表查询
     * @param patient
     * @param activityType
     * @param page
     * @param size
     */
    public PageEnvelop childActivityRegistrationList(String patient,String activityType, int page, int size){
        String sql = "SELECT a.activity_type activityType,a.patient,p.name,p.sex,p.idcard,p.photo from base_child_activity_registration a,base_patient p " +
                "WHERE a.patient = p.id";
        String sqlCount = "select count(a.id) from base_child_activity_registration a,base_patient p WHERE a.patient = p.id  ";
        page = page>0?page-1:0;
        String limit = " order by a.create_time desc limit "+page*size+","+size;
        String filter = "";
        if(StringUtils.isNotBlank(patient)){
            filter += " and a.pateint = '"+patient+"' ";
        }
        if(StringUtils.isNotBlank(activityType)){
            filter += " and a.activity_type = '"+activityType+"' ";
        }
        Long count = jdbcTemplate.queryForObject(sqlCount+filter,Long.class);
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql+filter);
        for (Map<String,Object> map:result){
            String idcard = map.get("idcard")+"";
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
        }
        return PageEnvelop.getSuccessListWithPage("查询成功",result,page,size,count);
    }
    public ChildActivityRegistrationDO isActivityRegist(String patient){
        return childActivityRegistrationDao.findByPatient(patient);
    }
}

+ 15 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java

@ -452,6 +452,21 @@ public class CourseService {
        return amapList;
    }
    /**
     * 查找机构的老师 奶牛城堡时限制教师
     * @param orgCode
     * @return
     */
    public List<Map<String,Object>> findDoctorByOrgLimit(String orgCode){
        String sql1 = "SELECT d.* FROM base_doctor d,base_doctor_hospital sh WHERE  d.del = 1 and  d.id = sh.doctor_code AND sh.del = 1 AND sh.org_code = '"+orgCode+"' " ;
        if("zhjdnncbtyy".equals(orgCode)){
            sql1 += " and d.consult_status = '1' ";
        }
        List<Map<String , Object >> amapList = jdbcTemplate.queryForList(sql1);
        return amapList;
    }
    public JSONObject getCourseByOrg(String lon2,String lat2){ //, int pageSize,int currentPage
        JSONObject object = new JSONObject();
        String sql = "SELECT id, code, `name`, mobile, photo, address, longitude, latitude, funDistance ( latitude, longitude, "+lat2+", "+lon2+" ) funDistance FROM base.base_org WHERE del = 1 and type = 4 ORDER BY funDistance DESC\n";

+ 5 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java

@ -822,13 +822,13 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
                ",ord.doctor,ord.doctor_name doctorName,ord.expected_doctor_name expectedDoctorName,group_concat(Distinct fee.name SEPARATOR '、') serveItems" +
                " from base_life_care_order ord LEFT JOIN base_life_care_fee_detail fee on ord.id = fee.order_id " +
                "and fee.`status`<>3 where ord.patient = '"+patient+"' and ord.status<>0 ";
        String fliter = "";
        String filter = "";
       if (status != null){
           fliter += " and ord.status = "+status;
           filter += " and ord.status = "+status;
       }
       Long count = jdbcTemplate.queryForObject(sqlCount+fliter,Long.class);
       fliter += " group by ord.id order by ord.create_time desc limit "+page*size+","+size;
       List<Map<String,Object>> result = jdbcTemplate.queryForList(sql+fliter);
       Long count = jdbcTemplate.queryForObject(sqlCount+filter,Long.class);
        filter += " group by ord.id order by ord.create_time desc limit "+page*size+","+size;
       List<Map<String,Object>> result = jdbcTemplate.queryForList(sql+filter);
       return PageEnvelop.getSuccessListWithPage("查询成功",result,page,size,count);
    }

+ 3 - 0
svr/svr-cloud-transfor/readme.MD

@ -0,0 +1,3 @@
医养转发项目
爱牵挂推送医养杭州服务器有问题,公司的iot项目请求有时会失败
新增处理转发