Commit d63833b230b52f15d792cdbb3e1606063b27f32f

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 19 changed files

platform-biz-service/src/main/resources/mainOrm/master/MeasureInfoMapper.xml View file @ d63833b
... ... @@ -15,6 +15,7 @@
15 15 <result column="vc_card_no" property="vcCardNo"/>
16 16 <result column="value_one" property="valueOne"/>
17 17 <result column="value_two" property="valueTwo"/>
  18 + <result column="value_three" property="valueThree"/>
18 19 <result column="value_type" property="valueType"/>
19 20 <result column="record_time" property="recordTime"/>
20 21 <result column="wx_code" property="wxCode"/>
21 22  
22 23  
23 24  
... ... @@ -23,25 +24,26 @@
23 24 <result column="hospital_id" property="hospitalId"/>
24 25 <result column="created" property="created"/>
25 26 <result column="modified" property="modified"/>
  27 + <result column="today_count" property="todayCount"/>
26 28 </resultMap>
27 29  
28 30 <insert id="addMeasureInfo" parameterType="com.lyms.platform.pojo.MeasureInfoModel" >
29 31 INSERT INTO measure_info(user_name,cert_type,
30 32 cert_no,age,phone,sex,vc_card_no,
31   - value_one,value_two,value_type,record_time,wx_code
32   - ,record_count,open_id,created,modified,hospital_id)
  33 + value_one,value_two,value_three,value_type,record_time,wx_code
  34 + ,record_count,open_id,created,modified,hospital_id,today_count)
33 35 VALUES (#{userName},#{certType},
34 36 #{certNo},#{age},#{phone},#{sex}
35 37 ,#{vcCardNo},#{valueOne}
36   - ,#{valueTwo},#{valueType},#{recordTime},
37   - #{wxCode},#{recordCount},#{openId},#{created},#{modified},#{hospitalId})
  38 + ,#{valueTwo},#{valueThree},#{valueType},#{recordTime},
  39 + #{wxCode},#{recordCount},#{openId},#{created},#{modified},#{hospitalId},#{todayCount})
38 40 </insert>
39 41  
40 42 <select id="queryMeasureInfoList" parameterType="com.lyms.platform.query.MeasureInfoQuery" resultMap="measureInfoModelMap">
41 43 SELECT id,user_name,cert_type,
42 44 cert_no,age,phone,sex,vc_card_no,
43   - value_one,value_two,value_type,record_time,wx_code
44   - ,record_count,open_id,created,modified,hospital_id
  45 + value_one,value_two,value_three,value_type,record_time,wx_code
  46 + ,record_count,open_id,created,modified,hospital_id,today_count
45 47 FROM measure_info
46 48  
47 49 <include refid="queryMeasureInfoCondition"/>
48 50  
49 51  
50 52  
... ... @@ -64,22 +66,22 @@
64 66 <if test="userName != null">
65 67 user_name = #{userName,jdbcType=VARCHAR},
66 68 </if>
67   - <if test="certType != null and certType != ''">
  69 + <if test="certType != null">
68 70 cert_type = #{certType,jdbcType=VARCHAR},
69 71 </if>
70   - <if test="certNo != null and certNo != ''">
  72 + <if test="certNo != null">
71 73 cert_no = #{certNo,jdbcType=VARCHAR},
72 74 </if>
73 75 <if test="age != null and age >= 0">
74 76 age = #{age,jdbcType=INTEGER},
75 77 </if>
76   - <if test="phone != null and phone != ''">
  78 + <if test="phone != null">
77 79 phone = #{phone,jdbcType=VARCHAR},
78 80 </if>
79 81 <if test="sex != null">
80 82 sex = #{sex,jdbcType=INTEGER},
81 83 </if>
82   - <if test="vcCardNo != null and vcCardNo != ''">
  84 + <if test="vcCardNo != null">
83 85 vc_card_no = #{vcCardNo,jdbcType=VARCHAR},
84 86 </if>
85 87 <if test="valueOne != null and valueOne != ''">
... ... @@ -88,6 +90,9 @@
88 90 <if test="valueTwo != null and valueTwo != ''">
89 91 value_two = #{valueTwo,jdbcType=VARCHAR},
90 92 </if>
  93 + <if test="valueThree != null and valueThree != ''">
  94 + value_three = #{valueThree,jdbcType=VARCHAR},
  95 + </if>
91 96 <if test="valueType != null and valueType > 0">
92 97 value_type = #{valueType,jdbcType=INTEGER},
93 98 </if>
... ... @@ -112,6 +117,9 @@
112 117 <if test="modified != null">
113 118 modified = #{modified},
114 119 </if>
  120 + <if test="todayCount != null and todayCount > 0">
  121 + today_count = #{todayCount,jdbcType=INTEGER},
  122 + </if>
115 123 </set>
116 124 where id = #{id,jdbcType=INTEGER}
117 125 </update>
... ... @@ -160,6 +168,9 @@
160 168 <if test="valueTwo != null and valueTwo != ''">
161 169 and value_two = #{valueTwo,jdbcType=VARCHAR}
162 170 </if>
  171 + <if test="valueThree != null and valueThree != ''">
  172 + and value_three = #{valueThree,jdbcType=VARCHAR}
  173 + </if>
163 174 <if test="valueType != null and valueType > 0">
164 175 and value_type = #{valueType,jdbcType=INTEGER}
165 176 </if>
... ... @@ -195,6 +206,9 @@
195 206 <foreach collection="hospitalIds" index="index" item="item" open="(" separator="," close=")">
196 207 #{item}
197 208 </foreach>
  209 + </if>
  210 + <if test="todayCount != null and todayCount > 0">
  211 + today_count = #{todayCount,jdbcType=INTEGER},
198 212 </if>
199 213 </where>
200 214 </sql>
platform-common/src/main/java/com/lyms/platform/common/enums/FmTypeEnums.java View file @ d63833b
... ... @@ -41,6 +41,16 @@
41 41 return null;
42 42 }
43 43  
  44 + public static String getFmNameById2(String id)
  45 + {
  46 + for (FmTypeEnums e : FmTypeEnums.values()) {
  47 + if (e.getId().equals(id))
  48 + {
  49 + return e.getName();
  50 + }
  51 + }
  52 + return "--";
  53 + }
