浏览代码

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

huangwenjie 7 年之前
父节点
当前提交
2bdc49ad22

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java

@ -78,4 +78,8 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
            " AND t1.idcard NOT IN(SELECT DISTINCT s.idcard FROM wlyy_sign_family s,wlyy_old_people_physical_examination o WHERE s.admin_team_code=?1 AND s.`status`>0 AND s.idcard=o.id_card " +
            " AND o.medical_time>?2 )ORDER BY t1.openid DESC,CONVERT(t1.NAME USING gbk)",nativeQuery = true)
    List<Patient> findExaminationRemind(long teamcode, Date medicalTime);
    //根据code获取地址
    @Query("select p.address from Patient p where p.code = ?1")
    String getAddress(String patient);
}

+ 24 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/healthBank/PatientHealthBankService.java

@ -0,0 +1,24 @@
package com.yihu.wlyy.service.app.healthBank;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@Component
@Transactional(rollbackFor = Exception.class)
public class PatientHealthBankService extends BaseService {
    @Autowired
    private PatientDao patientDao;
    /**
     * 根据patient判断居民是否为海沧区
     * @param patient
     * @return
     */
    public boolean distinguish(String patient){
        String address = patientDao.getAddress(patient);
        return address.contains("海沧");
    }
}

+ 37 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/healthBank/PatientHealthBankController.java

@ -0,0 +1,37 @@
package com.yihu.wlyy.web.patient.healthBank;
import com.yihu.wlyy.service.app.healthBank.PatientHealthBankService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/patient/healthBank", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "患者端-健康银行管理")
public class PatientHealthBankController extends BaseController {
    @Autowired
    private PatientHealthBankService patientHealthBankService;
    /**
     * 判断居民是否为海沧区居民
     * @param patient
     * @return
     */
    @RequestMapping(value = "/distinguish", method = RequestMethod.GET)
    @ApiOperation("区分门户显示(判断是否为海沧区居民)")
    public String distinguish(@RequestParam(value = "patient") String patient){
        try {
            Boolean d = patientHealthBankService.distinguish(patient);
            return write(200, "查询成功!","data", d);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
}