Browse Source

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

liuwenbin 7 years ago
parent
commit
f661253cf8

+ 35 - 25
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -116,7 +116,7 @@ public class SignWebService extends BaseService {
    /**
     * 厦门市
     */
    public static String city ="350200";
    public static String city = "350200";
    /**
     * 根据医生代码及签约状态编码 获取该医生签约患者的信息列表
@ -129,11 +129,11 @@ public class SignWebService extends BaseService {
     */
    public List<Map<String, Object>> getSignWebByDoctor(String doctor, int status, int page, int pageSize) {
        Doctor d =doctorDao.findByCode(doctor);
        String sql ;
        if(d!=null&&d.getLevel()==3){
        Doctor d = doctorDao.findByCode(doctor);
        String sql;
        if (d != null && d.getLevel() == 3) {
            // 如果医生是健管师
             sql = "select " +
            sql = "select " +
                    "    a.code " +
                    "    ,a.doctor " +
                    "    ,b.code  as  patient" +
@ -157,9 +157,9 @@ public class SignWebService extends BaseService {
                    (status == 3 ? " and expenses_status = '1'" : "") + " order by begin desc ) a " +
                    " ,wlyy_patient b " +
                    " where a.patient = b.code  order by applyDate desc limit " + page * pageSize + "," + pageSize;
        }else{
        } else {
            // 查询语句
             sql = "select " +
            sql = "select " +
                    "    a.code " +
                    "    ,a.doctor " +
                    "    ,b.code  as  patient" +
@ -273,13 +273,13 @@ public class SignWebService extends BaseService {
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 2});
                break;
            case 3:// 已签约
                patients = jdbcTemplate.queryForList(isSignSql, new Object[]{doctor,doctor, 1});
                patients = jdbcTemplate.queryForList(isSignSql, new Object[]{doctor, doctor, 1});
                break;
            case 4:// 4已经解约
                patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor,doctor, -3, -4});
                patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor, doctor, -3, -4});
                break;
            case 5: // 未缴费
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor,doctor, 0});
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0});
        }
        return patients;
@ -720,7 +720,7 @@ public class SignWebService extends BaseService {
        }
        jsonObject.put("statusName", statusName);
