-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathCovid19ServiceImpl.java
More file actions
1349 lines (1145 loc) · 54.3 KB
/
Copy pathCovid19ServiceImpl.java
File metadata and controls
1349 lines (1145 loc) · 54.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* AMRIT – Accessible Medical Records via Integrated Technology
* Integrated EHR (Electronic Health Records) Solution
*
* Copyright (C) "Piramal Swasthya Management and Research Institute"
*
* This file is part of AMRIT.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
package com.iemr.tm.service.covid19;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.iemr.tm.data.anc.BenAllergyHistory;
import com.iemr.tm.data.anc.BenChildDevelopmentHistory;
import com.iemr.tm.data.anc.BenFamilyHistory;
import com.iemr.tm.data.anc.BenMedHistory;
import com.iemr.tm.data.anc.BenMenstrualDetails;
import com.iemr.tm.data.anc.BenPersonalHabit;
import com.iemr.tm.data.anc.ChildFeedingDetails;
import com.iemr.tm.data.anc.PerinatalHistory;
import com.iemr.tm.data.anc.WrapperAncFindings;
import com.iemr.tm.data.anc.WrapperBenInvestigationANC;
import com.iemr.tm.data.anc.WrapperChildOptionalVaccineDetail;
import com.iemr.tm.data.anc.WrapperComorbidCondDetails;
import com.iemr.tm.data.anc.WrapperFemaleObstetricHistory;
import com.iemr.tm.data.anc.WrapperImmunizationHistory;
import com.iemr.tm.data.anc.WrapperMedicationHistory;
import com.iemr.tm.data.covid19.Covid19BenFeedback;
import com.iemr.tm.data.nurse.BenAnthropometryDetail;
import com.iemr.tm.data.nurse.BenPhysicalVitalDetail;
import com.iemr.tm.data.nurse.BeneficiaryVisitDetail;
import com.iemr.tm.data.nurse.CommonUtilityClass;
import com.iemr.tm.data.quickConsultation.PrescribedDrugDetail;
import com.iemr.tm.data.quickConsultation.PrescriptionDetail;
import com.iemr.tm.data.tele_consultation.TeleconsultationRequestOBJ;
import com.iemr.tm.repo.nurse.BenVisitDetailRepo;
import com.iemr.tm.repo.nurse.covid19.Covid19BenFeedbackRepo;
import com.iemr.tm.repo.quickConsultation.PrescriptionDetailRepo;
import com.iemr.tm.service.benFlowStatus.CommonBenStatusFlowServiceImpl;
import com.iemr.tm.service.common.transaction.CommonDoctorServiceImpl;
import com.iemr.tm.service.common.transaction.CommonNurseServiceImpl;
import com.iemr.tm.service.common.transaction.CommonServiceImpl;
import com.iemr.tm.service.labtechnician.LabTechnicianServiceImpl;
import com.iemr.tm.service.tele_consultation.SMSGatewayServiceImpl;
import com.iemr.tm.service.tele_consultation.TeleConsultationServiceImpl;
import com.iemr.tm.utils.mapper.InputMapper;
@Service
public class Covid19ServiceImpl implements Covid19Service {
private Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
@Autowired
private CommonNurseServiceImpl commonNurseServiceImpl;
@Autowired
private CommonDoctorServiceImpl commonDoctorServiceImpl;
@Autowired
private CommonBenStatusFlowServiceImpl commonBenStatusFlowServiceImpl;
@Autowired
private LabTechnicianServiceImpl labTechnicianServiceImpl;
@Autowired
private CommonServiceImpl commonServiceImpl;
@Autowired
private TeleConsultationServiceImpl teleConsultationServiceImpl;
@Autowired
private SMSGatewayServiceImpl sMSGatewayServiceImpl;
@Autowired
private Covid19BenFeedbackRepo covid19BenFeedbackRepo;
@Autowired
private PrescriptionDetailRepo prescriptionDetailRepo;
@Autowired
private BenVisitDetailRepo benVisitDetailRepo;
@Override
public String saveCovid19NurseData(JsonObject requestOBJ, String Authorization) throws Exception {
Long saveSuccessFlag = null;
TeleconsultationRequestOBJ tcRequestOBJ = null;
// check if visit details data is not null
Long benVisitCode = null;
if (requestOBJ != null && requestOBJ.has("visitDetails") && !requestOBJ.get("visitDetails").isJsonNull()) {
CommonUtilityClass nurseUtilityClass = InputMapper.gson().fromJson(requestOBJ, CommonUtilityClass.class);
// Call method to save visit details data
Map<String, Long> visitIdAndCodeMap = saveBenVisitDetails(requestOBJ.getAsJsonObject("visitDetails"),
nurseUtilityClass);
// 07-06-2018 visit code
Long benVisitID = null;
if (visitIdAndCodeMap != null && visitIdAndCodeMap.size() > 0 && visitIdAndCodeMap.containsKey("visitID")
&& visitIdAndCodeMap.containsKey("visitCode")) {
benVisitID = visitIdAndCodeMap.get("visitID");
benVisitCode = visitIdAndCodeMap.get("visitCode");
nurseUtilityClass.setVisitCode(benVisitCode);
nurseUtilityClass.setBenVisitID(benVisitID);
}else {
Map<String, String> responseMap = new HashMap<String, String>();
responseMap.put("response", "Data already saved");
return new Gson().toJson(responseMap);
}
// check if visit details data saved successfully
Long historySaveSuccessFlag = null;
Long vitalSaveSuccessFlag = null;
Integer covidSaveSuccessFlag = null;
Integer i = null;
JsonObject tmpOBJ = requestOBJ.getAsJsonObject("visitDetails").getAsJsonObject("visitDetails");
// Getting benflowID for ben status update
Long benFlowID = null;
// Above if block code replaced by below line
benFlowID = nurseUtilityClass.getBenFlowID();
if (benVisitID != null && benVisitID > 0) {
// save "covid" screening related feedback from beneficiary
Covid19BenFeedback covid19BenFeedbackOBJ = InputMapper.gson().fromJson(
requestOBJ.getAsJsonObject("visitDetails").get("covidDetails"), Covid19BenFeedback.class);
if (covid19BenFeedbackOBJ != null) {
covid19BenFeedbackOBJ.setVisitCode(benVisitCode);
covidSaveSuccessFlag = saveCovidDetails(covid19BenFeedbackOBJ);
} else
covidSaveSuccessFlag = 1;
tcRequestOBJ = commonServiceImpl.createTcRequest(requestOBJ, nurseUtilityClass, Authorization);
// call method to save History data
logger.info("Start saving BenCovid19HistoryDetails for BenVisitID={} and BenVisitCode={}", benVisitID, benVisitCode);
historySaveSuccessFlag = saveBenCovid19HistoryDetails(requestOBJ.getAsJsonObject("historyDetails"),
benVisitID, benVisitCode);
if (historySaveSuccessFlag == null || historySaveSuccessFlag <= 0) {
logger.error("Error in saving BenCovid19HistoryDetails for BenVisitID={} and BenVisitCode={}", benVisitID, benVisitCode);
} else {
logger.info("Successfully saved BenCovid19HistoryDetails for BenVisitID={} and BenVisitCode={}", benVisitID, benVisitCode);
}
// call method to save Vital data
logger.info("Start saving BenCovid19VitalDetails for BenVisitID={} and BenVisitCode={}", benVisitID, benVisitCode);
vitalSaveSuccessFlag = saveBenCovid19VitalDetails(requestOBJ.getAsJsonObject("vitalDetails"),
benVisitID, benVisitCode);
if (vitalSaveSuccessFlag == null || vitalSaveSuccessFlag <= 0) {
logger.error("Error in saving BenCovid19VitalDetails for BenVisitID={} and BenVisitCode={}", benVisitID, benVisitCode);
} else {
logger.info("Successfully saved BenCovid19VitalDetails for BenVisitID={} and BenVisitCode={}", benVisitID, benVisitCode);
}
} else {
throw new RuntimeException("Error occurred while creating beneficiary visit");
}
if ((null != historySaveSuccessFlag && historySaveSuccessFlag > 0)
&& (null != vitalSaveSuccessFlag && vitalSaveSuccessFlag > 0) && (covidSaveSuccessFlag != null)) {
/**
* We have to write new code to update ben status flow new logic
*/
int J = updateBenFlowNurseAfterNurseActivityANC(tmpOBJ, benVisitID, benFlowID, benVisitCode,
nurseUtilityClass.getVanID(), tcRequestOBJ);
if (J > 0)
saveSuccessFlag = historySaveSuccessFlag;
else
throw new RuntimeException("Error occurred while saving data. Beneficiary status update failed");
if (J > 0 && tcRequestOBJ != null && tcRequestOBJ.getWalkIn() == false) {
int k = sMSGatewayServiceImpl.smsSenderGateway("schedule", nurseUtilityClass.getBeneficiaryRegID(),
tcRequestOBJ.getSpecializationID(), tcRequestOBJ.getTmRequestID(), null,
nurseUtilityClass.getCreatedBy(),
tcRequestOBJ.getAllocationDate() != null ? String.valueOf(tcRequestOBJ.getAllocationDate())
: "",
null, Authorization);
}
} else {
throw new RuntimeException("Error occurred while saving data");
}
} else {
throw new Exception("Invalid input");
}
Map<String, String> responseMap = new HashMap<String, String>();
if(benVisitCode!=null)
{
responseMap.put("visitCode",benVisitCode.toString());
}
if (null != saveSuccessFlag && saveSuccessFlag > 0) {
responseMap.put("response", "Data saved successfully");
} else {
responseMap.put("response", "Unable to save data");
}
return new Gson().toJson(responseMap);
}
public void deleteVisitDetails(JsonObject requestOBJ) throws Exception {
if (requestOBJ != null && requestOBJ.has("visitDetails") && !requestOBJ.get("visitDetails").isJsonNull()) {
CommonUtilityClass nurseUtilityClass = InputMapper.gson().fromJson(requestOBJ, CommonUtilityClass.class);
Long visitCode = benVisitDetailRepo.getVisitCode(nurseUtilityClass.getBeneficiaryRegID(),
nurseUtilityClass.getProviderServiceMapID());
if (visitCode != null) {
covid19BenFeedbackRepo.deleteVisitDetails(visitCode);
benVisitDetailRepo.deleteVisitDetails(visitCode);
}
}
}
/**
*
* @param requestOBJ
* @return success or failure flag for visitDetails data saving
*/
public Map<String, Long> saveBenVisitDetails(JsonObject visitDetailsOBJ, CommonUtilityClass nurseUtilityClass)
throws Exception {
Map<String, Long> visitIdAndCodeMap = new HashMap<>();
Long benVisitID = null;
int adherenceSuccessFlag = 0;
int investigationSuccessFlag = 0;
if (visitDetailsOBJ != null && visitDetailsOBJ.has("visitDetails")
&& !visitDetailsOBJ.get("visitDetails").isJsonNull()) {
BeneficiaryVisitDetail benVisitDetailsOBJ = InputMapper.gson().fromJson(visitDetailsOBJ.get("visitDetails"),
BeneficiaryVisitDetail.class);
int i=commonNurseServiceImpl.getMaxCurrentdate(benVisitDetailsOBJ.getBeneficiaryRegID(),benVisitDetailsOBJ.getVisitReason(),benVisitDetailsOBJ.getVisitCategory());
if(i<1) {
benVisitID = commonNurseServiceImpl.saveBeneficiaryVisitDetails(benVisitDetailsOBJ);
// 11-06-2018 visit code
Long benVisitCode = commonNurseServiceImpl.generateVisitCode(benVisitID, nurseUtilityClass.getVanID(),
nurseUtilityClass.getSessionID());
visitIdAndCodeMap.put("visitID", benVisitID);
visitIdAndCodeMap.put("visitCode", benVisitCode);
}
}
return visitIdAndCodeMap;
}
/**
*
* @param requestOBJ
* @return success or failure flag for visitDetails data saving
*/
public Long saveBenCovid19HistoryDetails(JsonObject ncdCareHistoryOBJ, Long benVisitID, Long benVisitCode)
throws Exception {
Long pastHistorySuccessFlag = null;
Long comrbidSuccessFlag = null;
Long medicationSuccessFlag = null;
Long obstetricSuccessFlag = null;
Integer menstrualHistorySuccessFlag = null;
Long familyHistorySuccessFlag = null;
Integer personalHistorySuccessFlag = null;
Long allergyHistorySuccessFlag = null;
Long childVaccineSuccessFlag = null;
Long immunizationSuccessFlag = null;
Long developmentHistorySuccessFlag = null;
Long childFeedingSuccessFlag = null;
Long perinatalHistorySuccessFlag = null;
// Save past History
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("pastHistory")
&& !ncdCareHistoryOBJ.get("pastHistory").isJsonNull()) {
BenMedHistory benMedHistory = InputMapper.gson().fromJson(ncdCareHistoryOBJ.get("pastHistory"),
BenMedHistory.class);
if (null != benMedHistory) {
benMedHistory.setBenVisitID(benVisitID);
benMedHistory.setVisitCode(benVisitCode);
pastHistorySuccessFlag = commonNurseServiceImpl.saveBenPastHistory(benMedHistory);
}
} else {
pastHistorySuccessFlag = new Long(1);
}
// Save Comorbidity/concurrent Conditions
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("comorbidConditions")
&& !ncdCareHistoryOBJ.get("comorbidConditions").isJsonNull()) {
WrapperComorbidCondDetails wrapperComorbidCondDetails = InputMapper.gson()
.fromJson(ncdCareHistoryOBJ.get("comorbidConditions"), WrapperComorbidCondDetails.class);
if (null != wrapperComorbidCondDetails) {
wrapperComorbidCondDetails.setBenVisitID(benVisitID);
wrapperComorbidCondDetails.setVisitCode(benVisitCode);
comrbidSuccessFlag = commonNurseServiceImpl.saveBenComorbidConditions(wrapperComorbidCondDetails);
}
} else {
comrbidSuccessFlag = new Long(1);
}
// Save Medication History
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("medicationHistory")
&& !ncdCareHistoryOBJ.get("medicationHistory").isJsonNull()) {
WrapperMedicationHistory wrapperMedicationHistory = InputMapper.gson()
.fromJson(ncdCareHistoryOBJ.get("medicationHistory"), WrapperMedicationHistory.class);
if (null != wrapperMedicationHistory
&& wrapperMedicationHistory.getBenMedicationHistoryDetails().size() > 0) {
wrapperMedicationHistory.setBenVisitID(benVisitID);
wrapperMedicationHistory.setVisitCode(benVisitCode);
medicationSuccessFlag = commonNurseServiceImpl.saveBenMedicationHistory(wrapperMedicationHistory);
} else {
medicationSuccessFlag = new Long(1);
}
} else {
medicationSuccessFlag = new Long(1);
}
// Save Past Obstetric History
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("femaleObstetricHistory")
&& !ncdCareHistoryOBJ.get("femaleObstetricHistory").isJsonNull()) {
WrapperFemaleObstetricHistory wrapperFemaleObstetricHistory = InputMapper.gson()
.fromJson(ncdCareHistoryOBJ.get("femaleObstetricHistory"), WrapperFemaleObstetricHistory.class);
if (wrapperFemaleObstetricHistory != null) {
wrapperFemaleObstetricHistory.setBenVisitID(benVisitID);
wrapperFemaleObstetricHistory.setVisitCode(benVisitCode);
obstetricSuccessFlag = commonNurseServiceImpl.saveFemaleObstetricHistory(wrapperFemaleObstetricHistory);
} else {
// Female Obstetric Details not provided.
}
} else {
obstetricSuccessFlag = new Long(1);
}
// Save Menstrual History
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("menstrualHistory")
&& !ncdCareHistoryOBJ.get("menstrualHistory").isJsonNull()) {
BenMenstrualDetails menstrualDetails = InputMapper.gson()
.fromJson(ncdCareHistoryOBJ.get("menstrualHistory"), BenMenstrualDetails.class);
if (null != menstrualDetails) {
menstrualDetails.setBenVisitID(benVisitID);
menstrualDetails.setVisitCode(benVisitCode);
menstrualHistorySuccessFlag = commonNurseServiceImpl.saveBenMenstrualHistory(menstrualDetails);
}
} else {
menstrualHistorySuccessFlag = 1;
}
// Save Family History
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("familyHistory")
&& !ncdCareHistoryOBJ.get("familyHistory").isJsonNull()) {
BenFamilyHistory benFamilyHistory = InputMapper.gson().fromJson(ncdCareHistoryOBJ.get("familyHistory"),
BenFamilyHistory.class);
if (null != benFamilyHistory) {
benFamilyHistory.setBenVisitID(benVisitID);
benFamilyHistory.setVisitCode(benVisitCode);
familyHistorySuccessFlag = commonNurseServiceImpl.saveBenFamilyHistory(benFamilyHistory);
}
} else {
familyHistorySuccessFlag = new Long(1);
}
// Save Personal History
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("personalHistory")
&& !ncdCareHistoryOBJ.get("personalHistory").isJsonNull()) {
// Save Ben Personal Habits..
BenPersonalHabit personalHabit = InputMapper.gson().fromJson(ncdCareHistoryOBJ.get("personalHistory"),
BenPersonalHabit.class);
if (null != personalHabit) {
personalHabit.setBenVisitID(benVisitID);
personalHabit.setVisitCode(benVisitCode);
personalHistorySuccessFlag = commonNurseServiceImpl.savePersonalHistory(personalHabit);
}
BenAllergyHistory benAllergyHistory = InputMapper.gson().fromJson(ncdCareHistoryOBJ.get("personalHistory"),
BenAllergyHistory.class);
if (null != benAllergyHistory) {
benAllergyHistory.setBenVisitID(benVisitID);
benAllergyHistory.setVisitCode(benVisitCode);
allergyHistorySuccessFlag = commonNurseServiceImpl.saveAllergyHistory(benAllergyHistory);
}
} else {
personalHistorySuccessFlag = 1;
allergyHistorySuccessFlag = new Long(1);
}
// Save Other/Optional Vaccines History
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("childVaccineDetails")
&& !ncdCareHistoryOBJ.get("childVaccineDetails").isJsonNull()) {
WrapperChildOptionalVaccineDetail wrapperChildVaccineDetail = InputMapper.gson()
.fromJson(ncdCareHistoryOBJ.get("childVaccineDetails"), WrapperChildOptionalVaccineDetail.class);
if (null != wrapperChildVaccineDetail) {
wrapperChildVaccineDetail.setBenVisitID(benVisitID);
wrapperChildVaccineDetail.setVisitCode(benVisitCode);
childVaccineSuccessFlag = commonNurseServiceImpl
.saveChildOptionalVaccineDetail(wrapperChildVaccineDetail);
} else {
// Child Optional Vaccine Detail not provided.
}
} else {
childVaccineSuccessFlag = new Long(1);
}
// Save Immunization History
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("immunizationHistory")
&& !ncdCareHistoryOBJ.get("immunizationHistory").isJsonNull()) {
WrapperImmunizationHistory wrapperImmunizationHistory = InputMapper.gson()
.fromJson(ncdCareHistoryOBJ.get("immunizationHistory"), WrapperImmunizationHistory.class);
if (null != wrapperImmunizationHistory) {
wrapperImmunizationHistory.setBenVisitID(benVisitID);
wrapperImmunizationHistory.setVisitCode(benVisitCode);
immunizationSuccessFlag = commonNurseServiceImpl.saveImmunizationHistory(wrapperImmunizationHistory);
} else {
// ImmunizationList Data not Available
}
} else {
immunizationSuccessFlag = new Long(1);
}
// Save Development History
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("developmentHistory")
&& !ncdCareHistoryOBJ.get("developmentHistory").isJsonNull()) {
BenChildDevelopmentHistory benChildDevelopmentHistory = InputMapper.gson()
.fromJson(ncdCareHistoryOBJ.get("developmentHistory"), BenChildDevelopmentHistory.class);
if (null != benChildDevelopmentHistory) {
benChildDevelopmentHistory.setBenVisitID(benVisitID);
benChildDevelopmentHistory.setVisitCode(benVisitCode);
developmentHistorySuccessFlag = commonNurseServiceImpl
.saveChildDevelopmentHistory(benChildDevelopmentHistory);
}
} else {
developmentHistorySuccessFlag = new Long(1);
}
// Save Feeding History
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("feedingHistory")
&& !ncdCareHistoryOBJ.get("feedingHistory").isJsonNull()) {
ChildFeedingDetails childFeedingDetails = InputMapper.gson()
.fromJson(ncdCareHistoryOBJ.get("feedingHistory"), ChildFeedingDetails.class);
if (null != childFeedingDetails) {
childFeedingDetails.setBenVisitID(benVisitID);
childFeedingDetails.setVisitCode(benVisitCode);
childFeedingSuccessFlag = commonNurseServiceImpl.saveChildFeedingHistory(childFeedingDetails);
}
}
{
childFeedingSuccessFlag = new Long(1);
}
// Save Perinatal Histroy
if (ncdCareHistoryOBJ != null && ncdCareHistoryOBJ.has("perinatalHistroy")
&& !ncdCareHistoryOBJ.get("perinatalHistroy").isJsonNull()) {
PerinatalHistory perinatalHistory = InputMapper.gson().fromJson(ncdCareHistoryOBJ.get("perinatalHistroy"),
PerinatalHistory.class);
if (null != perinatalHistory) {
perinatalHistory.setBenVisitID(benVisitID);
perinatalHistory.setVisitCode(benVisitCode);
perinatalHistorySuccessFlag = commonNurseServiceImpl.savePerinatalHistory(perinatalHistory);
}
}
{
perinatalHistorySuccessFlag = new Long(1);
}
Long historySaveSucccessFlag = null;
if ((null != pastHistorySuccessFlag && pastHistorySuccessFlag > 0)
&& (null != comrbidSuccessFlag && comrbidSuccessFlag > 0)
&& (null != medicationSuccessFlag && medicationSuccessFlag > 0)
&& (null != obstetricSuccessFlag && obstetricSuccessFlag > 0)
&& (null != menstrualHistorySuccessFlag && menstrualHistorySuccessFlag > 0)
&& (null != familyHistorySuccessFlag && familyHistorySuccessFlag > 0)
&& (null != personalHistorySuccessFlag && personalHistorySuccessFlag > 0)
&& (null != allergyHistorySuccessFlag && allergyHistorySuccessFlag > 0)
&& (null != childVaccineSuccessFlag && childVaccineSuccessFlag > 0)
&& (null != immunizationSuccessFlag && immunizationSuccessFlag > 0)
&& (null != developmentHistorySuccessFlag && developmentHistorySuccessFlag > 0)
&& (null != childFeedingSuccessFlag && childFeedingSuccessFlag > 0)
&& (null != perinatalHistorySuccessFlag && perinatalHistorySuccessFlag > 0)) {
historySaveSucccessFlag = pastHistorySuccessFlag;
}
return historySaveSucccessFlag;
}
/**
*
* @param requestOBJ
* @return success or failure flag for visitDetails data saving
*/
public Long saveBenCovid19VitalDetails(JsonObject vitalDetailsOBJ, Long benVisitID, Long benVisitCode)
throws Exception {
Long vitalSuccessFlag = null;
Long anthropometrySuccessFlag = null;
Long phyVitalSuccessFlag = null;
// Save Physical Anthropometry && Physical Vital Details
if (vitalDetailsOBJ != null) {
BenAnthropometryDetail benAnthropometryDetail = InputMapper.gson().fromJson(vitalDetailsOBJ,
BenAnthropometryDetail.class);
BenPhysicalVitalDetail benPhysicalVitalDetail = InputMapper.gson().fromJson(vitalDetailsOBJ,
BenPhysicalVitalDetail.class);
if (null != benAnthropometryDetail) {
benAnthropometryDetail.setBenVisitID(benVisitID);
benAnthropometryDetail.setVisitCode(benVisitCode);
anthropometrySuccessFlag = commonNurseServiceImpl
.saveBeneficiaryPhysicalAnthropometryDetails(benAnthropometryDetail);
}
if (null != benPhysicalVitalDetail) {
benPhysicalVitalDetail.setBenVisitID(benVisitID);
benPhysicalVitalDetail.setVisitCode(benVisitCode);
phyVitalSuccessFlag = commonNurseServiceImpl
.saveBeneficiaryPhysicalVitalDetails(benPhysicalVitalDetail);
}
if (anthropometrySuccessFlag != null && anthropometrySuccessFlag > 0 && phyVitalSuccessFlag != null
&& phyVitalSuccessFlag > 0) {
vitalSuccessFlag = anthropometrySuccessFlag;
}
}
return vitalSuccessFlag;
}
// method for updating ben flow status flag for nurse
private int updateBenFlowNurseAfterNurseActivityANC(JsonObject tmpOBJ, Long benVisitID, Long benFlowID,
Long benVisitCode, Integer vanID, TeleconsultationRequestOBJ tcRequestOBJ) {
short nurseFlag;
short docFlag;
short labIteration;
short specialistFlag = (short) 0;
Timestamp tcDate = null;
Integer tcSpecialistUserID = null;
nurseFlag = (short) 9;
docFlag = (short) 1;
labIteration = (short) 0;
if (tcRequestOBJ != null && tcRequestOBJ.getUserID() != null && tcRequestOBJ.getAllocationDate() != null) {
specialistFlag = (short) 1;
tcDate = tcRequestOBJ.getAllocationDate();
tcSpecialistUserID = tcRequestOBJ.getUserID();
} else
specialistFlag = (short) 0;
int rs = commonBenStatusFlowServiceImpl.updateBenFlowNurseAfterNurseActivity(benFlowID,
tmpOBJ.get("beneficiaryRegID").getAsLong(), benVisitID, tmpOBJ.get("visitReason").getAsString(),
tmpOBJ.get("visitCategory").getAsString(), nurseFlag, docFlag, labIteration, (short) 0, (short) 0,
benVisitCode, vanID, specialistFlag, tcDate, tcSpecialistUserID);
return rs;
}
public String getBenVisitDetailsFrmNurseCovid19(Long benRegID, Long visitCode) {
Map<String, Object> resMap = new HashMap<>();
BeneficiaryVisitDetail visitDetail = commonNurseServiceImpl.getCSVisitDetails(benRegID, visitCode);
Covid19BenFeedback covid19BenFeedback = getCovidDetails(benRegID, visitCode);
resMap.put("covid19NurseVisitDetail", new Gson().toJson(visitDetail));
resMap.put("covidDetails", new Gson().toJson(covid19BenFeedback));
return resMap.toString();
}
private Covid19BenFeedback getCovidDetails(Long benRegID, Long visitCode) {
Covid19BenFeedback obj = covid19BenFeedbackRepo.findByBeneficiaryRegIDAndVisitCode(benRegID, visitCode);
if (obj != null) {
if (obj.getSymptoms_db() != null) {
String[] symptomsArr = obj.getSymptoms_db().split("\\|\\|");
if (symptomsArr != null)
obj.setSymptoms(symptomsArr);
}
if (obj.getTravelType() != null) {
String[] treavelTypeArr = obj.getTravelType().split("\\|\\|");
if (treavelTypeArr != null)
obj.setTravelList(treavelTypeArr);
}
if (obj.getcOVID19_contact_history() != null) {
String[] contactHistoryArr = obj.getcOVID19_contact_history().split("\\|\\|");
if (contactHistoryArr != null)
obj.setContactStatus(contactHistoryArr);
}
if (obj.getRecommendation_db() != null) {
ArrayList<String[]> recommendationList = new ArrayList<>();
String[] recommendationArr = obj.getRecommendation_db().split("\\|\\|");
if (recommendationArr != null) {
recommendationList.add(recommendationArr);
obj.setRecommendation((recommendationList));
}
}
if (obj.getSuspectedStatus() != null) {
if (obj.getSuspectedStatus())
obj.setSuspectedStatusUI("YES");
else
obj.setSuspectedStatusUI("NO");
}
}
return obj;
}
public String getBenCovid19HistoryDetails(Long benRegID, Long visitCode) {
Map<String, Object> HistoryDetailsMap = new HashMap<String, Object>();
HistoryDetailsMap.put("PastHistory", commonNurseServiceImpl.getPastHistoryData(benRegID, visitCode));
HistoryDetailsMap.put("ComorbidityConditions",
commonNurseServiceImpl.getComorbidityConditionsHistory(benRegID, visitCode));
HistoryDetailsMap.put("MedicationHistory", commonNurseServiceImpl.getMedicationHistory(benRegID, visitCode));
HistoryDetailsMap.put("PersonalHistory", commonNurseServiceImpl.getPersonalHistory(benRegID, visitCode));
HistoryDetailsMap.put("FamilyHistory", commonNurseServiceImpl.getFamilyHistory(benRegID, visitCode));
HistoryDetailsMap.put("MenstrualHistory", commonNurseServiceImpl.getMenstrualHistory(benRegID, visitCode));
HistoryDetailsMap.put("FemaleObstetricHistory",
commonNurseServiceImpl.getFemaleObstetricHistory(benRegID, visitCode));
HistoryDetailsMap.put("ImmunizationHistory",
commonNurseServiceImpl.getImmunizationHistory(benRegID, visitCode));
HistoryDetailsMap.put("childOptionalVaccineHistory",
commonNurseServiceImpl.getChildOptionalVaccineHistory(benRegID, visitCode));
HistoryDetailsMap.put("DevelopmentHistory", commonNurseServiceImpl.getDevelopmentHistory(benRegID, visitCode));
HistoryDetailsMap.put("PerinatalHistory", commonNurseServiceImpl.getPerinatalHistory(benRegID, visitCode));
HistoryDetailsMap.put("FeedingHistory", commonNurseServiceImpl.getFeedingHistory(benRegID, visitCode));
return new Gson().toJson(HistoryDetailsMap);
}
public String getBeneficiaryVitalDetails(Long beneficiaryRegID, Long visitCode) {
Map<String, Object> resMap = new HashMap<>();
resMap.put("benAnthropometryDetail",
commonNurseServiceImpl.getBeneficiaryPhysicalAnthropometryDetails(beneficiaryRegID, visitCode));
resMap.put("benPhysicalVitalDetail",
commonNurseServiceImpl.getBeneficiaryPhysicalVitalDetails(beneficiaryRegID, visitCode));
return resMap.toString();
}
public Integer saveCovidDetails(Covid19BenFeedback covid19BenFeedbackOBJ) {
if (covid19BenFeedbackOBJ != null && covid19BenFeedbackOBJ.getSymptoms() != null
&& covid19BenFeedbackOBJ.getSymptoms().length > 0) {
StringBuffer sb = new StringBuffer("");
int pointer = 1;
for (String s : covid19BenFeedbackOBJ.getSymptoms()) {
if (pointer == covid19BenFeedbackOBJ.getSymptoms().length)
sb.append(s);
else
sb.append(s + "||");
pointer++;
}
covid19BenFeedbackOBJ.setSymptoms_db(sb.toString());
}
if (covid19BenFeedbackOBJ != null && covid19BenFeedbackOBJ.getContactStatus() != null
&& covid19BenFeedbackOBJ.getContactStatus().length > 0) {
StringBuffer sb = new StringBuffer("");
int pointer = 1;
for (String s : covid19BenFeedbackOBJ.getContactStatus()) {
if (pointer == covid19BenFeedbackOBJ.getContactStatus().length)
sb.append(s);
else
sb.append(s + "||");
pointer++;
}
covid19BenFeedbackOBJ.setcOVID19_contact_history(sb.toString());
}
if (covid19BenFeedbackOBJ != null && covid19BenFeedbackOBJ.getTravelList() != null
&& covid19BenFeedbackOBJ.getTravelList().length > 0) {
StringBuffer sb = new StringBuffer("");
int pointer = 1;
for (String s : covid19BenFeedbackOBJ.getTravelList()) {
if (pointer == covid19BenFeedbackOBJ.getTravelList().length)
sb.append(s);
else
sb.append(s + "||");
pointer++;
}
covid19BenFeedbackOBJ.setTravelType(sb.toString());
}
if (covid19BenFeedbackOBJ != null && covid19BenFeedbackOBJ.getRecommendation() != null
&& covid19BenFeedbackOBJ.getRecommendation().size() > 0) {
StringBuffer sb = new StringBuffer("");
int pointer = 1;
for (String s : covid19BenFeedbackOBJ.getRecommendation().get(0)) {
if (pointer == covid19BenFeedbackOBJ.getRecommendation().get(0).length)
sb.append(s);
else
sb.append(s + "||");
pointer++;
}
covid19BenFeedbackOBJ.setRecommendation_db(sb.toString());
}
if (covid19BenFeedbackOBJ.getSuspectedStatusUI().equalsIgnoreCase("YES"))
covid19BenFeedbackOBJ.setSuspectedStatus(true);
else if (covid19BenFeedbackOBJ.getSuspectedStatusUI().equalsIgnoreCase("NO"))
covid19BenFeedbackOBJ.setSuspectedStatus(false);
Covid19BenFeedback resultSetObj = covid19BenFeedbackRepo.save(covid19BenFeedbackOBJ);
if (resultSetObj != null && resultSetObj.getcOVID19ID() > 0)
return 1;
else
return null;
}
/**
* Update Services
*/
/**
* @param requestOBJ
* @return success or failure flag for General OPD History updating by Doctor
*/
@Transactional(rollbackFor = Exception.class)
public int updateBenHistoryDetails(JsonObject historyOBJ) throws Exception {
int pastHistorySuccessFlag = 0;
int comrbidSuccessFlag = 0;
int medicationSuccessFlag = 0;
int personalHistorySuccessFlag = 0;
int allergyHistorySuccessFlag = 0;
int familyHistorySuccessFlag = 0;
int menstrualHistorySuccessFlag = 0;
int obstetricSuccessFlag = 0;
int childVaccineSuccessFlag = 0;
int childFeedingSuccessFlag = 0;
int perinatalHistorySuccessFlag = 0;
int developmentHistorySuccessFlag = 0;
int immunizationSuccessFlag = 0;
// Update Past History
if (historyOBJ != null && historyOBJ.has("pastHistory") && !historyOBJ.get("pastHistory").isJsonNull()) {
BenMedHistory benMedHistory = InputMapper.gson().fromJson(historyOBJ.get("pastHistory"),
BenMedHistory.class);
pastHistorySuccessFlag = commonNurseServiceImpl.updateBenPastHistoryDetails(benMedHistory);
} else {
pastHistorySuccessFlag = 1;
}
// Update Comorbidity/concurrent Conditions
if (historyOBJ != null && historyOBJ.has("comorbidConditions")
&& !historyOBJ.get("comorbidConditions").isJsonNull()) {
WrapperComorbidCondDetails wrapperComorbidCondDetails = InputMapper.gson()
.fromJson(historyOBJ.get("comorbidConditions"), WrapperComorbidCondDetails.class);
comrbidSuccessFlag = commonNurseServiceImpl.updateBenComorbidConditions(wrapperComorbidCondDetails);
} else {
comrbidSuccessFlag = 1;
}
// Update Medication History
if (historyOBJ != null && historyOBJ.has("medicationHistory")
&& !historyOBJ.get("medicationHistory").isJsonNull()) {
WrapperMedicationHistory wrapperMedicationHistory = InputMapper.gson()
.fromJson(historyOBJ.get("medicationHistory"), WrapperMedicationHistory.class);
medicationSuccessFlag = commonNurseServiceImpl.updateBenMedicationHistory(wrapperMedicationHistory);
} else {
medicationSuccessFlag = 1;
}
// Update Personal History
if (historyOBJ != null && historyOBJ.has("personalHistory")
&& !historyOBJ.get("personalHistory").isJsonNull()) {
// Update Ben Personal Habits..
BenPersonalHabit personalHabit = InputMapper.gson().fromJson(historyOBJ.get("personalHistory"),
BenPersonalHabit.class);
personalHistorySuccessFlag = commonNurseServiceImpl.updateBenPersonalHistory(personalHabit);
// Update Ben Allergy History..
BenAllergyHistory benAllergyHistory = InputMapper.gson().fromJson(historyOBJ.get("personalHistory"),
BenAllergyHistory.class);
allergyHistorySuccessFlag = commonNurseServiceImpl.updateBenAllergicHistory(benAllergyHistory);
} else {
allergyHistorySuccessFlag = 1;
personalHistorySuccessFlag = 1;
}
// Update Family History
if (historyOBJ != null && historyOBJ.has("familyHistory") && !historyOBJ.get("familyHistory").isJsonNull()) {
BenFamilyHistory benFamilyHistory = InputMapper.gson().fromJson(historyOBJ.get("familyHistory"),
BenFamilyHistory.class);
familyHistorySuccessFlag = commonNurseServiceImpl.updateBenFamilyHistory(benFamilyHistory);
} else {
familyHistorySuccessFlag = 1;
}
// Update Menstrual History
if (historyOBJ != null && historyOBJ.has("menstrualHistory")
&& !historyOBJ.get("menstrualHistory").isJsonNull()) {
BenMenstrualDetails menstrualDetails = InputMapper.gson().fromJson(historyOBJ.get("menstrualHistory"),
BenMenstrualDetails.class);
menstrualHistorySuccessFlag = commonNurseServiceImpl.updateMenstrualHistory(menstrualDetails);
} else {
menstrualHistorySuccessFlag = 1;
}
// Update Past Obstetric History
if (historyOBJ != null && historyOBJ.has("femaleObstetricHistory")
&& !historyOBJ.get("femaleObstetricHistory").isJsonNull()) {
WrapperFemaleObstetricHistory wrapperFemaleObstetricHistory = InputMapper.gson()
.fromJson(historyOBJ.get("femaleObstetricHistory"), WrapperFemaleObstetricHistory.class);
obstetricSuccessFlag = commonNurseServiceImpl.updatePastObstetricHistory(wrapperFemaleObstetricHistory);
} else {
obstetricSuccessFlag = 1;
}
if (historyOBJ != null && historyOBJ.has("immunizationHistory")
&& !historyOBJ.get("immunizationHistory").isJsonNull()) {
JsonObject immunizationHistory = historyOBJ.getAsJsonObject("immunizationHistory");
if (immunizationHistory.get("immunizationList") != null
&& immunizationHistory.getAsJsonArray("immunizationList").size() > 0) {
WrapperImmunizationHistory wrapperImmunizationHistory = InputMapper.gson()
.fromJson(historyOBJ.get("immunizationHistory"), WrapperImmunizationHistory.class);
immunizationSuccessFlag = commonNurseServiceImpl
.updateChildImmunizationDetail(wrapperImmunizationHistory);
} else {
immunizationSuccessFlag = 1;
}
} else {
immunizationSuccessFlag = 1;
}
// Update Other/Optional Vaccines History
if (historyOBJ != null && historyOBJ.has("childVaccineDetails")
&& !historyOBJ.get("childVaccineDetails").isJsonNull()) {
WrapperChildOptionalVaccineDetail wrapperChildVaccineDetail = InputMapper.gson()
.fromJson(historyOBJ.get("childVaccineDetails"), WrapperChildOptionalVaccineDetail.class);
childVaccineSuccessFlag = commonNurseServiceImpl
.updateChildOptionalVaccineDetail(wrapperChildVaccineDetail);
} else {
childVaccineSuccessFlag = 1;
}
// Update ChildFeeding History
if (historyOBJ != null && historyOBJ.has("feedingHistory") && !historyOBJ.get("feedingHistory").isJsonNull()) {
ChildFeedingDetails childFeedingDetails = InputMapper.gson().fromJson(historyOBJ.get("feedingHistory"),
ChildFeedingDetails.class);
if (null != childFeedingDetails) {
childFeedingSuccessFlag = commonNurseServiceImpl.updateChildFeedingHistory(childFeedingDetails);
}
} else {
childFeedingSuccessFlag = 1;
}
// Update Perinatal History
if (historyOBJ != null && historyOBJ.has("perinatalHistroy")
&& !historyOBJ.get("perinatalHistroy").isJsonNull()) {
PerinatalHistory perinatalHistory = InputMapper.gson().fromJson(historyOBJ.get("perinatalHistroy"),
PerinatalHistory.class);
if (null != perinatalHistory) {
perinatalHistorySuccessFlag = commonNurseServiceImpl.updatePerinatalHistory(perinatalHistory);
}
} else {
perinatalHistorySuccessFlag = 1;
}
// Update Development History
if (historyOBJ != null && historyOBJ.has("developmentHistory")
&& !historyOBJ.get("developmentHistory").isJsonNull()) {
BenChildDevelopmentHistory benChildDevelopmentHistory = InputMapper.gson()
.fromJson(historyOBJ.get("developmentHistory"), BenChildDevelopmentHistory.class);
if (null != benChildDevelopmentHistory) {
developmentHistorySuccessFlag = commonNurseServiceImpl
.updateChildDevelopmentHistory(benChildDevelopmentHistory);
}
} else {
developmentHistorySuccessFlag = 1;
}
int historyUpdateSuccessFlag = 0;
if (pastHistorySuccessFlag > 0 && comrbidSuccessFlag > 0 && medicationSuccessFlag > 0
&& allergyHistorySuccessFlag > 0 && familyHistorySuccessFlag > 0 && obstetricSuccessFlag > 0
&& childVaccineSuccessFlag > 0 && personalHistorySuccessFlag > 0 && menstrualHistorySuccessFlag > 0
&& immunizationSuccessFlag > 0 && childFeedingSuccessFlag > 0 && perinatalHistorySuccessFlag > 0
&& developmentHistorySuccessFlag > 0) {
historyUpdateSuccessFlag = pastHistorySuccessFlag;
}
return historyUpdateSuccessFlag;
}
/**
* @param requestOBJ
* @return success or failure flag for vitals data updating
*/
@Transactional(rollbackFor = Exception.class)
public int updateBenVitalDetails(JsonObject vitalDetailsOBJ) throws Exception {
int vitalSuccessFlag = 0;
int anthropometrySuccessFlag = 0;
int phyVitalSuccessFlag = 0;
// Save Physical Anthropometry && Physical Vital Details
if (vitalDetailsOBJ != null) {
BenAnthropometryDetail benAnthropometryDetail = InputMapper.gson().fromJson(vitalDetailsOBJ,
BenAnthropometryDetail.class);
BenPhysicalVitalDetail benPhysicalVitalDetail = InputMapper.gson().fromJson(vitalDetailsOBJ,
BenPhysicalVitalDetail.class);
anthropometrySuccessFlag = commonNurseServiceImpl.updateANCAnthropometryDetails(benAnthropometryDetail);
phyVitalSuccessFlag = commonNurseServiceImpl.updateANCPhysicalVitalDetails(benPhysicalVitalDetail);
if (anthropometrySuccessFlag > 0 && phyVitalSuccessFlag > 0) {
vitalSuccessFlag = anthropometrySuccessFlag;
}
} else {
vitalSuccessFlag = 1;
}
return vitalSuccessFlag;
}
// get nurse data
public String getBenCovidNurseData(Long benRegID, Long visitCode) {
Map<String, Object> resMap = new HashMap<>();
resMap.put("covidDetails", new Gson().toJson(getCovidDetails(benRegID, visitCode)));
resMap.put("vitals", getBeneficiaryVitalDetails(benRegID, visitCode));
resMap.put("history", getBenCovid19HistoryDetails(benRegID, visitCode));
return resMap.toString();
}
/// --------------- start of saving doctor data ------------------------
@Transactional(rollbackFor = Exception.class)
public Long saveDoctorData(JsonObject requestOBJ, String Authorization) throws Exception {
Long saveSuccessFlag = null;
Long prescriptionID = null;
Long investigationSuccessFlag = null;
Integer findingSuccessFlag = null;
Integer prescriptionSuccessFlag = null;
// Long diagnosisSuccessFlag = null;
Long referSaveSuccessFlag = null;
Integer tcRequestStatusFlag = null;
if (requestOBJ != null) {
TeleconsultationRequestOBJ tcRequestOBJ = null;
CommonUtilityClass commonUtilityClass = InputMapper.gson().fromJson(requestOBJ, CommonUtilityClass.class);
tcRequestOBJ = commonServiceImpl.createTcRequest(requestOBJ, commonUtilityClass, Authorization);
JsonArray testList = null;
JsonArray drugList = null;
Boolean isTestPrescribed = false;
Boolean isMedicinePrescribed = false;