Ver código fonte

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

trick9191 7 anos atrás
pai
commit
65b8fe2c58

+ 36 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/CreditLogService.java

@ -4,10 +4,12 @@ package com.yihu.wlyy.service.app.health.bank;/**
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.device.PatientDeviceService;
import com.yihu.wlyy.util.HttpClientUtil;
@ -52,6 +54,8 @@ public class CreditLogService {
    @Autowired
    private SystemDictDao systemDictDao;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
@ -87,7 +91,7 @@ public class CreditLogService {
        if (name == null || name == ""){
            sql  = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"')";
        } else if (name != null) {
            sql  = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"') AND name = '"+name+"'";
            sql  = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"') AND name LIKE '%"+name+"%'";
        }
        List<SignFamily> signFamilyList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily.class));
        List<String>  patientIds = new ArrayList<>();
@ -255,7 +259,7 @@ public class CreditLogService {
     * @return
     */
    public JSONObject selectByAccount(JSONObject object,Integer page,Integer size){
        String signSql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND patient = '"+object.getString("patientId") +"'";
        String signSql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND patient = '"+object.getString("patientId") +"' AND status = 1";
        List<SignFamily> signFamilyList1 = jdbcTemplate.query(signSql,new BeanPropertyRowMapper(SignFamily.class));
        String sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +signFamilyList1.get(0).getDoctor() + "' OR doctor_health = '" + signFamilyList1.get(0).getDoctor() +"')";
        List<SignFamily> signFamilyList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily.class));
@ -403,14 +407,14 @@ public class CreditLogService {
        if (name == null || name ==""){
            sql  = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"')";
        } else if (name != null) {
            sql  = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"') AND name = '"+name+"'";
            sql  = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"') AND name LIKE '%"+name+"%'";
        }
        List<SignFamily> signFamilyList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily.class));
        List<String>  patientOpenIds = new ArrayList<>();
        if (signFamilyList != null && signFamilyList.size() != 0){
            for (SignFamily signFamily:signFamilyList){
                patientOpenIds.add(signFamily.getOpenid());
                patientOpenIds.add(signFamily.getPatient());
            }
        }
        JSONObject object = new JSONObject();
@ -458,13 +462,38 @@ public class CreditLogService {
                patientIds.add(signFamily.getPatient());
            }
        }
        int deviceType = object.getInteger("deviceType");//设备类型 1血糖仪,2血压仪
        int bindStatus = object.getInteger("bindStatus");//绑定状态  0:绑定,1:未绑定
        List<String> ids = new ArrayList<>();
        for (int i=0;i<patientIds.size();i++){
            if (bindStatus == 0){
                String sql1 = "select * from wlyy_patient_device where user = '"+patientIds.get(i)+"' AND category_code = "+deviceType+" AND del = " + bindStatus;
                List<PatientDevice> patientDevices = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(PatientDevice.class));
                if (patientDevices != null && patientDevices.size() != 0){
                    ids.add(patientDevices.get(0).getUser());
                }
            }else if (bindStatus == 1){
                String sql1 = "select * from wlyy_patient_device where user = '"+patientIds.get(i)+"' AND category_code = "+deviceType+" AND del = " + bindStatus;
                List<PatientDevice> patientDevices = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(PatientDevice.class));
                if (patientDevices == null || patientDevices.size() ==0){
                    ids.add(patientIds.get(i));
                }
            }
        }
        JSONArray patientList = new JSONArray();
        for (int i =0 ;i<ids.size();i++){
            Patient patient = patientDao.findByCode(ids.get(i));
            JSONObject jsonObject = (JSONObject) JSONObject.toJSON(patient);
            patientList.add(jsonObject);
        }
        JSONObject object1 = new JSONObject();
        JSONArray array = object.getJSONArray("deviceTypes");
        object1.put("patientIds",patientIds.toArray());
        object1.put("patients",patientList);
        object1.put("bindStatus",object.getInteger("bindStatus"));
        object1.put("deviceTypes",array);
        object1.put("deviceType",deviceType);
        object1.put("ruleId",object.get("ruleId"));
        object1.put("page",page);
        object1.put("size",size);
        String response = null;
        String url =getBaseUrl() + "findAccounByCondition";
        JSONObject object2 = null;

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/bank/ActivityController.java

@ -226,7 +226,7 @@ public class ActivityController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/findAccount",method = RequestMethod.POST)
    @ApiOperation("银行账户信息")
    @ApiOperation("用户账户信息")
    public String selectByAccount(@ApiParam(name = "account",value = "任务JSON")
                                  @RequestParam(name = "account") String account,
                                  @ApiParam(name = "page", value = "第几页,从1开始")