44 54  
45 55 public static String getFmScNameById(String id)
46 56 {
platform-common/src/main/java/com/lyms/platform/common/enums/SmsServiceEnums.java View file @ d63833b
... ... @@ -35,7 +35,7 @@
35 35 QT(21,"其他",0,""),
36 36 JRWH(22,"节日问候",21,"0,1,2,3"),
37 37 YQTX(23,"疫情提醒",21,"0,1,2,3"),
38   - EBYMTX(24,"儿保疫苗提醒",14,"2");
  38 + EBYMTX(24,"疫苗接种提醒",14,"2");
39 39  
40 40 private SmsServiceEnums(int id,String name,int pid,String serviceObj){
41 41 this.id = id;
platform-common/src/main/java/com/lyms/platform/common/enums/WxTempleteIdEnums.java View file @ d63833b
... ... @@ -13,6 +13,7 @@
13 13  
14 14 CHAN_JIAN_TI_XING("EngJ9RKaHaPEEc2GapV6dJO-uu8rkqitEQd21yc4EPY","产检提醒"), //产检预约提醒
15 15 ER_TONG_TI_XING("9BUY6THL261MmbVRb9iPZANQwJ5yKNzkE1VGCLPuI94","儿童月龄提醒"), //儿保预约提醒
  16 + ER_TONG_YI_MIAO_TIXING("IDcR8sCa12kNj_Bn3LMcx9vk_dUMlLClPdNFOUm9VRtqE","疫苗接种提醒"), //疫苗接种提醒
16 17 CHAN_HOU_FU_CHA("jEbeeBKyjcquhFWUUndnRddLqLbK8-QF6yA98cYW_E8","产后复查"),//产后预约和产后复查
17 18  
18 19 GAO_WEI_ZHI_DAO("n6fSC1wYc3jOfGmuI1Vtbut6TlaBPlt5482SqJ8CE4o","高危提醒"),//孕妇高危
platform-dal/src/main/java/com/lyms/platform/pojo/MeasureInfoModel.java View file @ d63833b
... ... @@ -25,6 +25,10 @@
25 25 private String valueOne;
26 26 //脉搏/身高
27 27 private String valueTwo;
  28 +
  29 + //体重测量存BMI值
  30 + private String valueThree;
  31 +
28 32 //值类型: 1 体重和身高 2 血压和脉搏
29 33 private Integer valueType;
30 34 //记录时间
... ... @@ -47,6 +51,25 @@
47 51 private String phone;
48 52  
49 53 private Integer age;
  54 +
  55 + //当天记录次数
  56 + private Integer todayCount;
  57 +
  58 + public String getValueThree() {
  59 + return valueThree;
  60 + }
  61 +
  62 + public void setValueThree(String valueThree) {
  63 + this.valueThree = valueThree;
  64 + }
  65 +
  66 + public Integer getTodayCount() {
  67 + return todayCount;
  68 + }
  69 +
  70 + public void setTodayCount(Integer todayCount) {
  71 + this.todayCount = todayCount;
  72 + }
50 73  
51 74 public String getPhone() {
52 75 return phone;
platform-dal/src/main/java/com/lyms/platform/query/MeasureInfoQuery.java View file @ d63833b
... ... @@ -39,6 +39,9 @@
39 39  
40 40 //脉搏/身高
41 41 private String valueTwo;
  42 +
  43 + //体重测量存BMI值
  44 + private String valueThree;
42 45 //值类型: 1 体重、身高 2 血压和脉搏
43 46 private Integer valueType;
44 47 //记录时间
45 48  
... ... @@ -61,8 +64,10 @@
61 64  
62 65 private Date recordTime;
63 66  
  67 + private Integer todayCount;
64 68  
65 69  
  70 +
66 71 @Override
67 72 public MongoQuery convertToQuery() {
68 73 MongoCondition condition = MongoCondition.newInstance();
... ... @@ -145,6 +150,21 @@
145 150 return condition.toMongoQuery();
146 151 }
147 152  
  153 + public String getValueThree() {
  154 + return valueThree;
  155 + }
  156 +
  157 + public void setValueThree(String valueThree) {
  158 + this.valueThree = valueThree;
  159 + }
  160 +
  161 + public Integer getTodayCount() {
  162 + return todayCount;
  163 + }
  164 +
  165 + public void setTodayCount(Integer todayCount) {
  166 + this.todayCount = todayCount;
  167 + }
148 168  
149 169 public Date getRecordTime() {
150 170 return recordTime;
platform-msg-generate/src/main/java/com/lyms/platform/msg/utils/HelperUtils.java View file @ d63833b
... ... @@ -372,6 +372,23 @@
372 372 }
373 373  
374 374  
375   -
  375 + /**
  376 + * #疫苗名称#
  377 + * 获取疫苗中的名称
  378 + * @param content
  379 + * @return
  380 + */
  381 + public static String getVaccineName(String content) {
  382 + try {
  383 + if (StringUtils.isNotEmpty(content))
  384 + {
  385 + return content.substring(content.indexOf("#")+1, content.lastIndexOf("#"));
  386 + }
  387 + }catch (Exception e)
  388 + {
  389 + return "";
  390 + }
  391 + return "";
  392 + }
376 393 }
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java View file @ d63833b
... ... @@ -396,9 +396,147 @@
396 396 }
397 397 }
398 398 }
  399 + //疫苗接种提醒
  400 + else if (smsType == SmsServiceEnums.EBYMTX.getId())
  401 + {
  402 + //发送频次
  403 + Integer sendFreq = template.getSendFrequency();
399 404  
  405 + if (sendFreq == SendFrequencyEnums.ONCE.getId())
  406 + {
400 407  
  408 + //GL(0,"公历","0,1,2","0,1,2,3"),NL(1,"农历","0,1,2","0,1,2,3"),TSRQ(2,"特殊日期","0,2","1,2,3"),SLRQ(3,"生理日期","0","1,2,3");
  409 + Integer sendDateType = template.getSendDateType();
  410 + if (sendDateType == SendDateEnums.SLRQ.getId())
  411 + {
401 412  
  413 + //时间类型
  414 + Integer specialDateType = template.getSpecialDateType();
  415 +
  416 + //儿童天数
  417 + if (specialDateType == SpecialDateEnums.ETTS.getId())
  418 + {
  419 +
  420 + //发送短信集合
  421 + MsgListRequest list = new MsgListRequest();
  422 + List<MsgRequest> messages = new ArrayList<>();
  423 +
  424 + Integer start = template.getStart();
  425 + Integer end = template.getEnd();
  426 +
  427 + if (start != null && end != null)
  428 + {
  429 + Date startDate = DateUtils.getNewDate(new Date(),-end, "天", sendTimeType);
  430 + Date endDate = DateUtils.getNewDate(new Date(),-start,"天",sendTimeType);
  431 + startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D);
  432 + endDate = DateUtils.formatDate(endDate,DateUtils.Y_M_D);
  433 + babyModelQuery.setBirthStart(startDate);
  434 + babyModelQuery.setBirthEnd(endDate);
  435 +
  436 + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
  437 + if (CollectionUtils.isNotEmpty(babyModels))
  438 + {
  439 + for (BabyModel model : babyModels)
  440 + {
  441 + if (model.getBirth() == null)
  442 + {
  443 + continue;
  444 + }
  445 + if (HelperUtils.isExistMsg(model.getId(), template.getId()))
  446 + {
  447 + continue;
  448 + }
  449 +
  450 + //短信前缀
  451 + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId());
  452 + String messageContent = "【"+messagePrefix+"】"+template.getContent();
  453 + messageContent = HelperUtils.replaceName(model.getName(), messageContent);
  454 +
  455 + //接种时间
  456 + String vaccineTime = start+"天";
  457 + //疫苗名称
  458 + String vaccineName = HelperUtils.getVaccineName(template.getContent());
  459 + //疫苗接种人
  460 + String vaccinePerson = model.getName();
  461 +
  462 + MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(),
  463 + ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(),
  464 + model.getHospitalId(), template.getId(), model.getId(), vaccineName, vaccinePerson, vaccineTime,
  465 + WxTempleteIdEnums.ER_TONG_YI_MIAO_TIXING.getId(),service);
  466 +
  467 + messages.add(request);
  468 +
  469 + }
  470 + }
  471 + }
  472 +
  473 + list.setMessages(messages);
  474 + HelperUtils.sendMsg(list);
  475 + }
  476 + //儿童月龄
  477 + else if (specialDateType == SpecialDateEnums.ETYL.getId())
  478 + {
  479 +
  480 + //发送短信集合
  481 + MsgListRequest list = new MsgListRequest();
  482 + List<MsgRequest> messages = new ArrayList<>();
  483 +
  484 + Integer start = template.getStart();
  485 + Integer end = template.getEnd();
  486 +
  487 + if (start != null && end != null)
  488 + {
  489 + Date startDate = DateUtils.getNewDate(new Date(),-end-1, "月", sendTimeType);
  490 + Date endDate = DateUtils.getNewDate(new Date(),-start,"月",sendTimeType);
  491 + startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D);
  492 + endDate = DateUtils.formatDate(endDate,DateUtils.Y_M_D);
  493 + babyModelQuery.setBirthStart(startDate);
  494 + babyModelQuery.setBirthEnd(endDate);
  495 +
  496 + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
  497 + if (CollectionUtils.isNotEmpty(babyModels))
  498 + {
  499 + for (BabyModel model : babyModels)
  500 + {
  501 + if (model.getBirth() == null)
  502 + {
  503 + continue;
  504 + }
  505 +
  506 + if (HelperUtils.isExistMsg(model.getId(),template.getId()))
  507 + {
  508 + continue;
  509 + }
  510 +
  511 + //短信前缀
  512 + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId());
  513 + String messageContent = "【"+messagePrefix+"】"+template.getContent();
  514 + messageContent = HelperUtils.replaceName(model.getName(), messageContent);
  515 +
  516 + //疫苗名称
  517 + String vaccineName = HelperUtils.getVaccineName(template.getContent());
  518 + //疫苗接种人
  519 + String vaccinePerson = model.getName();
  520 + //接种时间
  521 + String vaccineTime = start+ "月龄";
  522 +
  523 +
  524 + MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(),
  525 + ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(),
  526 + model.getHospitalId(), template.getId(), model.getId(), vaccineName, vaccinePerson, vaccineTime,
  527 + WxTempleteIdEnums.ER_TONG_YI_MIAO_TIXING.getId(),service);
  528 + messages.add(request);
  529 +
  530 + }
  531 + }
  532 + }
  533 +
  534 + list.setMessages(messages);
  535 + HelperUtils.sendMsg(list);
  536 + }
  537 + }
  538 + }
  539 + }
