Commit 913b726b3ebc7cc4f34f88c50994f09c92f65004
1 parent
e1a4de5b00
Exists in
master
and in
1 other branch
患者购买卡一行变多行
Showing 1 changed file with 132 additions and 134 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
View file @
913b726
| ... | ... | @@ -40,7 +40,7 @@ |
| 40 | 40 | private LymsIllnessService lymsIllnessService;//疾病 |
| 41 | 41 | |
| 42 | 42 | @Autowired |
| 43 | - private LymsTkcardService lymsTkcardService;//问诊记录 | |
| 43 | + private LymsTkcardService lymsTkcardService;//问诊记录 | |
| 44 | 44 | |
| 45 | 45 | @Autowired |
| 46 | 46 | private PatientInfoService patientInfoService;//患者视图 |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | |
| ... | ... | @@ -62,41 +62,42 @@ |
| 62 | 62 | private LymsDoctorService lymsDoctorService; |
| 63 | 63 | //关注 |
| 64 | 64 | @Autowired |
| 65 | - private LymsAttentionService lymsAttentionService; | |
| 65 | + private LymsAttentionService lymsAttentionService; | |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * 获取患者列表 |
| 69 | + * | |
| 69 | 70 | * @param patientInfo |
| 70 | 71 | * @param current |
| 71 | 72 | * @param size |
| 72 | 73 | * @return |
| 73 | 74 | */ |
| 74 | 75 | @GetMapping("sltPatientLst") |
| 75 | - public BaseResponse sltPatientLst(PatientInfo patientInfo, int current, int size,@RequestParam(required = false) Integer qtype){ | |
| 76 | - BaseResponse baseResponse=new BaseResponse(); | |
| 77 | - Page<PatientInfo> page=new Page<>(current,size); | |
| 76 | + public BaseResponse sltPatientLst(PatientInfo patientInfo, int current, int size, @RequestParam(required = false) Integer qtype) { | |
| 77 | + BaseResponse baseResponse = new BaseResponse(); | |
| 78 | + Page<PatientInfo> page = new Page<>(current, size); | |
| 78 | 79 | QueryWrapper<PatientInfo> queryWrapper = Wrappers.query(patientInfo); |
| 79 | - if (Objects.nonNull(qtype) &&qtype==1){//从小程序购买 | |
| 80 | - queryWrapper.inSql("id","SELECT t.`pid` FROM lyms_tcard t WHERE t.`fid`=1"); | |
| 80 | + if (Objects.nonNull(qtype) && qtype == 1) {//从小程序购买 | |
| 81 | + queryWrapper.inSql("id", "SELECT t.`pid` FROM lyms_tcard t WHERE t.`fid`=1"); | |
| 81 | 82 | } |
| 82 | - if (Objects.nonNull(qtype) && qtype==2){//从医院购买 | |
| 83 | - queryWrapper.inSql("id","SELECT t.`pid` FROM lyms_tcard t WHERE t.`fid`=2"); | |
| 83 | + if (Objects.nonNull(qtype) && qtype == 2) {//从医院购买 | |
| 84 | + queryWrapper.inSql("id", "SELECT t.`pid` FROM lyms_tcard t WHERE t.`fid`=2"); | |
| 84 | 85 | } |
| 85 | - Page<PatientInfo> patientPagePage=patientInfoService.page(page, queryWrapper); | |
| 86 | - List<PatientInfo> pLst=patientInfoService.list(queryWrapper); | |
| 87 | - int daiCnt=pLst.parallelStream().mapToInt(PatientInfo::getCcnt).sum();//待使用数量 | |
| 86 | + Page<PatientInfo> patientPagePage = patientInfoService.page(page, queryWrapper); | |
| 87 | + List<PatientInfo> pLst = patientInfoService.list(queryWrapper); | |
| 88 | + int daiCnt = pLst.parallelStream().mapToInt(PatientInfo::getCcnt).sum();//待使用数量 | |
| 88 | 89 | |
| 89 | - List<Integer> pids=pLst.parallelStream().map(PatientInfo::getId).collect(Collectors.toList()); | |
| 90 | + List<Integer> pids = pLst.parallelStream().map(PatientInfo::getId).collect(Collectors.toList()); | |
| 90 | 91 | |
| 91 | - LymsTcard tcard=new LymsTcard(); | |
| 92 | + LymsTcard tcard = new LymsTcard(); | |
| 92 | 93 | QueryWrapper<LymsTcard> tWrapper = Wrappers.query(tcard); |
| 93 | - if(pids.size()==0){ | |
| 94 | + if (pids.size() == 0) { | |
| 94 | 95 | pids.add(-1); |
| 95 | 96 | } |
| 96 | - tWrapper.in("pid",pids); | |
| 97 | - int sum=lymsTcardService.list(tWrapper).parallelStream().mapToInt(LymsTcard::getCnt).sum(); | |
| 97 | + tWrapper.in("pid", pids); | |
| 98 | + int sum = lymsTcardService.list(tWrapper).parallelStream().mapToInt(LymsTcard::getCnt).sum(); | |
| 98 | 99 | |
| 99 | - log.error("统计需要改动数据结构:daiCnt:{} sum:{}",daiCnt,sum); | |
| 100 | + log.error("统计需要改动数据结构:daiCnt:{} sum:{}", daiCnt, sum); | |
| 100 | 101 | baseResponse.setObject(patientPagePage); |
| 101 | 102 | |
| 102 | 103 | return baseResponse; |
| 103 | 104 | |
| 104 | 105 | |
| 105 | 106 | |
| 106 | 107 | |
| 107 | 108 | |
| 108 | 109 | |
| 109 | 110 | |
| 110 | 111 | |
| 111 | 112 | |
| 112 | 113 | |
| 113 | 114 | |
| 114 | 115 | |
| 115 | 116 | |
| 116 | 117 | |
| 117 | 118 | |
| 118 | 119 | |
| 119 | 120 | |
| 120 | 121 | |
| 121 | 122 | |
| 122 | 123 | |
| 123 | 124 | |
| 124 | 125 | |
| 125 | 126 | |
| 126 | 127 | |
| 127 | 128 | |
| 128 | 129 | |
| 129 | 130 | |
| ... | ... | @@ -104,149 +105,146 @@ |
| 104 | 105 | |
| 105 | 106 | /** |
| 106 | 107 | * 保存或更新患者信息 |
| 108 | + * | |
| 107 | 109 | * @param patient |
| 108 | 110 | * @return |
| 109 | 111 | */ |
| 110 | 112 | @PostMapping("savePatient") |
| 111 | - public BaseResponse savePatient(@Validated LymsPatient patient, BindingResult result, LymsPcase pcase, String illness){ | |
| 112 | - BaseResponse baseResponse=new BaseResponse(); | |
| 113 | + public BaseResponse savePatient(@Validated LymsPatient patient, BindingResult result, LymsPcase pcase, String illness) { | |
| 114 | + BaseResponse baseResponse = new BaseResponse(); | |
| 113 | 115 | log.info(">>>>>>>>>>>>>>>登记病例"); |
| 114 | 116 | baseResponse.setErrormsg(""); |
| 115 | - LymsPatient patient2=lymsPatientService.getOne(Wrappers.query(patient).eq("idno",patient.getIdno())); | |
| 116 | - if(patient2==null){ | |
| 117 | + LymsPatient patient2 = lymsPatientService.getOne(Wrappers.query(patient).eq("idno", patient.getIdno())); | |
| 118 | + if (patient2 == null) { | |
| 117 | 119 | patient.setCreatedtime(new Date()); |
| 118 | - }else{ | |
| 120 | + } else { | |
| 119 | 121 | patient.setId(patient2.getId()); |
| 120 | 122 | patient.setUpdatedtime(new Date()); |
| 121 | 123 | } |
| 122 | 124 | |
| 123 | - if(result.hasErrors()){ | |
| 125 | + if (result.hasErrors()) { | |
| 124 | 126 | baseResponse.setErrorcode(1); |
| 125 | - result.getAllErrors().forEach(e->{ | |
| 126 | - baseResponse.setErrormsg(baseResponse.getErrormsg()+e.getDefaultMessage()); | |
| 127 | + result.getAllErrors().forEach(e -> { | |
| 128 | + baseResponse.setErrormsg(baseResponse.getErrormsg() + e.getDefaultMessage()); | |
| 127 | 129 | }); |
| 128 | 130 | baseResponse.setErrorcode(1); |
| 129 | 131 | return baseResponse; |
| 130 | 132 | } |
| 131 | 133 | |
| 132 | - boolean f=lymsPatientService.saveOrUpdate(patient); | |
| 134 | + boolean f = lymsPatientService.saveOrUpdate(patient); | |
| 133 | 135 | |
| 134 | 136 | // 添加病例 |
| 135 | 137 | pcase.setCreatedby(patient.getCreatedby()); |
| 136 | 138 | pcase.setPid(patient.getId()); |
| 137 | 139 | pcase.setCreatedtime(new Date()); |
| 138 | - f=lymsPcaseService.saveOrUpdate(pcase); | |
| 139 | - String[] iArr=illness.split(","); | |
| 140 | + f = lymsPcaseService.saveOrUpdate(pcase); | |
| 141 | + String[] iArr = illness.split(","); | |
| 140 | 142 | |
| 141 | 143 | log.info(patient); |
| 142 | 144 | log.info(pcase); |
| 143 | 145 | |
| 144 | - Map param=new HashMap(); | |
| 146 | + Map param = new HashMap(); | |
| 145 | 147 | |
| 146 | 148 | for (int i = 0; i < iArr.length; i++) { |
| 147 | - LymsIllness ness=new LymsIllness(); | |
| 149 | + LymsIllness ness = new LymsIllness(); | |
| 148 | 150 | ness.setCreatedby(patient.getCreatedby()); |
| 149 | 151 | ness.setPcid(pcase.getPcid()); |
| 150 | 152 | ness.setIid(Integer.parseInt(iArr[i])); |
| 151 | 153 | ness.setCreatedtime(new Date()); |
| 152 | 154 | param.clear(); |
| 153 | - param.put("pcid",pcase.getPcid()); | |
| 154 | - param.put("iid",iArr[i]); | |
| 155 | - List<LymsIllness> iLst=lymsIllnessService.listByMap(param); | |
| 156 | - if(iLst.size()>0){ | |
| 155 | + param.put("pcid", pcase.getPcid()); | |
| 156 | + param.put("iid", iArr[i]); | |
| 157 | + List<LymsIllness> iLst = lymsIllnessService.listByMap(param); | |
| 158 | + if (iLst.size() > 0) { | |
| 157 | 159 | ness.setId(iLst.get(0).getId()); |
| 158 | 160 | } |
| 159 | - f=lymsIllnessService.saveOrUpdate(ness); | |
| 161 | + f = lymsIllnessService.saveOrUpdate(ness); | |
| 160 | 162 | log.info(ness.toString()); |
| 161 | 163 | } |
| 162 | 164 | |
| 165 | + Date instDate=new Date(); | |
| 163 | 166 | //需要添加医院购买卡记录 |
| 164 | - LymsTcard tcard=new LymsTcard(); | |
| 165 | - tcard.setCnt(patient.getCcnt()); | |
| 166 | - tcard.setPcid(pcase.getPcid()); | |
| 167 | - tcard.setPid(patient.getId()); | |
| 168 | - tcard.setFid(2); | |
| 169 | - | |
| 170 | - param.clear(); | |
| 171 | - param.put("pcid",pcase.getPcid()); | |
| 172 | - List<LymsTcard> tLst=lymsTcardService.listByMap(param); | |
| 173 | - if(tLst.size()>0){ | |
| 174 | - tcard.setId(tLst.get(0).getId()); | |
| 175 | - tcard.setUpdatedby(pcase.getUpdatedby()); | |
| 176 | - tcard.setUpdatedTime(new Date()); | |
| 177 | - }else{ | |
| 167 | + for (int i = 0; i < patient.getCcnt(); i++) { | |
| 168 | + LymsTcard tcard = new LymsTcard(); | |
| 169 | + tcard.setCnt(1); | |
| 170 | + tcard.setPcid(pcase.getPcid()); | |
| 171 | + tcard.setPid(patient.getId()); | |
| 172 | + tcard.setFid(2); | |
| 178 | 173 | tcard.setCreatedby(patient.getCreatedby()); |
| 179 | - tcard.setCreatedtime(new Date()); | |
| 174 | + tcard.setCreatedtime(instDate); | |
| 175 | + | |
| 176 | + lymsTcardService.saveOrUpdate(tcard); | |
| 180 | 177 | } |
| 181 | 178 | |
| 182 | - lymsTcardService.saveOrUpdate(tcard); | |
| 183 | - | |
| 184 | - baseResponse.setErrorcode(f==true?0:1); | |
| 179 | + baseResponse.setErrorcode(f == true ? 0 : 1); | |
| 185 | 180 | return baseResponse; |
| 186 | 181 | } |
| 187 | 182 | |
| 188 | 183 | /** |
| 189 | 184 | * 删除患者 |
| 185 | + * | |
| 190 | 186 | * @param id |
| 191 | 187 | * @return |
| 192 | 188 | */ |
| 193 | 189 | @GetMapping("delPatient") |
| 194 | - public BaseResponse delPatient(int id){ | |
| 195 | - BaseResponse baseResponse=new BaseResponse(); | |
| 196 | - boolean f=lymsPatientService.removeById(id); | |
| 197 | - baseResponse.setErrorcode(f==true?0:1); | |
| 190 | + public BaseResponse delPatient(int id) { | |
| 191 | + BaseResponse baseResponse = new BaseResponse(); | |
| 192 | + boolean f = lymsPatientService.removeById(id); | |
| 193 | + baseResponse.setErrorcode(f == true ? 0 : 1); | |
| 198 | 194 | return baseResponse; |
| 199 | 195 | } |
| 200 | 196 | |
| 201 | 197 | /** |
| 202 | 198 | * 删除患者病例ID |
| 199 | + * | |
| 203 | 200 | * @param pcid |
| 204 | 201 | * @return |
| 205 | 202 | */ |
| 206 | 203 | @GetMapping("delPcase") |
| 207 | - public BaseResponse delPcase(int pcid){ | |
| 208 | - BaseResponse baseResponse=new BaseResponse(); | |
| 209 | - boolean f=lymsPcaseService.removeById(pcid); | |
| 210 | - baseResponse.setErrorcode(f==true?0:1); | |
| 204 | + public BaseResponse delPcase(int pcid) { | |
| 205 | + BaseResponse baseResponse = new BaseResponse(); | |
| 206 | + boolean f = lymsPcaseService.removeById(pcid); | |
| 207 | + baseResponse.setErrorcode(f == true ? 0 : 1); | |
| 211 | 208 | return baseResponse; |
| 212 | 209 | } |
| 213 | 210 | |
| 214 | 211 | /** |
| 215 | 212 | * 患者登录 |
| 213 | + * | |
| 216 | 214 | * @param patient |
| 217 | 215 | * @return |
| 218 | 216 | */ |
| 219 | 217 | @PostMapping("loginPatient") |
| 220 | - public BaseResponse loginPatient(@RequestBody LymsPatient patient){ | |
| 221 | - BaseResponse baseResponse=new BaseResponse(); | |
| 222 | - List<LymsPatient> dLst=lymsPatientService.list(Wrappers.query(patient)); | |
| 218 | + public BaseResponse loginPatient(@RequestBody LymsPatient patient) { | |
| 219 | + BaseResponse baseResponse = new BaseResponse(); | |
| 220 | + List<LymsPatient> dLst = lymsPatientService.list(Wrappers.query(patient)); | |
| 223 | 221 | baseResponse.setErrorcode(1); |
| 224 | - if (dLst.size()>0) { | |
| 225 | - patient=dLst.get(0); | |
| 222 | + if (dLst.size() > 0) { | |
| 223 | + patient = dLst.get(0); | |
| 226 | 224 | |
| 227 | 225 | String jwt = JwtUtils.createJWT("1", patient.getIdno(), Constant.JWT_TTL); |
| 228 | - Map<String,Object> map=new HashMap<>(); | |
| 226 | + Map<String, Object> map = new HashMap<>(); | |
| 229 | 227 | |
| 230 | 228 | patient.setIslogin(1); |
| 231 | 229 | |
| 232 | - if(patient.getHxid()==null ){ | |
| 233 | - JSONObject json=hxService.addUser(patient.getIdno(),Constant.COMMON_PASSWD,patient.getPname()); | |
| 234 | - JSONArray rArr=json.getJSONArray("entities"); | |
| 235 | - if(rArr.size()>0){ | |
| 230 | + if (patient.getHxid() == null) { | |
| 231 | + JSONObject json = hxService.addUser(patient.getIdno(), Constant.COMMON_PASSWD, patient.getPname()); | |
| 232 | + JSONArray rArr = json.getJSONArray("entities"); | |
| 233 | + if (rArr.size() > 0) { | |
| 236 | 234 | patient.setHxid(rArr.getJSONObject(0).getString("uuid")); |
| 237 | 235 | } |
| 238 | 236 | lymsPatientService.saveOrUpdate(patient); |
| 239 | 237 | } |
| 240 | 238 | |
| 241 | 239 | patient.setPpasswd(null); |
| 242 | - map.put("patient",patient); | |
| 243 | - map.put("token",jwt); | |
| 240 | + map.put("patient", patient); | |
| 241 | + map.put("token", jwt); | |
| 244 | 242 | baseResponse.setErrorcode(0); |
| 245 | 243 | baseResponse.setObject(map); |
| 246 | - LymsLogs logEntity=new LymsLogs(); | |
| 244 | + LymsLogs logEntity = new LymsLogs(); | |
| 247 | 245 | logEntity.setFunc("loginPatient"); |
| 248 | 246 | logEntity.setLogDate(new Date()); |
| 249 | - logEntity.setMessage(String.format("login:%s name:%s",patient.getIdno(),patient.getPname())); | |
| 247 | + logEntity.setMessage(String.format("login:%s name:%s", patient.getIdno(), patient.getPname())); | |
| 250 | 248 | lymsLogsService.save(logEntity); |
| 251 | 249 | } |
| 252 | 250 | return baseResponse; |
| 253 | 251 | |
| ... | ... | @@ -254,13 +252,14 @@ |
| 254 | 252 | |
| 255 | 253 | /** |
| 256 | 254 | * 查询单个患者信息 |
| 255 | + * | |
| 257 | 256 | * @param patientInfo |
| 258 | 257 | * @return |
| 259 | 258 | */ |
| 260 | 259 | @GetMapping("queryPatient") |
| 261 | - public BaseResponse queryPatient(PatientInfo patientInfo){ | |
| 262 | - BaseResponse baseResponse=new BaseResponse(); | |
| 263 | - PatientInfo patientInfo2=patientInfoService.getOne(Wrappers.query(patientInfo)); | |
| 260 | + public BaseResponse queryPatient(PatientInfo patientInfo) { | |
| 261 | + BaseResponse baseResponse = new BaseResponse(); | |
| 262 | + PatientInfo patientInfo2 = patientInfoService.getOne(Wrappers.query(patientInfo)); | |
| 264 | 263 | baseResponse.setObject(patientInfo2); |
| 265 | 264 | return baseResponse; |
| 266 | 265 | } |
| 267 | 266 | |
| 268 | 267 | |
| ... | ... | @@ -268,13 +267,14 @@ |
| 268 | 267 | |
| 269 | 268 | /** |
| 270 | 269 | * 传入患者id,获取病历对应的医院列表 |
| 270 | + * | |
| 271 | 271 | * @param lymsPcase |
| 272 | 272 | * @return |
| 273 | 273 | */ |
| 274 | 274 | @GetMapping("getPatientHospitals") |
| 275 | - public BaseResponse getPatientHospitals(LymsPcase lymsPcase){ | |
| 275 | + public BaseResponse getPatientHospitals(LymsPcase lymsPcase) { | |
| 276 | 276 | BaseResponse baseResponse = new BaseResponse(); |
| 277 | - List<LymsPcase> pcases =lymsPcaseService.list(Wrappers.query(lymsPcase)); | |
| 277 | + List<LymsPcase> pcases = lymsPcaseService.list(Wrappers.query(lymsPcase)); | |
| 278 | 278 | baseResponse.setObject(pcases); |
| 279 | 279 | return baseResponse; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | |
| 285 | 285 | |
| ... | ... | @@ -283,29 +283,30 @@ |
| 283 | 283 | /** |
| 284 | 284 | * 查询患者在某个医院的详细诊断病历 |
| 285 | 285 | * 需要传入患者id和医院id |
| 286 | - * @param pid 患者id | |
| 287 | - * @param hid 医院id | |
| 286 | + * | |
| 287 | + * @param pid 患者id | |
| 288 | + * @param hid 医院id | |
| 288 | 289 | * @return |
| 289 | 290 | */ |
| 290 | 291 | @GetMapping("getPatientHospitalPcase") |
| 291 | - public BaseResponse getPatientHospitalPcase(int pid,int hid, | |
| 292 | - @RequestParam(required = false) String keyword){ | |
| 292 | + public BaseResponse getPatientHospitalPcase(int pid, int hid, | |
| 293 | + @RequestParam(required = false) String keyword) { | |
| 293 | 294 | BaseResponse baseResponse = new BaseResponse(); |
| 294 | 295 | Map data = new HashMap(5); |
| 295 | 296 | LymsPatient patient = lymsPatientService.getById(pid); |
| 296 | 297 | //患者基本信息 |
| 297 | - data.put("patient",patient); | |
| 298 | + data.put("patient", patient); | |
| 298 | 299 | |
| 299 | 300 | //医院信息 |
| 300 | 301 | LymsHospital hospital = lymsHospitalService.getById(pid); |
| 301 | - data.put("hospital",hospital); | |
| 302 | + data.put("hospital", hospital); | |
| 302 | 303 | |
| 303 | 304 | List<Integer> ilist = new ArrayList<>(); |
| 304 | - if (StringUtil.isNotEmpty(keyword)){ | |
| 305 | + if (StringUtil.isNotEmpty(keyword)) { | |
| 305 | 306 | LambdaQueryWrapper<LymsIllness> iwrapper = new QueryWrapper().lambda(); |
| 306 | 307 | iwrapper.like(LymsIllness::getIname, keyword); |
| 307 | 308 | List<LymsIllness> illnesses = lymsIllnessService.list(iwrapper); |
| 308 | - if (CollectionUtils.isNotEmpty(illnesses)){ | |
| 309 | + if (CollectionUtils.isNotEmpty(illnesses)) { | |
| 309 | 310 | illnesses.stream().forEach(i -> { |
| 310 | 311 | ilist.add(i.getPcid()); |
| 311 | 312 | }); |
| 312 | 313 | |
| ... | ... | @@ -315,9 +316,9 @@ |
| 315 | 316 | LambdaQueryWrapper<LymsPcase> wrapper = new QueryWrapper().lambda(); |
| 316 | 317 | wrapper.eq(LymsPcase::getPid, pid); |
| 317 | 318 | wrapper.eq(LymsPcase::getHid, hid); |
| 318 | - if (StringUtil.isNotEmpty(keyword)){ | |
| 319 | + if (StringUtil.isNotEmpty(keyword)) { | |
| 319 | 320 | wrapper.and(i -> i.like(LymsPcase::getDname, keyword).or().like(LymsPcase::getDtname, keyword)); |
| 320 | - if (CollectionUtils.isNotEmpty(ilist)){ | |
| 321 | + if (CollectionUtils.isNotEmpty(ilist)) { | |
| 321 | 322 | wrapper.or(i -> i.in(LymsPcase::getPcid, ilist)); |
| 322 | 323 | } |
| 323 | 324 | } |
| ... | ... | @@ -325,7 +326,7 @@ |
| 325 | 326 | List<LymsPcase> lymsPcaseList = lymsPcaseService.list(wrapper); |
| 326 | 327 | |
| 327 | 328 | List<PatientPcaseResult> pcases = new ArrayList<>(); |
| 328 | - if (CollectionUtils.isNotEmpty(lymsPcaseList)){ | |
| 329 | + if (CollectionUtils.isNotEmpty(lymsPcaseList)) { | |
| 329 | 330 | lymsPcaseList.forEach(destModel -> { |
| 330 | 331 | PatientPcaseResult result = new PatientPcaseResult(); |
| 331 | 332 | result.setPid(destModel.getPid()); |
| ... | ... | @@ -342,7 +343,7 @@ |
| 342 | 343 | pcases.add(result); |
| 343 | 344 | }); |
| 344 | 345 | } |
| 345 | - data.put("pcases",pcases); | |
| 346 | + data.put("pcases", pcases); | |
| 346 | 347 | |
| 347 | 348 | baseResponse.setObject(data); |
| 348 | 349 | return baseResponse; |
| 349 | 350 | |
| ... | ... | @@ -351,11 +352,12 @@ |
| 351 | 352 | |
| 352 | 353 | /** |
| 353 | 354 | * 通过患者id查询患者的基本信息 |
| 355 | + * | |
| 354 | 356 | * @param lymsPatient |
| 355 | 357 | * @return |
| 356 | 358 | */ |
| 357 | 359 | @GetMapping("getPatientBaseInfo") |
| 358 | - public BaseResponse getPatientBaseInfo(LymsPatient lymsPatient){ | |
| 360 | + public BaseResponse getPatientBaseInfo(LymsPatient lymsPatient) { | |
| 359 | 361 | |
| 360 | 362 | BaseResponse baseResponse = new BaseResponse(); |
| 361 | 363 | |
| ... | ... | @@ -368,13 +370,12 @@ |
| 368 | 370 | wrapper.orderByDesc(LymsPcase::getCreatedtime); |
| 369 | 371 | List<LymsPcase> lymsPcaseList = lymsPcaseService.list(wrapper); |
| 370 | 372 | |
| 371 | - data.put("pid",patients.getId()); | |
| 372 | - data.put("pname",patients.getPname()); | |
| 373 | - data.put("psex",patients.getSex()); | |
| 374 | - data.put("birth",patients.getBirth()); | |
| 375 | - if (CollectionUtils.isNotEmpty(lymsPcaseList)) | |
| 376 | - { | |
| 377 | - data.put("mobile",lymsPcaseList.get(0).getMobile()); | |
| 373 | + data.put("pid", patients.getId()); | |
| 374 | + data.put("pname", patients.getPname()); | |
| 375 | + data.put("psex", patients.getSex()); | |
| 376 | + data.put("birth", patients.getBirth()); | |
| 377 | + if (CollectionUtils.isNotEmpty(lymsPcaseList)) { | |
| 378 | + data.put("mobile", lymsPcaseList.get(0).getMobile()); | |
| 378 | 379 | } |
| 379 | 380 | baseResponse.setObject(data); |
| 380 | 381 | return baseResponse; |
| 381 | 382 | |
| ... | ... | @@ -383,12 +384,13 @@ |
| 383 | 384 | |
| 384 | 385 | /** |
| 385 | 386 | * 更新患者信息 |
| 387 | + * | |
| 386 | 388 | * @param request |
| 387 | 389 | * @return |
| 388 | 390 | */ |
| 389 | 391 | @PutMapping("updatePatientInfo") |
| 390 | - public BaseResponse updatePatientInfo(@RequestBody PatientInfoRequest request){ | |
| 391 | - BaseResponse baseResponse=new BaseResponse(); | |
| 392 | + public BaseResponse updatePatientInfo(@RequestBody PatientInfoRequest request) { | |
| 393 | + BaseResponse baseResponse = new BaseResponse(); | |
| 392 | 394 | LymsPatient patients = lymsPatientService.getById(request.getPid()); |
| 393 | 395 | patients.setBirth(request.getBirth()); |
| 394 | 396 | patients.setPname(request.getPname()); |
| ... | ... | @@ -400,8 +402,7 @@ |
| 400 | 402 | wrapper.eq(LymsPcase::getPid, request.getPid()); |
| 401 | 403 | wrapper.orderByDesc(LymsPcase::getCreatedtime); |
| 402 | 404 | List<LymsPcase> lymsPcaseList = lymsPcaseService.list(wrapper); |
| 403 | - if (CollectionUtils.isNotEmpty(lymsPcaseList)) | |
| 404 | - { | |
| 405 | + if (CollectionUtils.isNotEmpty(lymsPcaseList)) { | |
| 405 | 406 | lymsPcaseList.forEach(lymsPcase -> { |
| 406 | 407 | lymsPcase.setMobile(request.getMobile()); |
| 407 | 408 | lymsPcaseService.updateById(lymsPcase); |
| 408 | 409 | |
| ... | ... | @@ -413,11 +414,12 @@ |
| 413 | 414 | |
| 414 | 415 | /** |
| 415 | 416 | * 患者的问诊记录接口 |
| 417 | + * | |
| 416 | 418 | * @param lymsTkrecord 传入患者id参数 |
| 417 | 419 | * @return |
| 418 | 420 | */ |
| 419 | 421 | @GetMapping("getPatienttkrecord") |
| 420 | - public BaseResponse getPatienttkrecord(LymsTkrecord lymsTkrecord){ | |
| 422 | + public BaseResponse getPatienttkrecord(LymsTkrecord lymsTkrecord) { | |
| 421 | 423 | |
| 422 | 424 | BaseResponse baseResponse = new BaseResponse(); |
| 423 | 425 | LymsPatient patients = lymsPatientService.getById(lymsTkrecord.getPid()); |
| 424 | 426 | |
| 425 | 427 | |
| 426 | 428 | |
| 427 | 429 | |
| ... | ... | @@ -426,38 +428,35 @@ |
| 426 | 428 | LambdaQueryWrapper<LymsTkrecord> wrapper = new QueryWrapper().lambda(); |
| 427 | 429 | wrapper.eq(LymsTkrecord::getPid, lymsTkrecord.getPid()); |
| 428 | 430 | wrapper.orderByDesc(LymsTkrecord::getCreatedtime); |
| 429 | - List<LymsTkrecord> lymsTkrecords = lymsTkcardService.list(wrapper); | |
| 431 | + List<LymsTkrecord> lymsTkrecords = lymsTkcardService.list(wrapper); | |
| 430 | 432 | |
| 431 | 433 | List<Map> list = new ArrayList<>(); |
| 432 | - if (CollectionUtils.isNotEmpty(lymsTkrecords)) | |
| 433 | - { | |
| 434 | - for(LymsTkrecord record : lymsTkrecords) | |
| 435 | - { | |
| 434 | + if (CollectionUtils.isNotEmpty(lymsTkrecords)) { | |
| 435 | + for (LymsTkrecord record : lymsTkrecords) { | |
| 436 | 436 | LymsPcase pcase = lymsPcaseService.getById(record.getPcid()); |
| 437 | 437 | |
| 438 | 438 | Map data = new HashMap(20); |
| 439 | - data.put("hospitalName",pcase.getHname()); | |
| 440 | - data.put("hospitalLevel",""); | |
| 441 | - data.put("doctorName",pcase.getDtname()); | |
| 442 | - data.put("departName",pcase.getDname()); | |
| 443 | - data.put("doctorLevel",""); | |
| 444 | - data.put("patientName",patients.getPname()); | |
| 439 | + data.put("hospitalName", pcase.getHname()); | |
| 440 | + data.put("hospitalLevel", ""); | |
| 441 | + data.put("doctorName", pcase.getDtname()); | |
| 442 | + data.put("departName", pcase.getDname()); | |
| 443 | + data.put("doctorLevel", ""); | |
| 444 | + data.put("patientName", patients.getPname()); | |
| 445 | 445 | |
| 446 | 446 | StringBuilder sb = new StringBuilder(); |
| 447 | 447 | LambdaQueryWrapper<LymsIllness> iwrapper = new QueryWrapper().lambda(); |
| 448 | 448 | iwrapper.like(LymsIllness::getPcid, pcase.getPcid()); |
| 449 | 449 | List<LymsIllness> illnesses = lymsIllnessService.list(iwrapper); |
| 450 | - if (CollectionUtils.isNotEmpty(illnesses)) | |
| 451 | - { | |
| 450 | + if (CollectionUtils.isNotEmpty(illnesses)) { | |
| 452 | 451 | illnesses.forEach(lymsIllness -> { |
| 453 | 452 | sb.append(lymsIllness.getIname()); |
| 454 | 453 | sb.append(" "); |
| 455 | 454 | }); |
| 456 | 455 | } |
| 457 | 456 | |
| 458 | - data.put("iname",sb.toString()); | |
| 459 | - data.put("createTime",DateUtil.getDateTime(record.getCreatedtime(),DateUtil.YYYY_MM_DD)); | |
| 460 | - data.put("stat",record.getStat()); | |
| 457 | + data.put("iname", sb.toString()); | |
| 458 | + data.put("createTime", DateUtil.getDateTime(record.getCreatedtime(), DateUtil.YYYY_MM_DD)); | |
| 459 | + data.put("stat", record.getStat()); | |
| 461 | 460 | |
| 462 | 461 | |
| 463 | 462 | list.add(data); |
| 464 | 463 | |
| 465 | 464 | |
| 466 | 465 | |
| 467 | 466 | |
| ... | ... | @@ -469,33 +468,32 @@ |
| 469 | 468 | |
| 470 | 469 | /** |
| 471 | 470 | * 查询患者关注的医生记录 |
| 471 | + * | |
| 472 | 472 | * @param lymsAttention 传入患者id参数 |
| 473 | 473 | * @return |
| 474 | 474 | */ |
| 475 | 475 | @GetMapping("getPatientAttentions") |
| 476 | - public BaseResponse getPatientAttentions(LymsAttention lymsAttention){ | |
| 476 | + public BaseResponse getPatientAttentions(LymsAttention lymsAttention) { | |
| 477 | 477 | |
| 478 | 478 | BaseResponse baseResponse = new BaseResponse(); |
| 479 | 479 | //查询患者的关注医生记录 |
| 480 | 480 | LambdaQueryWrapper<LymsAttention> wrapper = new QueryWrapper().lambda(); |
| 481 | 481 | wrapper.eq(LymsAttention::getPid, lymsAttention.getPid()); |
| 482 | 482 | wrapper.orderByDesc(LymsAttention::getCreatedtime); |
| 483 | - List<LymsAttention> lymsAttentions = lymsAttentionService.list(wrapper); | |
| 483 | + List<LymsAttention> lymsAttentions = lymsAttentionService.list(wrapper); | |
| 484 | 484 | |
| 485 | 485 | List<Map> list = new ArrayList<>(); |
| 486 | - if (CollectionUtils.isNotEmpty(lymsAttentions)) | |
| 487 | - { | |
| 488 | - for(LymsAttention attention : lymsAttentions) | |
| 489 | - { | |
| 486 | + if (CollectionUtils.isNotEmpty(lymsAttentions)) { | |
| 487 | + for (LymsAttention attention : lymsAttentions) { | |
| 490 | 488 | LymsDoctor doctor = lymsDoctorService.getById(attention.getDid()); |
| 491 | 489 | |
| 492 | 490 | Map data = new HashMap(20); |
| 493 | - data.put("doctorName",doctor.getDname()); | |
| 494 | - data.put("departName",doctor.getDdname()); | |
| 495 | - data.put("doctorLevel",""); | |
| 496 | - data.put("hospitalName",doctor.getHname()); | |
| 497 | - data.put("hospitalLevel",""); | |
| 498 | - data.put("doctorDesc",doctor.getIntro()); | |
| 491 | + data.put("doctorName", doctor.getDname()); | |
| 492 | + data.put("departName", doctor.getDdname()); | |
| 493 | + data.put("doctorLevel", ""); | |
| 494 | + data.put("hospitalName", doctor.getHname()); | |
| 495 | + data.put("hospitalLevel", ""); | |
| 496 | + data.put("doctorDesc", doctor.getIntro()); | |
| 499 | 497 | list.add(data); |
| 500 | 498 | } |
| 501 | 499 | } |