Commit 7d408989d17f2cf4338947153e260b4a32d3b061

Authored by litao@lymsh.com
1 parent 223f35e8c9

追访

Showing 3 changed files with 86 additions and 20 deletions

platform-common/src/main/java/com/lyms/platform/common/enums/TrackDownDateEnums.java View file @ 7d40898
... ... @@ -8,11 +8,11 @@
8 8 public enum TrackDownDateEnums {
9 9 A(1, "婚前检查"),
10 10 B(2, "怀孕建档"),
11   - C(3, "孕期检查"),
  11 + C(3, "产前检查"),
12 12 D(4, "产前筛查"),
13   - E(3, "分娩住院"),
14   - F(3, "产后访视"),
15   - G(3, "产后复查");
  13 + E(5, "分娩住院"),
  14 + F(6, "产后访视"),
  15 + G(7, "产后复查");
16 16  
17 17 TrackDownDateEnums(Integer id, String name) {
18 18 this.id = id;
platform-dal/src/main/java/com/lyms/platform/pojo/TrackDown.java View file @ 7d40898
... ... @@ -18,6 +18,8 @@
18 18  
19 19 private String parentId;
20 20  
  21 + private String residentsArchiveId;
  22 +
21 23 private String pid;
22 24  
23 25 private Date created;
... ... @@ -60,6 +62,19 @@
60 62 */
61 63 private Integer trackDownTransfer;
62 64  
  65 + /**
  66 + * 追访数据保存的类型
  67 + */
  68 + private Integer trackDownDateType;
  69 +
  70 + public String getResidentsArchiveId() {
  71 + return residentsArchiveId;
  72 + }
  73 +
  74 + public void setResidentsArchiveId(String residentsArchiveId) {
  75 + this.residentsArchiveId = residentsArchiveId;
  76 + }
  77 +
63 78 public String getId() {
64 79 return id;
65 80 }
... ... @@ -162,6 +177,22 @@
162 177  
163 178 public void setReservatDate(Date reservatDate) {
164 179 this.reservatDate = reservatDate;
  180 + }
  181 +
  182 + public Integer getTrackDownTransfer() {
  183 + return trackDownTransfer;
  184 + }
  185 +
  186 + public void setTrackDownTransfer(Integer trackDownTransfer) {
  187 + this.trackDownTransfer = trackDownTransfer;
  188 + }
  189 +
  190 + public Integer getTrackDownDateType() {
  191 + return trackDownDateType;
  192 + }
  193 +
  194 + public void setTrackDownDateType(Integer trackDownDateType) {
  195 + this.trackDownDateType = trackDownDateType;
165 196 }
166 197 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java View file @ 7d40898
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.platform.biz.service.TrackDownService;
4 4 import com.lyms.platform.common.enums.FmTypeEnums;
  5 +import com.lyms.platform.common.enums.TrackDownDateEnums;
5 6 import com.lyms.platform.common.enums.YnEnums;
6 7 import com.lyms.platform.common.result.BaseResponse;
7 8 import com.lyms.platform.common.result.PageResult;
8 9  
9 10  
10 11  
11 12  
... ... @@ -73,22 +74,43 @@
73 74 temp.put("username", patient.getUsername());
74 75 temp.put("phone", patient.getPhone());
75 76 temp.put("age", DateUtil.getAge(patient.getBirth()));
76   - temp.put("bookbuild", 2); // 孕期建档 1=勾勾 2=叉叉 3=--
  77 + // 孕期建档 1=勾勾 2=叉叉 3=空白 patient有数据>>勾勾 没有>有怀孕建档追访并且(流转至下一流程 or 结束所有流程)xx 没有就是空
  78 + temp.put("bookbuild", 1);
77 79 temp.put("bookbuildDate", DateUtil.getyyyy_MM_dd(patient.getBookbuildingDate()));
78   - temp.put("yjcount", getChuzhenCount(patient.getId())); // 孕检次数 = 初诊 + 复诊
79   - temp.put("cqsc", 1); // 产前筛查 1=勾勾 2=叉叉 3=--
80   - temp.put("fm", 3); // 分娩 1=勾勾 2=叉叉 3=--
81   - temp.put("fmType", FmTypeEnums.getFmNameById(patient.getFmType())); // 分娩方式
82   - temp.put("chfc", 3); // 产后复查 1=勾勾 2=叉叉 3=--
83   - temp.put("chfcCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(patient.getId()).and("yn").is(1)), PostReviewModel.class)); // 复查次数
  80 +
  81 + // 产检记录 > 0 勾勾 没有:有产前检查追访并且(流转至下一流程 or 结束所有流程)叉叉
  82 + long yjCount = getChuzhenCount(patient.getId());
  83 + temp.put("yj", yjCount > 0 ? 1 : isExitTrackDown(patient.getId(), TrackDownDateEnums.C));
  84 + temp.put("yjcount", yjCount); // 孕检次数 = 初诊 + 复诊
  85 +
  86 +
  87 + // 产前筛查 有产晒记录>勾勾 没有: 有产前筛查追访并且流转至下一流程 勾勾 反之xx
  88 + temp.put("cqsc", mongoTemplate.count(Query.query(Criteria.where("parentId").is(patient.getId()).and("yn").is(1)), AntExChuModel.class) > 0L ? 1 : isExitTrackDown(patient.getId(), TrackDownDateEnums.D));
  89 +
  90 + // type=3 且(isAutoFm不为1,或者不存在)且dueStatus为0 没有: 有分娩住院追访并且流转至下一流程 勾勾 反之xx
  91 + temp.put("fm", patient.getType() == 3 && (patient.getIsAutoFm() != 1 || patient.getIsAutoFm() == null) && patient.getDueStatus() == 0 ? 1 : isExitTrackDown(patient.getId(), TrackDownDateEnums.E)); // 分娩 1=勾勾 2=叉叉
  92 + temp.put("fmType", FmTypeEnums.getFmNameById(patient.getFmType()) == null ? "--" : FmTypeEnums.getFmNameById(patient.getFmType())); // 分娩方式
  93 +
  94 + // 产后复查 1=勾勾 2=叉叉 有产后复查记录>勾勾 没有: 有产后复查追访并且流转至下一流程 勾勾 反之xx
  95 + long chfcCount = mongoTemplate.count(Query.query(Criteria.where("parentId").is(patient.getId()).and("yn").is(1)), PostReviewModel.class);
  96 + temp.put("chfc", chfcCount > 0L ? 1 : isExitTrackDown(patient.getId(), TrackDownDateEnums.G));
  97 + temp.put("chfcCount", chfcCount); // 复查次数
  98 +
  99 +
  100 + temp.put("resident", 2); // 妇女建档(产品说是直接来的 没有追访的判断) patient有数据 lyms_resident没数据 直接XX 如果有 后面的流程会设置为勾勾的 map.put("resident", 1); // 妇女建档
  101 +
  102 + // 婚检 有婚检 勾勾 没有: 有婚前检查并且流转至下一流程 叉叉 没有就是空白
  103 + temp.put("check", mongoTemplate.count(Query.query(Criteria.where("parentId").is(patient.getId()).and("yn").is(1)), PremaritalCheckup.class) > 0L ? 1 : isExitTrackDown(patient.getId(), TrackDownDateEnums.A));
  104 +
84 105 restList.add(temp);
85 106 }
  107 +
  108 + Integer archiveModelCount = 0;
86 109 for (ResidentsArchiveModel archiveModel : residentsArchiveModels) {
87 110 for (Map<String, Object> map : restList) {
88 111 if(StringUtils.isNotEmpty((String) map.get("cardNo")) && map.get("cardNo").toString().equals(archiveModel.getCertificateNum())) {
89   - map.put("resident", 2); // 妇女建档
  112 + map.put("resident", 1); // 妇女建档
90 113 map.put("residentDate", DateUtil.getyyyy_MM_dd(archiveModel.getBuildDay()));
91   - map.put("check", 3); // 婚检
92 114 continue;
93 115 }
94 116 }
95 117  
96 118  
97 119  
98 120  
99 121  
100 122  
... ... @@ -98,20 +120,33 @@
98 120 temp.put("username", archiveModel.getUsername());
99 121 temp.put("phone", archiveModel.getPhone());
100 122 temp.put("age", DateUtil.getAge(archiveModel.getBirthday()));
101   - temp.put("resident", 3); // 妇女建档
  123 + temp.put("resident", 1); // 妇女建档
102 124 temp.put("residentDate", DateUtil.getyyyy_MM_dd(archiveModel.getBuildDay())); // 妇女建档日期
103   - temp.put("check", 2); // 婚检
104   - temp.put("bookbuild", 2); // 孕期建档 1=勾勾 2=叉叉
  125 + temp.put("check", mongoTemplate.count(Query.query(Criteria.where("certificateNum").is(archiveModel.getCertificateNum()).and("yn").is(1)), PremaritalCheckup.class) > 0L ? 1 : isResidentsArchive(archiveModel.getId())); // 婚检
  126 + temp.put("bookbuild", 3); // 孕期建档 1=勾勾 2=叉叉
105 127 temp.put("bookbuildDate", "--");
  128 + temp.put("yj", 3);
106 129 temp.put("yjcount", 0); // 孕检次数 = 初诊 + 复诊
107   - temp.put("cqsc", 2); // 产前筛查 1=勾勾 2=叉叉
108   - temp.put("fm", 2); // 分娩 1=勾勾 2=叉叉
  130 + temp.put("cqsc", 3); // 产前筛查 1=勾勾 2=叉叉
  131 + temp.put("fm", 3); // 分娩 1=勾勾 2=叉叉
109 132 temp.put("fmType", "--"); // 分娩方式
110   - temp.put("chfc", 2); // 产后复查 1=勾勾 2=叉叉
  133 + temp.put("chfc", 3); // 产后复查 1=勾勾 2=叉叉
111 134 temp.put("chfcCount", 0); // 复查次数
  135 + archiveModelCount++;
112 136 restList.add(temp);
113 137 }
114   - return RespBuilder.buildSuccess("tabList", new PageResult(restList.size(), page, limit, CollectionUtils.getPageIds(restList, page, limit)));
  138 + return RespBuilder.buildSuccess("tabList", new PageResult(restList.size() + archiveModelCount, page, limit, CollectionUtils.getPageIds(restList, page, limit)));
  139 + }
  140 +
  141 + private int isExitTrackDown(String parentId, TrackDownDateEnums trackDownDateEnums) {
  142 + return mongoTemplate.exists(Query.query(Criteria.where("parentId").is(parentId).and("yn").is(1)
  143 + .and("trackDownDateType").is(trackDownDateEnums.getId()).and("trackDownTransfer").in(Arrays.asList(2, 3))), TrackDown.class) ? 2 : 3;
  144 + }
  145 +
  146 +
  147 + private int isResidentsArchive(String residentsArchiveId) {
  148 + return mongoTemplate.exists(Query.query(Criteria.where("residentsArchiveId").is(residentsArchiveId).and("yn").is(1)
  149 + .and("trackDownDateType").is(TrackDownDateEnums.A).and("trackDownTransfer").in(Arrays.asList(2, 3))), TrackDown.class) ? 2 : 3;
115 150 }
116 151  
117 152 /**