//            增加支付流水号
        if (charge!=null) {
        if (charge != null) {
            String chargeCode = charge.getCode();
            jsonObject.put("chargeCode", chargeCode);
        }
@ -2383,7 +2383,7 @@ public class SignWebService extends BaseService {
        }
    }
    public int updateSignServerByCode(String signCode,String sevId) {
    public int updateSignServerByCode(String signCode, String sevId) {
        if (StringUtils.isNotBlank(sevId)) {
@ -2408,43 +2408,47 @@ public class SignWebService extends BaseService {
        }
        return -1;
    }
    //1.3.5居委会相关接口---
    public JSONArray getTownList(){
    public JSONArray getTownList() {
        List<Town> towns = townDao.findByCityCode(city);
        return new JSONArray(towns);
    }
    public JSONArray getStreetListByTown(String town){
    public JSONArray getStreetListByTown(String town) {
        List<Street> streets = streetDao.findListByTown(town);
        return new JSONArray(streets);
    }
    public JSONArray getCountryListByStreet(String street){
    public JSONArray getCountryListByStreet(String street) {
        List<Country> countrys = countryDao.findByStreet(street);
        return new JSONArray(countrys);
    }
    /**
     * 保存居委会字段
     *
     * @param countryCode 居委会Code
     * @param patientCode 患者Code
     * @return
     */
    public int setPatientCountry(String countryCode,String patientCode){
        if(StringUtils.isBlank(countryCode)){
    public int setPatientCountry(String countryCode, String patientCode) {
        if (StringUtils.isBlank(countryCode)) {
            return -1;
        }
        Country country = countryDao.findByCode(countryCode);
        if(country==null){
        if (country == null) {
            return -1;
        }
        Patient patient = patientService.findByCode(patientCode);
        if(patient==null){
        if (patient == null) {
            return -1;
        }
        patient.setSickVillage(countryCode);
        patient.setSickVillageName(country.getName());
        patientService.save(patient);
        SignFamily signFamily = signFamilyDao.findByPatientCodeStatus2(patientCode,0);
        if(signFamily!=null){
        SignFamily signFamily = signFamilyDao.findByPatientCodeStatus2(patientCode, 0);
        if (signFamily != null) {
            signFamily.setSickVillage(countryCode);
            signFamily.setSickVillageName(country.getName());
            signFamilyDao.save(signFamily);
@ -2454,20 +2458,21 @@ public class SignWebService extends BaseService {
    /**
     * 设置居委会字段
     *
     * @param countryCode
     * @param signFamily
     * @return
     */
    public int setPatientCountryFamily(String countryCode,SignFamily signFamily){
        if(StringUtils.isBlank(countryCode)){
    public int setPatientCountryFamily(String countryCode, SignFamily signFamily) {
        if (StringUtils.isBlank(countryCode)) {
            return -1;
        }
        Country country = countryDao.findByCode(countryCode);
        if(country==null){
        if (country == null) {
            return -1;
        }
        Patient patient = patientService.findByCode(signFamily.getPatient());
        if(patient==null){
        if (patient == null) {
            return -1;
        }
        patient.setSickVillage(countryCode);
@ -2479,4 +2484,9 @@ public class SignWebService extends BaseService {
        return 1;
    }
    public List<String> findOpenidsByTown(String town) {
        String sql = "select w.openid from wlyy_sign_family w ,dm_hospital d where w.hospital=d.`code` and d.town='" + town + "' and w.openid is not null and w.openid !=''";
        return jdbcTemplate.queryForList(sql, String.class);
    }
}

+ 34 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/WechatTagController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.wx;
import com.yihu.wlyy.service.app.sign.SignWebService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.wechat.util.WeiXinTagUtil;
import io.swagger.annotations.Api;
@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/4.
@ -21,6 +23,8 @@ import java.util.ArrayList;
@RequestMapping(value = "/wechat/tag", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "微信标签相关管理")
public class WechatTagController extends BaseController {
    @Autowired
    private SignWebService signWebService;
    @Autowired
    private WeiXinTagUtil weiXinTagUtil;
@ -42,7 +46,7 @@ public class WechatTagController extends BaseController {
    public String deleteTag(
            @ApiParam(name = "tageId", value = "微信标签Id", required = true) @RequestParam(value = "tageId", required = true) Integer tageId) {
        try {
           String string= weiXinTagUtil.deleteTag(tageId);
            String string = weiXinTagUtil.deleteTag(tageId);
            return write(200, "删除成功", "date", string);
        } catch (Exception e) {
            return error(-1, "失败");
@ -81,7 +85,7 @@ public class WechatTagController extends BaseController {
        try {
            String[] openis = openids.split(",");
            String string = weiXinTagUtil.addTagWithOpenid(java.util.Arrays.asList(openis),tageId);
            String string = weiXinTagUtil.addTagWithOpenid(java.util.Arrays.asList(openis), tageId);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            return error(-1, "失败");
@ -96,7 +100,34 @@ public class WechatTagController extends BaseController {
        try {
            String[] openis = openids.split(",");
            String string = weiXinTagUtil.deleteTagWithOpenid(java.util.Arrays.asList(openis),tageId);
            String string = weiXinTagUtil.deleteTagWithOpenid(java.util.Arrays.asList(openis), tageId);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            return error(-1, "失败");
        }
    }
    @ApiOperation(value = "给某个地区的患者设置标签")
    @RequestMapping(value = "addTagsWitHTown", method = RequestMethod.POST)
    public String addTagsWitHTown(
            @ApiParam(name = "town", value = "区 例如集美 350211", required = true) @RequestParam(value = "town", required = true) String town,
            @ApiParam(name = "tageId", value = "微信标签Id", required = true) @RequestParam(value = "tageId", required = true) Integer tageId) {
        try {
            List<String> openids = signWebService.findOpenidsByTown(town);
            String string = weiXinTagUtil.addTagWithOpenid(openids, tageId);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            return error(-1, "失败");
        }
    }
    @ApiOperation(value = "给某个地区的患者取消标签")
    @RequestMapping(value = "deleteTagsWitHTown", method = RequestMethod.POST)
    public String deleteTagsWitHTown(
            @ApiParam(name = "town", value = "区 例如集美 350211", required = true) @RequestParam(value = "town", required = true) String town,
            @ApiParam(name = "tageId", value = "微信标签Id", required = true) @RequestParam(value = "tageId", required = true) Integer tageId) {
        try {
            List<String> openids = signWebService.findOpenidsByTown(town);
            String string = weiXinTagUtil.deleteTagWithOpenid(openids, tageId);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            return error(-1, "失败");