402 540 }
403 541  
404 542  
platform-operate-api/src/main/java/com/lyms/hospitalapi/dzfy/Fm.java View file @ d63833b
... ... @@ -87,6 +87,16 @@
87 87 private String SBABY_WEIGHT;
88 88 private String SBABY_HEIGHT;
89 89  
  90 + private String Vision; //用来判断区域环境分娩调用选择
  91 +
  92 + public String getVision() {
  93 + return Vision;
  94 + }
  95 +
  96 + public void setVision(String vision) {
  97 + Vision = vision;
  98 + }
  99 +
90 100 public String getSFETUS_NUM() {
91 101 return SFETUS_NUM;
92 102 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/FmController.java View file @ d63833b
... ... @@ -27,7 +27,10 @@
27 27 public String saveFmData(@RequestBody List<Fm> models,
28 28 HttpServletRequest httpServletRequest){
29 29  
30   - lpfyFmService.queryFmPatient(models);
  30 + if("17".equals(models.get(0).getVision())){
  31 + lpfyFmService.queryFmPatient(models);
  32 + }
  33 +
31 34  
32 35 return null;
33 36 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MeasureInfoController.java View file @ d63833b
... ... @@ -12,6 +12,7 @@
12 12 import org.springframework.web.bind.annotation.*;
13 13  
14 14 import javax.servlet.http.HttpServletRequest;
  15 +import java.util.Date;
15 16  
16 17 /**
17 18 * 测量血糖和脉搏、身高和体重的值
... ... @@ -52,7 +53,87 @@
52 53 */
53 54 @RequestMapping(method = RequestMethod.POST, value = "/addMeasureInfo")
54 55 @ResponseBody
55   - public BaseResponse addMeasureInfo(MeasureInfoRequest measureInfoRequest, HttpServletRequest request) {
  56 + public Object addMeasureInfo(MeasureInfoRequest measureInfoRequest, HttpServletRequest request) {
  57 + return measureInfoFacade.addMeasureInfo(measureInfoRequest);
  58 + }
  59 +
  60 + /**
  61 + * 添加血压和脉搏信息
  62 + * @param request
  63 + * @return
  64 + */
  65 + @RequestMapping(method = RequestMethod.GET, value = "/addXueYaInfo")
  66 + @ResponseBody
  67 + public Object addXueYaInfo(
  68 + @RequestParam(value = "userName", required = false) String userName,
  69 + @RequestParam(value = "certType", required = false) String certType,
  70 + @RequestParam(value = "certNo", required = false) String certNo,
  71 + @RequestParam(value = "sex", required = false) Integer sex,
  72 + @RequestParam(value = "vcCardNo", required = false) String vcCardNo,
  73 + @RequestParam(value = "valueOne", required = false) String valueOne,
  74 + @RequestParam(value = "valueTwo", required = false) String valueTwo,
  75 + @RequestParam(value = "wxCode", required = false) String wxCode,
  76 + @RequestParam(value = "hospitalId", required = false) String hospitalId,
  77 + @RequestParam(value = "age", required = false) Integer age,
  78 + @RequestParam(value = "phone", required = false) String phone,
  79 + HttpServletRequest request) {
  80 + MeasureInfoRequest measureInfoRequest = new MeasureInfoRequest();
  81 + measureInfoRequest.setUserName(userName);
  82 + measureInfoRequest.setCertType(certType);
  83 + measureInfoRequest.setCertNo(certNo);
  84 + measureInfoRequest.setHospitalId(hospitalId);
  85 + measureInfoRequest.setVcCardNo(vcCardNo);
  86 + measureInfoRequest.setValueOne(valueOne);
  87 + measureInfoRequest.setValueTwo(valueTwo);
  88 + measureInfoRequest.setWxCode(wxCode);
  89 + measureInfoRequest.setAge(age);
  90 + measureInfoRequest.setPhone(phone);
  91 + measureInfoRequest.setSex(sex);
  92 + measureInfoRequest.setRecordTime(new Date().getTime());
  93 + measureInfoRequest.setRecordCount(1);
  94 + measureInfoRequest.setValueType(2);
  95 + System.out.println(" 添加血压和脉搏请求参数:"+measureInfoRequest.toString());
  96 + return measureInfoFacade.addMeasureInfo(measureInfoRequest);
  97 + }
  98 +
  99 + /**
  100 + * 体重和身高
  101 + * @param request
  102 + * @return
  103 + */
  104 + @RequestMapping(method = RequestMethod.GET, value = "/addTzSgInfo")
  105 + @ResponseBody
  106 + public Object addTzSgInfo(
  107 + @RequestParam(value = "userName", required = false) String userName,
  108 + @RequestParam(value = "certType", required = false) String certType,
  109 + @RequestParam(value = "certNo", required = false) String certNo,
  110 + @RequestParam(value = "sex", required = false) Integer sex,
  111 + @RequestParam(value = "vcCardNo", required = false) String vcCardNo,
  112 + @RequestParam(value = "valueOne", required = false) String valueOne,
  113 + @RequestParam(value = "valueTwo", required = false) String valueTwo,
  114 + @RequestParam(value = "valueThree", required = false) String valueThree,
  115 + @RequestParam(value = "wxCode", required = false) String wxCode,
  116 + @RequestParam(value = "hospitalId", required = false) String hospitalId,
  117 + @RequestParam(value = "age", required = false) Integer age,
  118 + @RequestParam(value = "phone", required = false) String phone,
  119 + HttpServletRequest request) {
  120 + MeasureInfoRequest measureInfoRequest = new MeasureInfoRequest();
  121 + measureInfoRequest.setUserName(userName);
  122 + measureInfoRequest.setCertType(certType);
  123 + measureInfoRequest.setCertNo(certNo);
  124 + measureInfoRequest.setHospitalId(hospitalId);
  125 + measureInfoRequest.setVcCardNo(vcCardNo);
  126 + measureInfoRequest.setValueOne(valueOne);
  127 + measureInfoRequest.setValueTwo(valueTwo);
  128 + measureInfoRequest.setValueThree(valueThree);
  129 + measureInfoRequest.setWxCode(wxCode);
  130 + measureInfoRequest.setAge(age);
  131 + measureInfoRequest.setPhone(phone);
  132 + measureInfoRequest.setSex(sex);
  133 + measureInfoRequest.setRecordTime(new Date().getTime());
  134 + measureInfoRequest.setRecordCount(1);
  135 + measureInfoRequest.setValueType(1);
  136 + System.out.println("添加体重和身高请求参数:"+measureInfoRequest.toString());
56 137 return measureInfoFacade.addMeasureInfo(measureInfoRequest);
57 138 }
58 139  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnantBuildController.java View file @ d63833b
... ... @@ -60,15 +60,16 @@
60 60  
61 61 /**
62 62 * 查询孕妇是否有建档记录 有就返回patientid
63   - *
  63 + *valueType 1体重身高 2、血压和脉搏
64 64 * @return
65 65 */
66 66 @RequestMapping(value = "/getPatientBuildId", method = RequestMethod.GET)
67 67 @ResponseBody
68 68 public String getPatientBuildId(@RequestParam(required = true) String certType,
69 69 @RequestParam(required = true) String certNo,
70   - @RequestParam(required = true) String hospitalId) {
71   - return bookbuildingFacade.getPatientBuildId(certType,certNo,hospitalId);
  70 + @RequestParam(required = true) String hospitalId,
  71 + @RequestParam(required = true) Integer valueType) {
  72 + return bookbuildingFacade.getPatientBuildId(certType,certNo,hospitalId,valueType);
72 73 }
73 74  
74 75 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java View file @ d63833b
... ... @@ -10,6 +10,7 @@
10 10 import org.springframework.web.bind.annotation.*;
11 11  
12 12 import javax.servlet.http.HttpServletRequest;
  13 +import javax.servlet.http.HttpServletResponse;
13 14 import java.util.Date;
14 15  
15 16 /**
... ... @@ -54,6 +55,12 @@
54 55 @RequestMapping(method = RequestMethod.GET)
55 56 public BaseResponse list(String provinceId, String cityId, String areaId, String streetId, String key, @RequestParam Integer trackType, @RequestParam Integer page, @RequestParam Integer limit, HttpServletRequest request) {
56 57 return trackDownService.list(provinceId, cityId, areaId, streetId, key, trackType, page, limit, getUserId(request));
  58 + }
  59 +
  60 + @TokenRequired
  61 + @RequestMapping(value = "/export", method = RequestMethod.GET)
  62 + public void export(String provinceId, String cityId, String areaId, String streetId, String key, @RequestParam Integer trackType, HttpServletRequest request, HttpServletResponse response) {
  63 + trackDownService.export(provinceId, cityId, areaId, streetId, key, trackType, getUserId(request), response);
57 64 }
58 65  
59 66 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ d63833b
... ... @@ -34,6 +34,9 @@
34 34 import org.slf4j.LoggerFactory;
35 35 import org.springframework.beans.factory.annotation.Autowired;
36 36 import org.springframework.data.domain.Sort;
  37 +import org.springframework.data.mongodb.core.MongoTemplate;
  38 +import org.springframework.data.mongodb.core.query.Criteria;
  39 +import org.springframework.data.mongodb.core.query.Query;
37 40 import org.springframework.stereotype.Component;
38 41  
39 42 import javax.servlet.http.HttpServletResponse;
... ... @@ -134,6 +137,9 @@
134 137 @Autowired
135 138 private PatientServiceFacade patientServiceFacade;
136 139  
  140 + @Autowired
  141 + private MongoTemplate mongoTemplate;
  142 +
137 143 /**
138 144 * 根据患者的建档ID,查询还未使用的免费产检查券
139 145 *
... ... @@ -1865,7 +1871,7 @@
1865 1871 }
1866 1872  
1867 1873  
1868   - public String getPatientBuildId(String certType, String certNo,String hospitalId) {
  1874 + public String getPatientBuildId(String certType, String certNo,String hospitalId,Integer valueType) {
1869 1875 PatientsQuery patientsQuery = new PatientsQuery();
1870 1876 patientsQuery.setCardNo(certNo);
1871 1877 patientsQuery.setPcerteTypeId(certType);
... ... @@ -1876,6 +1882,18 @@
1876 1882 if (CollectionUtils.isNotEmpty(patients))
1877 1883 {
1878 1884 patientId = patients.get(0).getId();
  1885 + if (valueType == 1)
  1886 + {
  1887 + PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patients.get(0).getPid())), PatientWeight.class);
  1888 + if (pw == null)
  1889 + {
  1890 + patientId = "";
  1891 + }
  1892 + else
  1893 + {
  1894 + patientId = pw.getPatientId();
  1895 + }
  1896 + }
1879 1897 }
1880 1898 return patientId;
1881 1899 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java View file @ d63833b
... ... @@ -41,6 +41,8 @@
41 41 @Autowired
42 42 private BasicConfigService basicConfigService;
43 43  
  44 + private static final Integer MAX_TODAY_COUNT = 5;
  45 +
44 46 public BaseListResponse queryMeasureInfoList(String queryNo,
45 47 Integer valueType, String vcCardNo,
46 48 String recordTime, Integer age,
... ... @@ -136,17 +138,64 @@
136 138 return objectResponse;
137 139 }
138 140  
139   - public BaseResponse addMeasureInfo(MeasureInfoRequest measureInfoRequest) {
140   -
141   - MeasureInfoModel model = getModel(measureInfoRequest);
142   - model.setCreated(new Date());
143   - model.setModified(new Date());
144   -
145   - mysqlMeasureInfoService.addMeasureInfo(model);
146   - BaseResponse objectResponse = new BaseResponse();
147   - objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
148   - objectResponse.setErrormsg("成功");
149   - return objectResponse;
  141 + public Object addMeasureInfo(MeasureInfoRequest measureInfoRequest) {
  142 + //今天测量次数
  143 + Integer todayCount = 0;
  144 + Map<String,String> map = new HashMap<>();
  145 + try {
  146 + MeasureInfoModel model = getModel(measureInfoRequest);
  147 + MeasureInfoQuery query = new MeasureInfoQuery();
  148 + query.setCertNo(measureInfoRequest.getCertNo());
  149 + query.setCertType(measureInfoRequest.getCertType());
  150 + query.setValueType(measureInfoRequest.getValueType());
  151 + List<MeasureInfoModel> list = mysqlMeasureInfoService.queryMeasureInfoList(query);
  152 + if (CollectionUtils.isNotEmpty(list))
  153 + {
  154 + MeasureInfoModel measureInfoModel = list.get(0);
  155 + if (DateUtil.getyyyy_MM_dd(measureInfoModel.getRecordTime()).equals(DateUtil.getyyyy_MM_dd(new Date())))
  156 + {
  157 + todayCount = measureInfoModel.getTodayCount()+1;
  158 + if (todayCount > MAX_TODAY_COUNT)
  159 + {
  160 + map.put("errorcode", String.valueOf(ErrorCodeConstants.SUCCESS));
  161 + map.put("errormsg", "对不起,每天最多可以测量5次,请明天再来吧!");
  162 +// map.put("errormsg", measureInfoRequest.getValueType() == 1
  163 +// ? "今日测量体重和身高次数已经使用完了!" : "今日测量血压和脉搏次数已经使用完了!");
  164 + return map;
  165 + }
  166 + model.setTodayCount(todayCount);
  167 + }
  168 + else
  169 + {
  170 + todayCount = 1;
  171 + model.setTodayCount(todayCount);
  172 + }
  173 + model.setRecordTime(new Date());
  174 + model.setModified(new Date());
  175 + model.setId(measureInfoModel.getId());
  176 + model.setRecordCount(measureInfoModel.getRecordCount()+1);
  177 + mysqlMeasureInfoService.updateMeasureInfo(model);
  178 + }
  179 + else
  180 + {
  181 + todayCount = 1;
  182 + model.setCreated(new Date());
  183 + model.setModified(new Date());
  184 + model.setTodayCount(todayCount);
  185 + mysqlMeasureInfoService.addMeasureInfo(model);
  186 + }
  187 + }
  188 + catch (Exception e)
  189 + {
  190 + map.put("errorcode", String.valueOf(ErrorCodeConstants.SYSTEM_ERROR));
  191 + map.put("errormsg","发生错误了,请稍后重试!");
  192 + return map;
  193 + }
  194 + Integer count = MAX_TODAY_COUNT - todayCount;
  195 + map.put("errorcode", String.valueOf(ErrorCodeConstants.SUCCESS));
  196 + map.put("errormsg", measureInfoRequest.getValueType() == 1
  197 + ? "信息记录成功,今天您还可以测量"+count+"次体重和身高" : "信息记录成功,今天您还可以测量"+count+"次血压和脉搏");
  198 + return map;
150 199 }
151 200  
152 201 public BaseResponse updateMeasureInfo(MeasureInfoRequest measureInfoRequest) {
... ... @@ -154,6 +203,7 @@
154 203 MeasureInfoQuery query = new MeasureInfoQuery();
155 204 query.setCertNo(measureInfoRequest.getCertNo());
156 205 query.setCertType(measureInfoRequest.getCertType());
  206 + query.setValueType(measureInfoRequest.getValueType());
157 207 List<MeasureInfoModel> list = mysqlMeasureInfoService.queryMeasureInfoList(query);
158 208 if (CollectionUtils.isNotEmpty(list))
159 209 {
160 210  
161 211  
... ... @@ -183,14 +233,15 @@
183 233 model.setHospitalId(measureInfoRequest.getHospitalId());
184 234 model.setOpenId(measureInfoRequest.getOpenId());
185 235 model.setRecordCount(measureInfoRequest.getRecordCount());
186   - model.setRecordTime(DateUtil.parseYMDHMS(measureInfoRequest.getRecordTime()));
  236 + model.setRecordTime(new Date(measureInfoRequest.getRecordTime()));
187 237 model.setSex(measureInfoRequest.getSex());
  238 + model.setValueThree(measureInfoRequest.getValueThree());
188 239 model.setAge(measureInfoRequest.getAge());
189 240 model.setValueOne(measureInfoRequest.getValueOne());
190 241 model.setValueTwo(measureInfoRequest.getValueTwo());
191 242 model.setValueType(measureInfoRequest.getValueType());
192 243 model.setVcCardNo(measureInfoRequest.getVcCardNo());
193   - model.setWxCode(measureInfoRequest.getWxXode());
  244 + model.setWxCode(measureInfoRequest.getWxCode());
194 245 model.setPhone(measureInfoRequest.getPhone());
195 246 return model;
196 247 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ d63833b
1 1 package com.lyms.platform.operate.web.facade;
2 2  
3   -import com.lyms.platform.beans.MsgListRequest;
4 3 import com.lyms.platform.beans.MsgRequest;
5 4 import com.lyms.platform.biz.service.*;
6 5 import com.lyms.platform.common.constants.ErrorCodeConstants;
... ... @@ -14,7 +13,6 @@
14 13 import com.lyms.platform.operate.web.request.*;
15 14 import com.lyms.platform.operate.web.result.*;
16 15 import com.lyms.platform.operate.web.utils.CommonsHelper;
17   -import com.lyms.platform.operate.web.utils.MessageCenterService;
18 16 import com.lyms.platform.operate.web.worker.QuanChanPatientWorker;
19 17 import com.lyms.platform.operate.web.worker.QuanPatientWorker;
20 18 import com.lyms.platform.operate.web.worker.WorkHR;
... ... @@ -1051,7 +1049,9 @@
1051 1049 patientManagerQueryModel.setpId(patients.getPid());
1052 1050 String dueWeek = "";
1053 1051 try {
1054   - if (patients.getBookbuildingDate().getTime() - patients.getDueDate().getTime() > 0 && patients.getBuildType() == 2) {
  1052 + // 徐倩说改的
  1053 + if (patients.getBookbuildingDate().getTime() - patients.getDueDate().getTime() > 0 && patients.getBuildType() == 2) {
  1054 +// if (patients.getBookbuildingDate().getTime() - patients.getFmDate().getTime() > 0 && patients.getBuildType() == 2) {
1055 1055 dueWeek = "已分娩";
1056 1056 } else {
1057 1057 int days = DateUtil.daysBetween(patients.getLastMenses(), patients.getBookbuildingDate());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/MeasureInfoRequest.java View file @ d63833b
... ... @@ -19,12 +19,14 @@
19 19 private String valueOne;
20 20 //脉搏/身高
21 21 private String valueTwo;
  22 + //体重测量存BMI值
  23 + private String valueThree;
22 24 //值类型: 1 体重和身高 2 血压和脉搏
23 25 private Integer valueType;
24 26 //记录时间
25   - private String recordTime;
  27 + private Long recordTime;
26 28 //微信号
27   - private String wxXode;
  29 + private String wxCode;
28 30 //记录总次数
29 31 private Integer recordCount;
30 32 //openId
... ... @@ -39,6 +41,14 @@
39 41 //手机号码
40 42 private String phone;
41 43  
  44 + public String getValueThree() {
  45 + return valueThree;
  46 + }
  47 +
  48 + public void setValueThree(String valueThree) {
  49 + this.valueThree = valueThree;
  50 + }
  51 +
42 52 public String getPhone() {
43 53 return phone;
44 54 }
45 55  
46 56  
47 57  
... ... @@ -119,20 +129,20 @@
119 129 this.valueType = valueType;
120 130 }
121 131  
122   - public String getRecordTime() {
  132 + public Long getRecordTime() {
123 133 return recordTime;
124 134 }
125 135  
126   - public void setRecordTime(String recordTime) {
  136 + public void setRecordTime(Long recordTime) {
127 137 this.recordTime = recordTime;
128 138 }
129 139  
130   - public String getWxXode() {
131   - return wxXode;
  140 + public String getWxCode() {
  141 + return wxCode;
132 142 }
133 143  
134   - public void setWxXode(String wxXode) {
135   - this.wxXode = wxXode;
  144 + public void setWxCode(String wxCode) {
  145 + this.wxCode = wxCode;
136 146 }
137 147  
138 148 public Integer getRecordCount() {
... ... @@ -158,5 +168,15 @@
158 168 public void setHospitalId(String hospitalId) {
159 169 this.hospitalId = hospitalId;
160 170 }
  171 +
  172 + @Override
  173 + public String toString() {
  174 + return "MeasureInfoRequest [userName=" + userName + ", certType=" + certType + ", certNo=" + certNo + ", sex="
  175 + + sex + ", vcCardNo=" + vcCardNo + ", valueOne=" + valueOne + ", valueTwo=" + valueTwo + ", valueType="
  176 + + valueType + ", recordTime=" + recordTime + ", wxCode=" + wxCode + ", recordCount=" + recordCount
  177 + + ", openId=" + openId + ", hospitalId=" + hospitalId + ", age=" + age + ", phone=" + phone + "]";
  178 + }
  179 +
  180 +
161 181 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/ITrackDownService.java View file @ d63833b
1 1 package com.lyms.platform.operate.web.service;
2 2  
3   -import com.lyms.platform.common.result.BaseResponse;
  3 +import com.lyms.platform.common.result.BaseObjectResponse;
4 4 import com.lyms.platform.pojo.TrackDown;
5 5  
  6 +import javax.servlet.http.HttpServletResponse;
6 7 import java.util.Date;
7 8  
8 9 public interface ITrackDownService extends IBaseService {
9 10  
10   - BaseResponse add(Integer userId, TrackDown trackDown);
  11 + BaseObjectResponse add(Integer userId, TrackDown trackDown);
11 12  
12   - BaseResponse list(String provinceId, String cityId, String areaId, String streetId, String key, Integer trackType, Integer page, Integer limit, Integer userId);
  13 + BaseObjectResponse list(String provinceId, String cityId, String areaId, String streetId, String key, Integer trackType, Integer page, Integer limit, Integer userId);
13 14  
14   - BaseResponse all(Date buildStart, Date buildEnd, Date checkStart, Date checkEnd, Date fmStart, Date fmEnd, String key, Integer page, Integer limit, Integer userId);
  15 + BaseObjectResponse all(Date buildStart, Date buildEnd, Date checkStart, Date checkEnd, Date fmStart, Date fmEnd, String key, Integer page, Integer limit, Integer userId);
15 16  
16   - BaseResponse info(String patientId, Integer trackType);
  17 + BaseObjectResponse info(String patientId, Integer trackType);
17 18  
18   - BaseResponse init();
  19 + BaseObjectResponse init();
19 20  
20   - BaseResponse mother(String parentId, Integer userId);
  21 + BaseObjectResponse mother(String parentId, Integer userId);
  22 +
  23 + void export(String provinceId, String cityId, String areaId, String streetId, String key, Integer trackType, Integer userId, HttpServletResponse response);
21 24 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java View file @ d63833b
... ... @@ -2,7 +2,8 @@
2 2  
3 3 import com.lyms.platform.biz.service.TrackDownService;
4 4 import com.lyms.platform.common.enums.*;
5   -import com.lyms.platform.common.result.BaseResponse;
  5 +import com.lyms.platform.common.result.BaseObjectResponse;
  6 +import com.lyms.platform.common.result.BaseObjectResponse;
6 7 import com.lyms.platform.common.result.PageResult;
7 8 import com.lyms.platform.common.result.RespBuilder;
8 9 import com.lyms.platform.common.utils.DateUtil;
... ... @@ -12,6 +13,7 @@
12 13 import com.lyms.platform.operate.web.service.ITrackDownService;
13 14 import com.lyms.platform.operate.web.utils.CollectionUtils;
14 15 import com.lyms.platform.operate.web.utils.MongoUtil;
  16 +import com.lyms.platform.operate.web.utils.ResponseUtil;
15 17 import com.lyms.platform.permission.dao.master.CouponMapper;
16 18 import com.lyms.platform.pojo.*;
17 19 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -21,6 +23,7 @@
21 23 import org.springframework.data.mongodb.core.query.Query;
22 24 import org.springframework.stereotype.Service;
23 25  
  26 +import javax.servlet.http.HttpServletResponse;
24 27 import java.util.*;
25 28  
26 29 @Service
... ... @@ -42,7 +45,7 @@
42 45 private CouponMapper couponMapper;
43 46  
44 47 @Override
45   - public BaseResponse all(Date buildStart, Date buildEnd, Date checkStart, Date checkEnd, Date fmStart, Date fmEnd, String key, Integer page, Integer limit, Integer userId) {
  48 + public BaseObjectResponse all(Date buildStart, Date buildEnd, Date checkStart, Date checkEnd, Date fmStart, Date fmEnd, String key, Integer page, Integer limit, Integer userId) {
46 49 String hospitalId = autoMatchFacade.getHospitalId(userId);
47 50 Criteria patientCriteria = new Criteria();
48 51 Criteria residentCriteria = new Criteria();
... ... @@ -173,7 +176,7 @@
173 176 return antexcCount + antexCount;
174 177 }
175 178  
176   - public BaseResponse add(Integer userId, TrackDown trackDown) {
  179 + public BaseObjectResponse add(Integer userId, TrackDown trackDown) {
177 180 String hospitalId = autoMatchFacade.getHospitalId(userId);
178 181 if(StringUtils.isNotEmpty(trackDown.getResidentsArchiveId())) { // 怀孕建档是lyms_resident
179 182 ResidentsArchiveModel archiveModel = mongoTemplate.findById(trackDown.getResidentsArchiveId(), ResidentsArchiveModel.class);
... ... @@ -198,7 +201,7 @@
198 201 }
199 202  
200 203 @Override
201   - public BaseResponse list(String provinceId, String cityId, String areaId, String streetId, String key, Integer trackType, Integer page, Integer limit, Integer userId) {
  204 + public BaseObjectResponse list(String provinceId, String cityId, String areaId, String streetId, String key, Integer trackType, Integer page, Integer limit, Integer userId) {
202 205 PageResult pageResult = null;
203 206 String hospitalId = autoMatchFacade.getHospitalId(userId);
204 207 Criteria patientCriteria = new Criteria();
205 208  
... ... @@ -280,9 +283,15 @@
280 283 temp.put("residenceAddress", mongoUtil.findAddressName(patient.getProvinceId(), patient.getCityId(), patient.getAreaId(), patient.getStreetId())); /** 居住地 */
281 284 temp.put("phone", StringUtils.encryPhone(patient.getPhone()));
282 285 temp.put("id", patient.getId());
  286 + temp.put("dueDate", DateUtil.getyyyy_MM_dd(patient.getDueDate()));
  287 + temp.put("week", DateUtil.getWeekDesc(patient.getLastMenses(), new Date())); /** 孕周 */
  288 + temp.put("cjDate", ""); /** 产检日期 */
  289 + temp.put("yycjDate", ""); /** 预约产检日期 */
  290 + temp.put("cjzfDate", ""); /** 产检追访时间 */
283 291 TrackDown trackDown = mongoTemplate.findOne(Query.query(Criteria.where("yn").is(1).and("parentId").is(patient.getId())).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
284 292 if(trackDown != null) {
285 293 temp.put("result", StringUtils.isEmpty(trackDown.getResult()) ? "--" : trackDown.getResult()); // 婚检追访结果
  294 + temp.put("result", getResultByType(trackType, patient.getId(), new Sort(Sort.Direction.DESC, "created"))); // 婚检追访结果
286 295 temp.put("trackDownTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getTrackDownDate())); // 追访时间
287 296 temp.put("yyTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getReservatDate())); // 预约时间
288 297 } else {
... ... @@ -290,6 +299,21 @@
290 299 temp.put("trackDownTime", "--"); // 追访时间
291 300 temp.put("yyTime", "--"); // 预约时间
292 301 }
  302 + if(trackType == TrackDownDateEnums.G.getId()) {// 产后复查
  303 + /** 复查次数 */
  304 + temp.put("fcNum", mongoTemplate.count(Query.query(Criteria.where("parentId").is(patient.getId()).and("trackDownDateType").is(TrackDownDateEnums.G.getId()).and("yn").is(1)), TrackDown.class));
  305 + temp.put("fmDate", DateUtil.getyyyy_MM_dd(patient.getFmDate()));
  306 + /** 初次复查日期 */
  307 + TrackDown t = mongoTemplate.findOne(Query.query(Criteria.where("yn").is(1).and("parentId").is(patient.getId()).and("trackDownDateType").is(7)).with(new Sort(Sort.Direction.ASC, "created")), TrackDown.class);
  308 + temp.put("ccfcDate", t == null ? "--" : DateUtil.getyyyy_MM_dd(t.getCreated()));
  309 + /** 预约复查日期 */
  310 + TrackDown t2 = mongoTemplate.findOne(Query.query(Criteria.where("yn").is(1).and("parentId").is(patient.getId()).and("trackDownDateType").is(7)).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
  311 + temp.put("yyfcDate ", t2 == null ? "--" : DateUtil.getyyyy_MM_dd(t2.getReservatDate()));
  312 + /** 生产方式 */
  313 + temp.put("scType", FmTypeEnums.getFmNameById2(patient.getFmType()));
  314 +
  315 + } else if(trackType == TrackDownDateEnums.C.getId()) {
  316 + }
293 317 restList.add(temp);
294 318 }
295 319 Criteria trackDowncCriteria = new Criteria();
296 320  
... ... @@ -303,8 +327,17 @@
303 327 return RespBuilder.buildSuccess(pageResult);
304 328 }
305 329  
  330 + private String getResultByType(Integer type, String parentId, Sort sort) {
  331 + Query query = Query.query(Criteria.where("yn").is(1).and("parentId").is(parentId).and("trackDownDateType").is(type));
  332 + if(sort != null) {
  333 + query.with(sort);
  334 + }
  335 + TrackDown t = mongoTemplate.findOne(query, TrackDown.class);
  336 + return (t == null || StringUtils.isEmpty(t.getResult()) ? "--" : t.getResult());
  337 + }
  338 +
306 339 @Override
307   - public BaseResponse info(String patientId, Integer trackType) {
  340 + public BaseObjectResponse info(String patientId, Integer trackType) {
308 341 List<Map<String, Object>> tabList = new ArrayList<>();
309 342 if(trackType == 0) {
310 343 List<TrackDown> trackDowns = mongoTemplate.find(Query.query(Criteria.where("parentId").is(patientId).and("yn").is(1)).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
... ... @@ -322,6 +355,7 @@
322 355 temp.put("trackDownType", TrackDownTypeEnums.getName(trackDown.getTrackDownDateType()));
323 356 temp.put("result", StringUtils.isEmpty(trackDown.getResult()) ? "--" : trackDown.getResult());
324 357 temp.put("reservatDate", DateUtil.getyyyy_MM_dd(trackDown.getReservatDate()));
  358 + temp.put("trackDownTransfer", trackDown.getTrackDownTransfer());
325 359 if(TrackDownDateEnums.A.getId().equals(trackDown.getTrackDownDateType())) {
326 360 hqjcList.add(temp);
327 361 } else if(TrackDownDateEnums.B.getId().equals(trackDown.getTrackDownDateType())) {
... ... @@ -338,7 +372,6 @@
338 372 chfcList.add(temp);
339 373 }
340 374 }
341   - setTrackType();
342 375 return RespBuilder.buildSuccess("hqjcList", hqjcList, "hyjdList", hyjdList, "cqjcList", cqjcList, "cqscList", cqscList, "zyfmList", zyfmList, "chfsList", chfsList, "chfcList", chfcList);
343 376 }
344 377 List<TrackDown> trackDowns = mongoTemplate.find(Query.query(Criteria.where("parentId").is(patientId).and("trackDownDateType").is(trackType).and("yn").is(1)), TrackDown.class);
345 378  
... ... @@ -354,17 +387,8 @@
354 387 return RespBuilder.buildSuccess(tabList);
355 388 }
356 389  
357   - private void setTrackType(List<Map<String, Object>> ... datas) {
358   - for (List<Map<String, Object>> data : datas) {
359   -
360   - for (Map<String, Object> map : data) {
361   -
362   - }
363   - }
364   - }
365   -
366 390 @Override
367   - public BaseResponse init() {
  391 + public BaseObjectResponse init() {
368 392 List<Map<String, Object>> trackTypes = EnumUtil.toJson(TrackDownTypeEnums.class); // 追访方式
369 393 List<Map<String, Object>> dataTypes = EnumUtil.toJson(TrackDownDateEnums.class); // 追访相关数据类型
370 394 List<Map<String, Object>> transfers = EnumUtil.toJson(TrackDownTransferEnums.class); // 追访转接
... ... @@ -372,7 +396,7 @@
372 396 }
373 397  
374 398 @Override
375   - public BaseResponse mother(String parentId, Integer userId) {
  399 + public BaseObjectResponse mother(String parentId, Integer userId) {
376 400 Patients patients = mongoTemplate.findById(parentId, Patients.class);
377 401 String hospitalId = autoMatchFacade.getHospitalId(userId);
378 402 Map<String, Object> map = new HashMap<>();
... ... @@ -384,6 +408,12 @@
384 408 map.put("week", DateUtil.getWeekDesc(patients.getLastMenses(), new Date()));
385 409 map.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate())); /** 预产期 */
386 410 map.put("trackCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId).and("trackDownDateType").is(TrackDownDateEnums.F.getId()).and("yn").is(1)), TrackDown.class)); /** 访视次数 */
  411 + map.put("fmDate", DateUtil.getyyyy_MM_dd(patients.getFmDate()));
  412 +
  413 + TrackDown tc = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId).and("trackDownDateType").is(TrackDownDateEnums.E.getId()).and("yn").is(1)).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
  414 + if(tc != null) {
  415 + map.put("reservatDate", DateUtil.getyyyy_MM_dd(tc.getReservatDate())); /** 预约住院日期 */
  416 + }
387 417 map.put("fcCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId).and("trackDownDateType").is(TrackDownDateEnums.G.getId()).and("yn").is(1)), TrackDown.class)); /** 复查次数 */
388 418 map.put("checkCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId).and("hospitalId").is(hospitalId)), AntenatalExaminationModel.class) +
389 419 mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId)), AntExChuModel.class)); /** 本院产检次数 */
... ... @@ -404,6 +434,110 @@
404 434  
405 435 }
406 436 return RespBuilder.buildSuccess(map);
  437 + }
  438 +
  439 + @Override
  440 + public void export(String provinceId, String cityId, String areaId, String streetId, String key, Integer trackType, Integer userId, HttpServletResponse response) {
  441 + BaseObjectResponse rest = list(provinceId, cityId, areaId, streetId, key, trackType, 1, 20, userId);
  442 + PageResult pageResult = (PageResult) rest.getData();
  443 + List<Map<String, Object>> datas = (List<Map<String, Object>>) pageResult.getGrid();
  444 + Map<String, String> cnames = new LinkedHashMap<>();
  445 + cnames.put("id", "#");
  446 + cnames.put("username", "姓名");
  447 + cnames.put("age", "年龄");
  448 + cnames.put("cardNo", "证件号");
  449 + cnames.put("residenceAddress", "居住地址");
  450 + cnames.put("phone", "联系方式");
  451 + if (trackType == 1) { // 婚前检查
  452 + cnames.put("result", "婚检追访结果");
  453 + cnames.put("trackDownTime", "婚检追访时间");
  454 + cnames.put("yyTime", "预约时间");
  455 + } else if (trackType == 2) { // 怀孕建档
  456 + cnames.put("result", "追访结果");
  457 + cnames.put("trackDownTime", "建档追访时间");
  458 + cnames.put("yyTime", "预约时间");
  459 + } else if (trackType == 3) { // 产前检查
  460 + cnames.put("week", "孕周");
  461 + cnames.put("checkCount", "本院产检次数");
  462 + cnames.put("yyTime", "产检日期");
  463 + cnames.put("yycjDate", "预约产检日期");
  464 + cnames.put("cjzfDate", "产检追访时间");
  465 + cnames.put("result", "产检追访结果");
  466 + } else if (trackType == 4) { // 产前筛查
  467 + cnames.put("week", "孕周");
  468 + cnames.put("yycsDate", "预约产筛日期");
  469 + cnames.put("zfDate", "追访时间");
  470 + cnames.put("result", "追访结果");
  471 + } else if (trackType == 5) { // 分娩住院
  472 + cnames.put("dueDate", "预产期");
  473 + cnames.put("yyzyDate", "预约住院时间");
  474 + cnames.put("zyzfDate", "住院追访时间");
  475 + cnames.put("result", "追访结果");
  476 + } else if (trackType == 6) { // 产后访视
  477 + cnames.put("fmDate", "分娩时间");
  478 + cnames.put("yyTime", "访视预约时间");
  479 + cnames.put("trackCount", "访视次数");
  480 + cnames.put("trackDownTime", "访视追访时间");
  481 + } else if (trackType == 7) { // 产后复查
  482 + cnames.put("fmDate", "分娩时间");
  483 + cnames.put("scType", "生产方式");
  484 + cnames.put("chfcCount", "复查次数");
  485 + cnames.put("ccfcDate", "初次复查日期");
  486 + cnames.put("yyfcDate", "预约复查日期");
  487 + cnames.put("result", "追访结果");
  488 + }
  489 +
  490 + List<Map<String,Object>> results = new ArrayList<>();
  491 + if(org.apache.commons.collections.CollectionUtils.isNotEmpty(datas)) {
  492 + int i = 0;
  493 + for (Map<String, Object> data : datas) {
  494 + Map<String, Object> result = new LinkedHashMap<>();
  495 + result.put("id", ++i);
  496 + result.put("username", data.get("username"));
  497 + result.put("age", data.get("age"));
  498 + result.put("cardNo", data.get("cardNo"));
  499 + result.put("residenceAddress", data.get("residenceAddress"));
  500 + result.put("phone", data.get("phone"));
  501 + if (trackType == 1 || trackType == 2) {
  502 + result.put("result", data.get("result"));
  503 + result.put("trackDownTime", data.get("trackDownTime"));
  504 + result.put("yyTime", data.get("yyTime"));
  505 + } else if (trackType == 3) { // 产前检查
  506 + result.put("week", data.get("week"));
  507 + result.put("checkCount", data.get("checkCount"));
  508 + result.put("yyTime", data.get("yyTime"));
  509 + result.put("yycjDate", data.get("yycjDate"));
  510 + result.put("cjzfDate", data.get("cjzfDate"));
  511 + result.put("result", data.get("result"));
  512 + } else if (trackType == 4) { // 产前筛查
  513 + result.put("week", data.get("week"));
  514 + result.put("yycsDate", data.get("yycsDate"));
  515 + result.put("zfDate", data.get("zfDate"));
  516 + result.put("result", data.get("result"));
  517 + } else if (trackType == 5) { // 分娩住院
  518 + result.put("dueDate", data.get("dueDate"));
  519 + result.put("yyzyDate", data.get("yyzyDate"));
  520 + result.put("zyzfDate", data.get("zyzfDate"));
  521 + result.put("result", data.get("result"));
  522 + } else if (trackType == 6) { // 产后访视
  523 + result.put("fmDate", data.get("fmDate"));
  524 + result.put("yyTime", data.get("yyTime"));
  525 + result.put("trackCount", data.get("trackCount"));
  526 + result.put("trackDownTime", data.get("trackDownTime"));
  527 + result.put("result", data.get("result"));
  528 + } else if (trackType == 7) { // 产后复查
  529 + result.put("fmDate", data.get("fmDate"));
  530 + result.put("scType", data.get("scType"));
  531 + result.put("chfcCount", data.get("chfcCount"));
  532 + result.put("ccfcDate", data.get("ccfcDate"));
  533 + result.put("yyfcDate", data.get("yyfcDate"));
  534 + result.put("result", data.get("result"));
  535 + }
  536 + results.add(result);
  537 + }
  538 + }
  539 +
  540 + ResponseUtil.responseExcel(cnames, results, response);
407 541 }
408 542  
409 543