|  | @ -1,10 +1,13 @@
 | 
	
		
			
				|  |  | package com.yihu.wlyy.web.patient.family;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.imm.ChildInfo;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.Patient;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.PatientFamilyMember;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.patient.PatientDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.app.family.FamilyMemberService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.imm.ChildFamilyImmuneService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.imm.ChildInfoService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.MD5;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.web.WeixinBaseController;
 | 
	
		
			
				|  |  | import io.swagger.annotations.Api;
 | 
	
	
		
			
				|  | @ -16,6 +19,9 @@ import org.json.JSONObject;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * 家庭关系成员控制器
 | 
	
		
			
				|  |  |  * <p>
 | 
	
	
		
			
				|  | @ -32,6 +38,11 @@ public class FamilyMemberController extends WeixinBaseController {
 | 
	
		
			
				|  |  |     PatientFamilyMemberDao familyMemberDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     PatientDao patientDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ChildInfoService childInfoService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ChildFamilyImmuneService childFamilyImmuneService;
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 添加成员
 | 
	
	
		
			
				|  | @ -198,16 +209,18 @@ public class FamilyMemberController extends WeixinBaseController {
 | 
	
		
			
				|  |  |     public String getPatientFamilyMembers(@RequestParam(required = false) String patient,
 | 
	
		
			
				|  |  |                                           @RequestParam(required = false) Integer isAgree) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             JSONObject data = new JSONObject();
 | 
	
		
			
				|  |  |             JSONArray result = new JSONArray();
 | 
	
		
			
				|  |  |             if (StringUtils.isNotEmpty(patient)) {
 | 
	
		
			
				|  |  |                 result = familyMemberService.getPatientMembers(patient, "", true, getUID(),isAgree);
 | 
	
		
			
				|  |  |             } else  {
 | 
	
		
			
				|  |  |                 result = familyMemberService.getPatientFamilyMembers(getUID(), "",null);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             List<Map<String, Object>>  immrs = childFamilyImmuneService.getImmunemembers(getRepUID());
 | 
	
		
			
				|  |  | //            List<Map<String, Object>>  immrs = childFamilyImmuneService.getImmunemembers("22");
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |             JSONObject data = new JSONObject();
 | 
	
		
			
				|  |  |             data.put("normalmembers",result);//家人关系
 | 
	
		
			
				|  |  |             data.put("immunemembers","");//免疫关系
 | 
	
		
			
				|  |  |             data.put("immunemembers",immrs);//免疫关系
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |             return write(200, "查询成功", "data", data);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
	
		
			
				|  | @ -462,31 +475,67 @@ public class FamilyMemberController extends WeixinBaseController {
 | 
	
		
			
				|  |  |         return write(200,loginPassword);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 免疫接种相关接口==============================START===============================
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/addImmuneMenberByBarCode", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "根据儿童编码绑定家人免疫关系")
 | 
	
		
			
				|  |  |     public String addImmuneMenberByBarCode(@ApiParam(name = "barCode", value = "条形编码", defaultValue = "")
 | 
	
		
			
				|  |  |                                         @RequestParam(value = "barCode", required = true) String barCode){
 | 
	
		
			
				|  |  |     public String addImmuneMenberByBarCode(@ApiParam(name = "barCode", value = "新生儿条形编码", defaultValue = "")
 | 
	
		
			
				|  |  |                                            @RequestParam(value = "barCode", required = true) String barCode,
 | 
	
		
			
				|  |  |                                            @ApiParam(name = "idcard", value = "新生儿身份证号", defaultValue = "")
 | 
	
		
			
				|  |  |                                            @RequestParam(value = "idcard", required = true) String idcard,
 | 
	
		
			
				|  |  |                                            @ApiParam(name = "ssc", value = "新生儿条形编码", defaultValue = "")
 | 
	
		
			
				|  |  |                                            @RequestParam(value = "ssc", required = true) String ssc,
 | 
	
		
			
				|  |  |                                            @ApiParam(name = "relation", value = "1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他")
 | 
	
		
			
				|  |  |                                            @RequestParam(value = "relation", required = true) Integer relation){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |             ChildInfo childInfo  = childInfoService.getByBarCode(barCode);
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |             int result = 0;
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |             if(result==0){
 | 
	
		
			
				|  |  |                 return error(-1, "不能添加自己");
 | 
	
		
			
				|  |  |             }else if(result==-1){
 | 
	
		
			
				|  |  |                 return error(-1, "居民信息查询失败");
 | 
	
		
			
				|  |  |             }else if(result==-2){
 | 
	
		
			
				|  |  |                 return error(-1, "该成员未注册");
 | 
	
		
			
				|  |  |             }else if (result == -4) {
 | 
	
		
			
				|  |  |                 return error(-1, "该家庭成员已存在");
 | 
	
		
			
				|  |  |             }else if(result==-5){
 | 
	
		
			
				|  |  |                 return error(-1, "该家庭关系已存在成员");
 | 
	
		
			
				|  |  |             }else if(result ==2) {
 | 
	
		
			
				|  |  |                 return write(200, "拒绝成功");
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 return write(200, "添加成功");
 | 
	
		
			
				|  |  |             if(!idcard.equals(childInfo.getIdcard()) && StringUtils.isNotBlank(childInfo.getIdcard())){
 | 
	
		
			
				|  |  |                 return error(-1, "新生儿身份证信息不一致,无法绑定");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |             if(!ssc.equals(childInfo.getSsc()) && StringUtils.isNotBlank(childInfo.getSsc())){
 | 
	
		
			
				|  |  |                 return error(-1, "新生儿身份证信息不一致,无法绑定");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |             childFamilyImmuneService.addFamilyMembers(childInfo,getRepUID(),idcard,ssc,relation);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |             return write(200,"绑定成功!");
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, "绑定失败!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/modifyImmuneMenberByBarCode", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "修改儿童免疫关系的身份证号和医保卡号")
 | 
	
		
			
				|  |  |     public String modifyImmuneMenberByBarCode(@ApiParam(name = "barCode", value = "新生儿条形编码", defaultValue = "")
 | 
	
		
			
				|  |  |                                            @RequestParam(value = "barCode", required = true) String barCode,
 | 
	
		
			
				|  |  |                                            @ApiParam(name = "idcard", value = "新生儿身份证号", defaultValue = "")
 | 
	
		
			
				|  |  |                                            @RequestParam(value = "idcard", required = true) String idcard,
 | 
	
		
			
				|  |  |                                            @ApiParam(name = "ssc", value = "新生儿条形编码", defaultValue = "")
 | 
	
		
			
				|  |  |                                            @RequestParam(value = "ssc", required = true) String ssc){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |             childInfoService.modifyImmuneMenberByBarCode(barCode,ssc,idcard);
 | 
	
		
			
				|  |  |             return write(200,"修改成功!");
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, "修改失败!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/getImmChildInfo", method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "根据新生儿编码获取新生儿基础信息")
 | 
	
		
			
				|  |  |     public String getImmChildInfo(@ApiParam(name = "code", value = "新生儿CODE", defaultValue = "")
 | 
	
		
			
				|  |  |                                   @RequestParam(value = "code", required = true) String code){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |             ChildInfo childInfo = childInfoService.getChildInfoByCode(code);
 | 
	
		
			
				|  |  |             return write(200,"查询成功!","data",childInfo);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             return error(-1, "绑定失败");
 | 
	
		
			
				|  |  |             return error(-1, "查询失败!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |