|
@@ -40,6 +40,7 @@ func HisManagerApiRegistRouters() {
|
40
|
40
|
beego.Router("/api/hisprescription/info", &HisApiController{}, "get:GetHisPrescriptionInfo")
|
41
|
41
|
|
42
|
42
|
beego.Router("/api/hisprescription/create", &HisApiController{}, "post:CreateHisPrescription")
|
|
43
|
+ beego.Router("/api/hisprescription/edit", &HisApiController{}, "post:EditHisPrescription")
|
43
|
44
|
|
44
|
45
|
beego.Router("/api/doctorworkstation/casehistory/list", &HisApiController{}, "get:GetHisPatientCaseHistoryList")
|
45
|
46
|
beego.Router("/api/doctorworkstation/casehistory/get", &HisApiController{}, "get:GetHisPatientCaseHistory")
|
|
@@ -69,6 +70,13 @@ func HisManagerApiRegistRouters() {
|
69
|
70
|
beego.Router("/api/hisprescription/get", &DialysisApiController{}, "Get:GetLastOrNextHisPrescription")
|
70
|
71
|
|
71
|
72
|
beego.Router("/api/callhisprescription/get", &DialysisApiController{}, "Get:GetCallHisPrescription")
|
|
73
|
+
|
|
74
|
+ beego.Router("/api/dayprescription/get", &HisApiController{}, "get:GetHisDayPrescription")
|
|
75
|
+
|
|
76
|
+ beego.Router("/api/charge/list", &HisApiController{}, "get:GetHisChargePatientList")
|
|
77
|
+
|
|
78
|
+ beego.Router("/api/unregister/list", &HisApiController{}, "get:GetHisUnRegisterPatientList")
|
|
79
|
+
|
72
|
80
|
}
|
73
|
81
|
|
74
|
82
|
func (c *HisApiController) Sscard() {
|
|
@@ -131,7 +139,10 @@ func (c *HisApiController) GetHisPatientList() {
|
131
|
139
|
}
|
132
|
140
|
recordDateTime := theTime.Unix()
|
133
|
141
|
adminInfo := c.GetAdminUserInfo()
|
134
|
|
- patients, _ := service.GetHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
142
|
+ patients, _ := service.GetScheduleHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
143
|
+ patients_two, _ := service.GetHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
144
|
+ patients = append(patients, patients_two...)
|
|
145
|
+
|
135
|
146
|
var total_one int64
|
136
|
147
|
var total_two int64
|
137
|
148
|
|
|
@@ -162,7 +173,7 @@ func (c *HisApiController) GetHisPatientList() {
|
162
|
173
|
})
|
163
|
174
|
|
164
|
175
|
} else if types == 1 { //未就诊
|
165
|
|
- var patientsOne []*service.Schedule
|
|
176
|
+ var patientsOne []*service.Patients
|
166
|
177
|
for _, item := range patients {
|
167
|
178
|
if item.HisPrescription == nil || len(item.HisPrescription) <= 0 {
|
168
|
179
|
patientsOne = append(patientsOne, item)
|
|
@@ -178,7 +189,7 @@ func (c *HisApiController) GetHisPatientList() {
|
178
|
189
|
})
|
179
|
190
|
|
180
|
191
|
} else if types == 2 { //已就诊
|
181
|
|
- var patientsTwo []*service.Schedule
|
|
192
|
+ var patientsTwo []*service.Patients
|
182
|
193
|
for _, item := range patients {
|
183
|
194
|
|
184
|
195
|
if item.HisPrescription != nil && len(item.HisPrescription) > 0 {
|
|
@@ -201,6 +212,9 @@ func (c *HisApiController) GetHisPatientInfo() {
|
201
|
212
|
record_date := c.GetString("record_date")
|
202
|
213
|
number := c.GetString("number")
|
203
|
214
|
|
|
215
|
+ start_time := c.GetString("start_time")
|
|
216
|
+ end_time := c.GetString("end_time")
|
|
217
|
+
|
204
|
218
|
timeLayout := "2006-01-02"
|
205
|
219
|
loc, _ := time.LoadLocation("Local")
|
206
|
220
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
@@ -210,25 +224,34 @@ func (c *HisApiController) GetHisPatientInfo() {
|
210
|
224
|
}
|
211
|
225
|
recordDateTime := theTime.Unix()
|
212
|
226
|
|
|
227
|
+ startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
228
|
+ if err != nil {
|
|
229
|
+
|
|
230
|
+ }
|
|
231
|
+ startRecordDateTime := startTime.Unix()
|
|
232
|
+
|
|
233
|
+ endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
234
|
+ if err != nil {
|
|
235
|
+
|
|
236
|
+ }
|
|
237
|
+ endRecordDateTime := endTime.Unix()
|
|
238
|
+
|
213
|
239
|
admin := c.GetAdminUserInfo()
|
214
|
240
|
his_patient_info, _ := service.GetHisPatientInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
215
|
241
|
xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
|
216
|
242
|
prescriptions, _ := service.GetHisPrescription(admin.CurrentOrgId, patient_id, recordDateTime)
|
217
|
|
-
|
|
243
|
+ monthPrescriptions, _ := service.GetMonthHisPrescription(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
|
218
|
244
|
case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
219
|
245
|
patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
220
|
|
- lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
221
|
246
|
order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
|
222
|
|
- //addtions, _ := service.GetAllAdditionCharge(admin.CurrentOrgId, patient_id, recordDateTime)
|
223
|
|
-
|
224
|
247
|
c.ServeSuccessJSON(map[string]interface{}{
|
225
|
|
- "his_info": his_patient_info,
|
226
|
|
- "xt_info": xt_patient_info,
|
227
|
|
- "prescription": prescriptions,
|
228
|
|
- "case_history": case_history,
|
229
|
|
- "info": patientPrescriptionInfo,
|
230
|
|
- "last_info": lastPatientPrescriptionInfo,
|
231
|
|
- "order": order,
|
|
248
|
+ "his_info": his_patient_info,
|
|
249
|
+ "xt_info": xt_patient_info,
|
|
250
|
+ "prescription": prescriptions,
|
|
251
|
+ "case_history": case_history,
|
|
252
|
+ "info": patientPrescriptionInfo,
|
|
253
|
+ "month_prescriptions": monthPrescriptions,
|
|
254
|
+ "order": order,
|
232
|
255
|
})
|
233
|
256
|
return
|
234
|
257
|
|
|
@@ -526,6 +549,236 @@ func (c *HisApiController) CreateHisPrescription() {
|
526
|
549
|
return
|
527
|
550
|
}
|
528
|
551
|
}
|
|
552
|
+func (c *HisApiController) EditHisPrescription() {
|
|
553
|
+ record_date := c.GetString("record_date")
|
|
554
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
555
|
+ reg_type, _ := c.GetInt64("reg_type")
|
|
556
|
+ diagnose, _ := c.GetInt64("diagnose")
|
|
557
|
+ sick_type, _ := c.GetInt64("sick_type")
|
|
558
|
+ sick_history := c.GetString("sick_history")
|
|
559
|
+ doctor_id, _ := c.GetInt64("doctor", 0)
|
|
560
|
+ department, _ := c.GetInt64("department", 0)
|
|
561
|
+ his_patient_id, _ := c.GetInt64("his_patient_id")
|
|
562
|
+ dataBody := make(map[string]interface{}, 0)
|
|
563
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
|
|
564
|
+ if err != nil {
|
|
565
|
+ utils.ErrorLog(err.Error())
|
|
566
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
567
|
+ return
|
|
568
|
+ }
|
|
569
|
+
|
|
570
|
+ timeLayout := "2006-01-02"
|
|
571
|
+ loc, _ := time.LoadLocation("Local")
|
|
572
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
573
|
+ if err != nil {
|
|
574
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
575
|
+ return
|
|
576
|
+ }
|
|
577
|
+ adminInfo := c.GetAdminUserInfo()
|
|
578
|
+ recordDateTime := theTime.Unix()
|
|
579
|
+
|
|
580
|
+ role, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, doctor_id)
|
|
581
|
+
|
|
582
|
+ info, _ := service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, patient_id, recordDateTime)
|
|
583
|
+ var hpInfo models.HisPrescriptionInfo
|
|
584
|
+ if info.ID == 0 {
|
|
585
|
+ var randNum int
|
|
586
|
+ randNum = rand.Intn(10000) + 1000
|
|
587
|
+ timestamp := time.Now().Unix()
|
|
588
|
+ tempTime := time.Unix(timestamp, 0)
|
|
589
|
+ timeFormat := tempTime.Format("20060102150405")
|
|
590
|
+ p_number := timeFormat + strconv.FormatInt(int64(randNum), 10) + strconv.FormatInt(int64(adminInfo.CurrentOrgId), 10) + strconv.FormatInt(int64(patient_id), 10)
|
|
591
|
+
|
|
592
|
+ hpInfo = models.HisPrescriptionInfo{
|
|
593
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
594
|
+ RecordDate: theTime.Unix(),
|
|
595
|
+ PatientId: patient_id,
|
|
596
|
+ Status: 1,
|
|
597
|
+ Ctime: time.Now().Unix(),
|
|
598
|
+ Mtime: time.Now().Unix(),
|
|
599
|
+ Creator: adminInfo.AdminUser.Id,
|
|
600
|
+ Modifier: adminInfo.AdminUser.Id,
|
|
601
|
+ Diagnosis: diagnose,
|
|
602
|
+ SickHistory: sick_history,
|
|
603
|
+ Departments: department,
|
|
604
|
+ RegisterType: reg_type,
|
|
605
|
+ PrescriptionNumber: p_number,
|
|
606
|
+ PrescriptionStatus: 1,
|
|
607
|
+ Doctor: role.UserName,
|
|
608
|
+ DoctorId: doctor_id,
|
|
609
|
+ SickType: sick_type,
|
|
610
|
+ }
|
|
611
|
+ service.SavePatientPrescriptionInfo(hpInfo)
|
|
612
|
+
|
|
613
|
+ } else {
|
|
614
|
+ hpInfo = models.HisPrescriptionInfo{
|
|
615
|
+ ID: info.ID,
|
|
616
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
617
|
+ RecordDate: info.RecordDate,
|
|
618
|
+ PatientId: info.PatientId,
|
|
619
|
+ Status: 1,
|
|
620
|
+ Ctime: info.Ctime,
|
|
621
|
+ Mtime: time.Now().Unix(),
|
|
622
|
+ Creator: info.Creator,
|
|
623
|
+ Modifier: adminInfo.AdminUser.Id,
|
|
624
|
+ Diagnosis: diagnose,
|
|
625
|
+ SickHistory: sick_history,
|
|
626
|
+ Departments: department,
|
|
627
|
+ RegisterType: reg_type,
|
|
628
|
+ PrescriptionNumber: info.PrescriptionNumber,
|
|
629
|
+ Doctor: role.UserName,
|
|
630
|
+ PrescriptionStatus: info.PrescriptionStatus,
|
|
631
|
+ DoctorId: doctor_id,
|
|
632
|
+ SickType: sick_type,
|
|
633
|
+ }
|
|
634
|
+ service.SavePatientPrescriptionInfo(hpInfo)
|
|
635
|
+ }
|
|
636
|
+
|
|
637
|
+ if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
|
638
|
+ prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
|
639
|
+
|
|
640
|
+ if len(prescriptions) > 0 {
|
|
641
|
+ for _, item := range prescriptions {
|
|
642
|
+ items := item.(map[string]interface{})
|
|
643
|
+ if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
|
|
644
|
+ utils.ErrorLog("id")
|
|
645
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
646
|
+ return
|
|
647
|
+ }
|
|
648
|
+ id := int64(items["id"].(float64))
|
|
649
|
+
|
|
650
|
+ if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
|
|
651
|
+ utils.ErrorLog("type")
|
|
652
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
653
|
+ return
|
|
654
|
+ }
|
|
655
|
+ types := int64(items["type"].(float64))
|
|
656
|
+
|
|
657
|
+ historyPrescription, _ := service.GetHisPrescriptionByID(adminInfo.CurrentOrgId, id)
|
|
658
|
+
|
|
659
|
+ ctime := time.Now().Unix()
|
|
660
|
+
|
|
661
|
+ prescription := &models.HisPrescription{
|
|
662
|
+ ID: id,
|
|
663
|
+ PatientId: patient_id,
|
|
664
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
665
|
+ RecordDate: recordDateTime,
|
|
666
|
+ Ctime: ctime,
|
|
667
|
+ Mtime: ctime,
|
|
668
|
+ Type: types,
|
|
669
|
+ Modifier: adminInfo.AdminUser.Id,
|
|
670
|
+ Creator: adminInfo.AdminUser.Id,
|
|
671
|
+ Status: 1,
|
|
672
|
+ Doctor: role.UserName,
|
|
673
|
+ HisPatientId: his_patient_id,
|
|
674
|
+ OrderStatus: 1,
|
|
675
|
+ BatchNumber: "",
|
|
676
|
+ PrescriptionNumber: hpInfo.PrescriptionNumber,
|
|
677
|
+ }
|
|
678
|
+
|
|
679
|
+ if historyPrescription.ID > 0 {
|
|
680
|
+ prescription.PreTime = historyPrescription.PreTime
|
|
681
|
+ }
|
|
682
|
+
|
|
683
|
+ service.SaveHisPrescription(prescription)
|
|
684
|
+
|
|
685
|
+ if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
|
|
686
|
+ advices := items["advices"].([]interface{})
|
|
687
|
+ //group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
|
|
688
|
+ groupNo := int64(0)
|
|
689
|
+ ctime := time.Now().Unix()
|
|
690
|
+ mtime := ctime
|
|
691
|
+ if len(advices) > 0 {
|
|
692
|
+ for _, advice := range advices {
|
|
693
|
+ var s models.HisDoctorAdviceInfo
|
|
694
|
+ s.PrescriptionId = prescription.ID
|
|
695
|
+ s.AdviceType = 2
|
|
696
|
+ s.AdviceDoctor = adminInfo.AdminUser.Id
|
|
697
|
+ s.StopState = 2
|
|
698
|
+ s.ExecutionState = 2
|
|
699
|
+ s.AdviceDate = recordDateTime
|
|
700
|
+ s.Status = 1
|
|
701
|
+ s.UserOrgId = adminInfo.CurrentOrgId
|
|
702
|
+ s.RecordDate = recordDateTime
|
|
703
|
+ s.StartTime = prescription.PreTime
|
|
704
|
+ s.Groupno = groupNo
|
|
705
|
+ s.CreatedTime = ctime
|
|
706
|
+ s.UpdatedTime = mtime
|
|
707
|
+ s.PatientId = patient_id
|
|
708
|
+ s.HisPatientId = his_patient_id
|
|
709
|
+ errcode := c.setAdviceWithJSONTwo(&s, advice.(map[string]interface{}))
|
|
710
|
+ if errcode > 0 {
|
|
711
|
+ c.ServeFailJSONWithSGJErrorCode(errcode)
|
|
712
|
+ return
|
|
713
|
+ }
|
|
714
|
+ service.CreateHisDoctorAdvice(&s)
|
|
715
|
+
|
|
716
|
+ }
|
|
717
|
+ }
|
|
718
|
+ }
|
|
719
|
+ if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
|
|
720
|
+ projects := items["project"].([]interface{})
|
|
721
|
+ if len(projects) > 0 {
|
|
722
|
+ for _, project := range projects {
|
|
723
|
+ var p models.HisPrescriptionProject
|
|
724
|
+ p.PrescriptionId = prescription.ID
|
|
725
|
+ p.Ctime = time.Now().Unix()
|
|
726
|
+ p.Mtime = time.Now().Unix()
|
|
727
|
+ p.PatientId = patient_id
|
|
728
|
+ p.RecordDate = recordDateTime
|
|
729
|
+ p.UserOrgId = adminInfo.CurrentOrgId
|
|
730
|
+ p.HisPatientId = his_patient_id
|
|
731
|
+ p.Status = 1
|
|
732
|
+ errcode := c.setProjectWithJSONTwo(&p, project.(map[string]interface{}))
|
|
733
|
+ if errcode > 0 {
|
|
734
|
+ c.ServeFailJSONWithSGJErrorCode(errcode)
|
|
735
|
+ return
|
|
736
|
+ }
|
|
737
|
+ service.CreateHisProjectTwo(&p)
|
|
738
|
+
|
|
739
|
+ }
|
|
740
|
+ }
|
|
741
|
+ }
|
|
742
|
+ if items["addition"] != nil && reflect.TypeOf(items["addition"]).String() == "[]interface {}" {
|
|
743
|
+ addition := items["addition"].([]interface{})
|
|
744
|
+ //group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
|
|
745
|
+ ctime := time.Now().Unix()
|
|
746
|
+ mtime := ctime
|
|
747
|
+ if len(addition) > 0 {
|
|
748
|
+ for _, item := range addition {
|
|
749
|
+ var s models.HisAdditionalCharge
|
|
750
|
+ s.PrescriptionId = prescription.ID
|
|
751
|
+ s.Status = 1
|
|
752
|
+ s.UserOrgId = adminInfo.CurrentOrgId
|
|
753
|
+ s.RecordDate = recordDateTime
|
|
754
|
+ s.CreatedTime = ctime
|
|
755
|
+ s.UpdatedTime = mtime
|
|
756
|
+ s.PatientId = patient_id
|
|
757
|
+ s.HisPatientId = his_patient_id
|
|
758
|
+ errcode := c.setAddtionWithJSONTwo(&s, item.(map[string]interface{}), adminInfo.CurrentOrgId)
|
|
759
|
+ if errcode > 0 {
|
|
760
|
+ c.ServeFailJSONWithSGJErrorCode(errcode)
|
|
761
|
+ return
|
|
762
|
+ }
|
|
763
|
+ service.CreateAdditionalCharge(&s)
|
|
764
|
+ }
|
|
765
|
+ }
|
|
766
|
+ }
|
|
767
|
+
|
|
768
|
+ }
|
|
769
|
+ }
|
|
770
|
+ }
|
|
771
|
+ if err == nil {
|
|
772
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
773
|
+ "msg": "保存成功",
|
|
774
|
+ })
|
|
775
|
+ return
|
|
776
|
+
|
|
777
|
+ } else {
|
|
778
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
779
|
+ return
|
|
780
|
+ }
|
|
781
|
+}
|
529
|
782
|
|
530
|
783
|
func (c *HisApiController) DeletePrescription() {
|
531
|
784
|
prescription_id, _ := c.GetInt64("id")
|
|
@@ -745,130 +998,379 @@ func (c *HisApiController) CreateHisPatientCaseHistory() {
|
745
|
998
|
Diagnose: diagnose,
|
746
|
999
|
}
|
747
|
1000
|
|
748
|
|
- err = service.SaveHisPatientCaseHistory(&caseHistory)
|
749
|
|
- if err != nil {
|
750
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
751
|
|
- return
|
|
1001
|
+ err = service.SaveHisPatientCaseHistory(&caseHistory)
|
|
1002
|
+ if err != nil {
|
|
1003
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1004
|
+ return
|
|
1005
|
+ }
|
|
1006
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1007
|
+ "caseHistory": caseHistory,
|
|
1008
|
+ })
|
|
1009
|
+ return
|
|
1010
|
+
|
|
1011
|
+ //查询该患者是否有病历
|
|
1012
|
+ //_, errcode := service.GetHisPatientCaseHistoryById(his_patient_id)
|
|
1013
|
+ //if errcode == gorm.ErrRecordNotFound {
|
|
1014
|
+ // err = service.SaveHisPatientCaseHistory(caseHistory)
|
|
1015
|
+ // if err != nil {
|
|
1016
|
+ // c.ServeSuccessJSON(map[string]interface{}{
|
|
1017
|
+ // "msg": "保存成功",
|
|
1018
|
+ // })
|
|
1019
|
+ // }
|
|
1020
|
+ //} else if errcode == nil {
|
|
1021
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1022
|
+ // return
|
|
1023
|
+ //}
|
|
1024
|
+
|
|
1025
|
+}
|
|
1026
|
+func (c *HisApiController) GetHisPatientCaseHistoryList() {
|
|
1027
|
+ patient_id, _ := c.GetInt64("patient_id", 0)
|
|
1028
|
+ adminUser := c.GetAdminUserInfo()
|
|
1029
|
+ caseHistorys, _ := service.GetHisPatientCaseHistoryList(adminUser.CurrentOrgId, patient_id)
|
|
1030
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1031
|
+ "list": caseHistorys,
|
|
1032
|
+ })
|
|
1033
|
+
|
|
1034
|
+}
|
|
1035
|
+func (c *HisApiController) GetHisPatientCaseHistory() {
|
|
1036
|
+ record_date, _ := c.GetInt64("record_date", 0)
|
|
1037
|
+ patient_id, _ := c.GetInt64("patient_id", 0)
|
|
1038
|
+ admin := c.GetAdminUserInfo()
|
|
1039
|
+ info, _ := service.GetHisPatientInfo(admin.CurrentOrgId, patient_id, record_date)
|
|
1040
|
+ case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, record_date)
|
|
1041
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1042
|
+ "info": info,
|
|
1043
|
+ "case_history": case_history,
|
|
1044
|
+ })
|
|
1045
|
+
|
|
1046
|
+}
|
|
1047
|
+func (c *HisApiController) CreateCaseHistoryTemplate() {
|
|
1048
|
+ template_name := c.GetString("template_name")
|
|
1049
|
+ fmt.Println("template_name22222222222222", template_name)
|
|
1050
|
+ template_remark := c.GetString("template_remark")
|
|
1051
|
+ doctor := c.GetAdminUserInfo().AdminUser.Id
|
|
1052
|
+ diagnostic := c.GetString("diagnostic")
|
|
1053
|
+ chief_conplaint := c.GetString("chief_conplain")
|
|
1054
|
+ history_of_present_illness := c.GetString("history_of_present_illness")
|
|
1055
|
+ past_history := c.GetString("past_history")
|
|
1056
|
+ personal_history := c.GetString("personal_history")
|
|
1057
|
+ family_history := c.GetString("family_history")
|
|
1058
|
+ user_name := c.GetString("user_name")
|
|
1059
|
+ doctor_advice := c.GetString("doctor_advice")
|
|
1060
|
+ remark := c.GetString("remark")
|
|
1061
|
+ //record_date := c.GetString("record_date")
|
|
1062
|
+ //fmt.Println("record_date--------",record_date)
|
|
1063
|
+ //timeLayout := "2006-01-02"
|
|
1064
|
+ //loc, _ := time.LoadLocation("Local")
|
|
1065
|
+ //
|
|
1066
|
+ //theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
1067
|
+ //if err != nil {
|
|
1068
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1069
|
+ // return
|
|
1070
|
+ //}
|
|
1071
|
+ //recordDateTime := theTime.Unix()
|
|
1072
|
+
|
|
1073
|
+ ctime := time.Now().Unix()
|
|
1074
|
+
|
|
1075
|
+ template := models.HisCaseHistoryTemplate{
|
|
1076
|
+ HistoryOfPresentIllness: history_of_present_illness,
|
|
1077
|
+ PastHistory: past_history,
|
|
1078
|
+ ChiefConplaint: chief_conplaint,
|
|
1079
|
+ PersonalHistory: personal_history,
|
|
1080
|
+ FamilyHistory: family_history,
|
|
1081
|
+ Diagnostic: diagnostic,
|
|
1082
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
1083
|
+ Status: 1,
|
|
1084
|
+ Ctime: ctime,
|
|
1085
|
+ Mtime: ctime,
|
|
1086
|
+ RecordDate: time.Now().Unix(),
|
|
1087
|
+ TemplateName: template_name,
|
|
1088
|
+ TemplateRemark: template_remark,
|
|
1089
|
+ Creator: doctor,
|
|
1090
|
+ Modifier: doctor,
|
|
1091
|
+ UserName: user_name,
|
|
1092
|
+ DoctorAdvice: doctor_advice,
|
|
1093
|
+ Remark: remark,
|
|
1094
|
+ }
|
|
1095
|
+
|
|
1096
|
+ err := service.SaveHisPatientCaseHistoryTemplate(template)
|
|
1097
|
+
|
|
1098
|
+ if err == nil {
|
|
1099
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1100
|
+ "msg": "保存成功",
|
|
1101
|
+ })
|
|
1102
|
+
|
|
1103
|
+ } else {
|
|
1104
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1105
|
+ return
|
|
1106
|
+ }
|
|
1107
|
+
|
|
1108
|
+}
|
|
1109
|
+func (c *HisApiController) GetCaseHistoryTemplate() {
|
|
1110
|
+ timeLayout := "2006-01-02"
|
|
1111
|
+ loc, _ := time.LoadLocation("Local")
|
|
1112
|
+ keyword := c.GetString("keyword")
|
|
1113
|
+ start_time := c.GetString("start_time")
|
|
1114
|
+ end_time := c.GetString("end_time")
|
|
1115
|
+ startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
1116
|
+ endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
1117
|
+ admin := c.GetAdminUserInfo()
|
|
1118
|
+ template, _ := service.GetHisPatientCaseHistoryTemplate(admin.CurrentOrgId, startTime.Unix(), endTime.Unix(), keyword)
|
|
1119
|
+ //history, _ := service.GetHisPatientCaseHistory(admin.CurrentOrgId)
|
|
1120
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1121
|
+ "template": template,
|
|
1122
|
+ //"history": history,
|
|
1123
|
+ })
|
|
1124
|
+
|
|
1125
|
+}
|
|
1126
|
+
|
|
1127
|
+func (c *HisApiController) setAdviceWithJSONTwo(advice *models.HisDoctorAdviceInfo, json map[string]interface{}) int {
|
|
1128
|
+
|
|
1129
|
+ if json["drug_name"] == nil || reflect.TypeOf(json["drug_name"]).String() != "string" {
|
|
1130
|
+ utils.ErrorLog("drug_name")
|
|
1131
|
+ return enums.ErrorCodeParamWrong
|
|
1132
|
+ }
|
|
1133
|
+ adviceName, _ := json["drug_name"].(string)
|
|
1134
|
+ if len(adviceName) == 0 {
|
|
1135
|
+ utils.ErrorLog("len(advice_name) == 0")
|
|
1136
|
+ return enums.ErrorCodeParamWrong
|
|
1137
|
+ }
|
|
1138
|
+ advice.AdviceName = adviceName
|
|
1139
|
+ adviceDesc, _ := json["advice_desc"].(string)
|
|
1140
|
+ advice.AdviceDesc = adviceDesc
|
|
1141
|
+ if json["drug_spec"] != nil && reflect.TypeOf(json["drug_spec"]).String() == "string" {
|
|
1142
|
+ drugSpec, _ := strconv.ParseFloat(json["drug_spec"].(string), 64)
|
|
1143
|
+ advice.DrugSpec = drugSpec
|
|
1144
|
+ }
|
|
1145
|
+ if json["remark"] != nil && reflect.TypeOf(json["remark"]).String() == "string" {
|
|
1146
|
+ remark, _ := json["remark"].(string)
|
|
1147
|
+ advice.Remark = remark
|
|
1148
|
+ }
|
|
1149
|
+ if json["id"] == nil {
|
|
1150
|
+ advice.DrugId = 0
|
|
1151
|
+ } else {
|
|
1152
|
+ if json["id"] != nil || reflect.TypeOf(json["id"]).String() == "float64" {
|
|
1153
|
+ drug_id := int64(json["id"].(float64))
|
|
1154
|
+ advice.DrugId = drug_id
|
|
1155
|
+ }
|
|
1156
|
+ }
|
|
1157
|
+ if json["advice_id"] != nil && reflect.TypeOf(json["advice_id"]).String() == "float64" {
|
|
1158
|
+ advice_id := int64(json["advice_id"].(float64))
|
|
1159
|
+ advice.ID = advice_id
|
|
1160
|
+ if advice.ID > 0 {
|
|
1161
|
+ hisAdvice, err := service.GetHisDoctorAdvicesById(advice.ID)
|
|
1162
|
+ if err == nil {
|
|
1163
|
+ if hisAdvice.ID > 0 {
|
|
1164
|
+ advice.ExecutionTime = hisAdvice.ExecutionTime
|
|
1165
|
+ advice.ExecutionStaff = hisAdvice.ExecutionStaff
|
|
1166
|
+ advice.ExecutionState = hisAdvice.ExecutionState
|
|
1167
|
+ advice.CheckTime = hisAdvice.CheckTime
|
|
1168
|
+ advice.Checker = hisAdvice.Checker
|
|
1169
|
+ advice.CheckState = hisAdvice.CheckState
|
|
1170
|
+ advice.StartTime = hisAdvice.StartTime
|
|
1171
|
+ advice.FeedetlSn = hisAdvice.FeedetlSn
|
|
1172
|
+
|
|
1173
|
+ }
|
|
1174
|
+ }
|
|
1175
|
+ }
|
|
1176
|
+ }
|
|
1177
|
+
|
|
1178
|
+ //
|
|
1179
|
+ //if json["execution_time"] != nil && reflect.TypeOf(json["execution_time"]).String() == "string" {
|
|
1180
|
+ // execution_time, _ := strconv.ParseInt(json["execution_time"].(string), 10,64)
|
|
1181
|
+ // advice.ExecutionTime = execution_time
|
|
1182
|
+ //}
|
|
1183
|
+ //
|
|
1184
|
+ //
|
|
1185
|
+ //
|
|
1186
|
+ //if json["execution_staff"] != nil && reflect.TypeOf(json["execution_staff"]).String() == "string" {
|
|
1187
|
+ // execution_staff, _ := strconv.ParseInt(json["execution_staff"].(string), 10,64)
|
|
1188
|
+ // advice.ExecutionStaff = execution_staff
|
|
1189
|
+ //}
|
|
1190
|
+ //
|
|
1191
|
+ //
|
|
1192
|
+ //
|
|
1193
|
+ //if json["execution_state"] != nil && reflect.TypeOf(json["execution_state"]).String() == "string" {
|
|
1194
|
+ // execution_state, _ := strconv.ParseInt(json["execution_state"].(string), 10,64)
|
|
1195
|
+ // advice.ExecutionState = execution_state
|
|
1196
|
+ //}
|
|
1197
|
+ //
|
|
1198
|
+ //
|
|
1199
|
+ //if json["check_time"] != nil && reflect.TypeOf(json["check_time"]).String() == "string" {
|
|
1200
|
+ // check_time, _ := strconv.ParseInt(json["check_time"].(string), 10,64)
|
|
1201
|
+ // advice.CheckTime = check_time
|
|
1202
|
+ //}
|
|
1203
|
+ //
|
|
1204
|
+ //
|
|
1205
|
+ //if json["check_state"] != nil && reflect.TypeOf(json["check_state"]).String() == "string" {
|
|
1206
|
+ // check_state, _ := strconv.ParseInt(json["check_state"].(string), 10,64)
|
|
1207
|
+ // advice.CheckState = check_state
|
|
1208
|
+ //}
|
|
1209
|
+ //
|
|
1210
|
+ //
|
|
1211
|
+ //if json["checker"] != nil && reflect.TypeOf(json["checker"]).String() == "string" {
|
|
1212
|
+ // checker, _ := strconv.ParseInt(json["checker"].(string), 10,64)
|
|
1213
|
+ // advice.Checker = checker
|
|
1214
|
+ //}
|
|
1215
|
+ //
|
|
1216
|
+ //if json["start_time"] != nil && reflect.TypeOf(json["start_time"]).String() == "string" {
|
|
1217
|
+ // start_time, _ := strconv.ParseInt(json["start_time"].(string), 10,64)
|
|
1218
|
+ // advice.StartTime = start_time
|
|
1219
|
+ //}
|
|
1220
|
+
|
|
1221
|
+ if json["min_unit"] != nil && reflect.TypeOf(json["min_unit"]).String() == "string" {
|
|
1222
|
+ drugSpecUnit, _ := json["min_unit"].(string)
|
|
1223
|
+ advice.DrugSpecUnit = drugSpecUnit
|
|
1224
|
+ }
|
|
1225
|
+ if json["single_dose"] != nil && reflect.TypeOf(json["single_dose"]).String() == "string" {
|
|
1226
|
+ singleDose, _ := strconv.ParseFloat(json["single_dose"].(string), 64)
|
|
1227
|
+ advice.SingleDose = singleDose
|
|
1228
|
+ }
|
|
1229
|
+ if json["single_dose_unit"] != nil && reflect.TypeOf(json["single_dose_unit"]).String() == "string" {
|
|
1230
|
+ singleDoseUnit, _ := json["single_dose_unit"].(string)
|
|
1231
|
+ advice.SingleDoseUnit = singleDoseUnit
|
|
1232
|
+ }
|
|
1233
|
+ if json["prescribing_number"] != nil && reflect.TypeOf(json["prescribing_number"]).String() == "string" {
|
|
1234
|
+ prescribingNumber, _ := strconv.ParseFloat(json["prescribing_number"].(string), 64)
|
|
1235
|
+ advice.PrescribingNumber = prescribingNumber
|
|
1236
|
+ }
|
|
1237
|
+ if json["prescribing_number_unit"] != nil && reflect.TypeOf(json["prescribing_number_unit"]).String() == "string" {
|
|
1238
|
+ prescribingNumberUnit, _ := json["prescribing_number_unit"].(string)
|
|
1239
|
+ advice.PrescribingNumberUnit = prescribingNumberUnit
|
|
1240
|
+ }
|
|
1241
|
+ if json["delivery_way"] != nil && reflect.TypeOf(json["delivery_way"]).String() == "string" {
|
|
1242
|
+ deliveryWay, _ := json["delivery_way"].(string)
|
|
1243
|
+ advice.DeliveryWay = deliveryWay
|
|
1244
|
+ }
|
|
1245
|
+ if json["execution_frequency"] != nil && reflect.TypeOf(json["execution_frequency"]).String() == "string" {
|
|
1246
|
+ executionFrequency, _ := json["execution_frequency"].(string)
|
|
1247
|
+ advice.ExecutionFrequency = executionFrequency
|
|
1248
|
+ }
|
|
1249
|
+
|
|
1250
|
+ if json["retail_price"] != nil || reflect.TypeOf(json["retail_price"]).String() == "string" {
|
|
1251
|
+ price, _ := strconv.ParseFloat(json["retail_price"].(string), 64)
|
|
1252
|
+ advice.Price = price
|
|
1253
|
+ }
|
|
1254
|
+ if json["medical_insurance_number"] != nil || reflect.TypeOf(json["medical_insurance_number"]).String() == "string" {
|
|
1255
|
+ med_list_codg, _ := json["medical_insurance_number"].(string)
|
|
1256
|
+ advice.MedListCodg = med_list_codg
|
|
1257
|
+ }
|
|
1258
|
+ if json["day"] != nil || reflect.TypeOf(json["day"]).String() == "float64" {
|
|
1259
|
+ day := int64(json["day"].(float64))
|
|
1260
|
+ advice.Day = day
|
|
1261
|
+ }
|
|
1262
|
+ return 0
|
|
1263
|
+}
|
|
1264
|
+
|
|
1265
|
+func (c *HisApiController) setProjectWithJSONTwo(project *models.HisPrescriptionProject, json map[string]interface{}) int {
|
|
1266
|
+ if json["id"] != nil || reflect.TypeOf(json["id"]).String() == "float64" {
|
|
1267
|
+ id := int64(json["id"].(float64))
|
|
1268
|
+ project.ID = id
|
|
1269
|
+ historyProject, _ := service.GetHisProjectByID(id)
|
|
1270
|
+ project.FeedetlSn = historyProject.FeedetlSn
|
|
1271
|
+
|
|
1272
|
+ }
|
|
1273
|
+ if json["project_id"] != nil || reflect.TypeOf(json["project_id"]).String() == "float64" {
|
|
1274
|
+ project_id := int64(json["project_id"].(float64))
|
|
1275
|
+ project.ProjectId = project_id
|
|
1276
|
+
|
|
1277
|
+ }
|
|
1278
|
+ // if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
|
|
1279
|
+ // price := int64(json["price"].(float64))
|
|
1280
|
+ // formatInt_price := strconv.FormatInt(price, 10)
|
|
1281
|
+ // float_price, _ := strconv.ParseFloat(formatInt_price, 64)
|
|
1282
|
+ // project.Price = float_price
|
|
1283
|
+ // }
|
|
1284
|
+ if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "string" {
|
|
1285
|
+ price, _ := strconv.ParseFloat(json["price"].(string), 64)
|
|
1286
|
+ project.Price = price
|
752
|
1287
|
}
|
753
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
754
|
|
- "caseHistory": caseHistory,
|
755
|
|
- })
|
756
|
|
- return
|
757
|
1288
|
|
758
|
|
- //查询该患者是否有病历
|
759
|
|
- //_, errcode := service.GetHisPatientCaseHistoryById(his_patient_id)
|
760
|
|
- //if errcode == gorm.ErrRecordNotFound {
|
761
|
|
- // err = service.SaveHisPatientCaseHistory(caseHistory)
|
762
|
|
- // if err != nil {
|
763
|
|
- // c.ServeSuccessJSON(map[string]interface{}{
|
764
|
|
- // "msg": "保存成功",
|
765
|
|
- // })
|
766
|
|
- // }
|
767
|
|
- //} else if errcode == nil {
|
768
|
|
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
769
|
|
- // return
|
770
|
|
- //}
|
|
1289
|
+ if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
|
|
1290
|
+ total, _ := json["total"].(string)
|
|
1291
|
+ totals, _ := strconv.ParseInt(total, 10, 64)
|
|
1292
|
+ project.Count = totals
|
|
1293
|
+ }
|
771
|
1294
|
|
772
|
|
-}
|
773
|
|
-func (c *HisApiController) GetHisPatientCaseHistoryList() {
|
774
|
|
- patient_id, _ := c.GetInt64("patient_id", 0)
|
775
|
|
- adminUser := c.GetAdminUserInfo()
|
776
|
|
- caseHistorys, _ := service.GetHisPatientCaseHistoryList(adminUser.CurrentOrgId, patient_id)
|
777
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
778
|
|
- "list": caseHistorys,
|
779
|
|
- })
|
|
1295
|
+ if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
|
|
1296
|
+ medical_code, _ := json["medical_code"].(string)
|
|
1297
|
+ project.MedListCodg = medical_code
|
|
1298
|
+ }
|
|
1299
|
+ if json["single_dose"] != nil && reflect.TypeOf(json["single_dose"]).String() == "string" {
|
|
1300
|
+ single_dose, _ := json["single_dose"].(string)
|
|
1301
|
+ project.SingleDose = single_dose
|
|
1302
|
+ }
|
780
|
1303
|
|
781
|
|
-}
|
782
|
|
-func (c *HisApiController) GetHisPatientCaseHistory() {
|
783
|
|
- record_date, _ := c.GetInt64("record_date", 0)
|
784
|
|
- patient_id, _ := c.GetInt64("patient_id", 0)
|
785
|
|
- admin := c.GetAdminUserInfo()
|
786
|
|
- info, _ := service.GetHisPatientInfo(admin.CurrentOrgId, patient_id, record_date)
|
787
|
|
- case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, record_date)
|
788
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
789
|
|
- "info": info,
|
790
|
|
- "case_history": case_history,
|
791
|
|
- })
|
|
1304
|
+ if json["delivery_way"] != nil && reflect.TypeOf(json["delivery_way"]).String() == "string" {
|
|
1305
|
+ delivery_way, _ := json["delivery_way"].(string)
|
|
1306
|
+ project.DeliveryWay = delivery_way
|
|
1307
|
+ }
|
|
1308
|
+ if json["execution_frequency"] != nil && reflect.TypeOf(json["execution_frequency"]).String() == "string" {
|
|
1309
|
+ execution_frequency, _ := json["execution_frequency"].(string)
|
|
1310
|
+ project.ExecutionFrequency = execution_frequency
|
|
1311
|
+ }
|
|
1312
|
+ if json["remark"] != nil && reflect.TypeOf(json["remark"]).String() == "string" {
|
|
1313
|
+ remark, _ := json["remark"].(string)
|
|
1314
|
+ project.Remark = remark
|
|
1315
|
+ }
|
|
1316
|
+ if json["number_days"] != nil && reflect.TypeOf(json["number_days"]).String() == "string" {
|
|
1317
|
+ day, _ := json["number_days"].(string)
|
|
1318
|
+ project.Day = day
|
|
1319
|
+ }
|
792
|
1320
|
|
|
1321
|
+ if json["unit"] != nil && reflect.TypeOf(json["unit"]).String() == "string" {
|
|
1322
|
+ unit, _ := json["unit"].(string)
|
|
1323
|
+ project.Unit = unit
|
|
1324
|
+ }
|
|
1325
|
+ return 0
|
793
|
1326
|
}
|
794
|
|
-func (c *HisApiController) CreateCaseHistoryTemplate() {
|
795
|
|
- template_name := c.GetString("template_name")
|
796
|
|
- fmt.Println("template_name22222222222222", template_name)
|
797
|
|
- template_remark := c.GetString("template_remark")
|
798
|
|
- doctor := c.GetAdminUserInfo().AdminUser.Id
|
799
|
|
- diagnostic := c.GetString("diagnostic")
|
800
|
|
- chief_conplaint := c.GetString("chief_conplain")
|
801
|
|
- history_of_present_illness := c.GetString("history_of_present_illness")
|
802
|
|
- past_history := c.GetString("past_history")
|
803
|
|
- personal_history := c.GetString("personal_history")
|
804
|
|
- family_history := c.GetString("family_history")
|
805
|
|
- user_name := c.GetString("user_name")
|
806
|
|
- doctor_advice := c.GetString("doctor_advice")
|
807
|
|
- remark := c.GetString("remark")
|
808
|
|
- //record_date := c.GetString("record_date")
|
809
|
|
- //fmt.Println("record_date--------",record_date)
|
810
|
|
- //timeLayout := "2006-01-02"
|
811
|
|
- //loc, _ := time.LoadLocation("Local")
|
812
|
|
- //
|
813
|
|
- //theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
814
|
|
- //if err != nil {
|
815
|
|
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
816
|
|
- // return
|
817
|
|
- //}
|
818
|
|
- //recordDateTime := theTime.Unix()
|
819
|
1327
|
|
820
|
|
- ctime := time.Now().Unix()
|
821
|
|
-
|
822
|
|
- template := models.HisCaseHistoryTemplate{
|
823
|
|
- HistoryOfPresentIllness: history_of_present_illness,
|
824
|
|
- PastHistory: past_history,
|
825
|
|
- ChiefConplaint: chief_conplaint,
|
826
|
|
- PersonalHistory: personal_history,
|
827
|
|
- FamilyHistory: family_history,
|
828
|
|
- Diagnostic: diagnostic,
|
829
|
|
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
830
|
|
- Status: 1,
|
831
|
|
- Ctime: ctime,
|
832
|
|
- Mtime: ctime,
|
833
|
|
- RecordDate: time.Now().Unix(),
|
834
|
|
- TemplateName: template_name,
|
835
|
|
- TemplateRemark: template_remark,
|
836
|
|
- Creator: doctor,
|
837
|
|
- Modifier: doctor,
|
838
|
|
- UserName: user_name,
|
839
|
|
- DoctorAdvice: doctor_advice,
|
840
|
|
- Remark: remark,
|
|
1328
|
+func (c *HisApiController) setAddtionWithJSONTwo(additionalCharge *models.HisAdditionalCharge, json map[string]interface{}, org_id int64) int {
|
|
1329
|
+ if json["id"] != nil || reflect.TypeOf(json["id"]).String() == "float64" {
|
|
1330
|
+ id := int64(json["id"].(float64))
|
|
1331
|
+ historyAddtions, _ := service.GetHisAdditionByID(id)
|
|
1332
|
+ additionalCharge.ID = id
|
|
1333
|
+ additionalCharge.FeedetlSn = historyAddtions.FeedetlSn
|
841
|
1334
|
}
|
|
1335
|
+ if json["item_id"] != nil || reflect.TypeOf(json["item_id"]).String() == "float64" {
|
|
1336
|
+ item_id := int64(json["item_id"].(float64))
|
|
1337
|
+ additionalCharge.ItemId = item_id
|
|
1338
|
+ config, _ := service.GetAdditionChargeByID(org_id, item_id)
|
|
1339
|
+ if config.ID > 0 {
|
|
1340
|
+ if len(config.Code) > 0 {
|
|
1341
|
+ additionalCharge.MedListCodg = config.Code
|
|
1342
|
+ }
|
|
1343
|
+ }
|
|
1344
|
+ }
|
|
1345
|
+ // if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
|
|
1346
|
+ // price := int64(json["price"].(float64))
|
|
1347
|
+ // formatInt_price := strconv.FormatInt(price, 10)
|
|
1348
|
+ // float_price, _ := strconv.ParseFloat(formatInt_price, 64)
|
|
1349
|
+ // additionalCharge.Price = float_price
|
|
1350
|
+ // }
|
842
|
1351
|
|
843
|
|
- err := service.SaveHisPatientCaseHistoryTemplate(template)
|
844
|
|
-
|
845
|
|
- if err == nil {
|
846
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
847
|
|
- "msg": "保存成功",
|
848
|
|
- })
|
|
1352
|
+ //if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
|
|
1353
|
+ // price := int64(json["price"].(float64))
|
|
1354
|
+ // formatInt_price := strconv.FormatInt(price, 10)
|
|
1355
|
+ // float_price, _ := strconv.ParseFloat(formatInt_price, 64)
|
|
1356
|
+ // additionalCharge.Price = float_price
|
|
1357
|
+ //}
|
849
|
1358
|
|
850
|
|
- } else {
|
851
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
852
|
|
- return
|
|
1359
|
+ if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "string" {
|
|
1360
|
+ price, _ := strconv.ParseFloat(json["price"].(string), 64)
|
|
1361
|
+ additionalCharge.Price = price
|
|
1362
|
+ }
|
|
1363
|
+ if json["count"] != nil && reflect.TypeOf(json["count"]).String() == "string" {
|
|
1364
|
+ count, _ := json["count"].(string)
|
|
1365
|
+ counts, _ := strconv.ParseInt(count, 10, 64)
|
|
1366
|
+ additionalCharge.Count = counts
|
|
1367
|
+ }
|
|
1368
|
+ if json["item_name"] != nil && reflect.TypeOf(json["item_name"]).String() == "string" {
|
|
1369
|
+ item_name, _ := json["item_name"].(string)
|
|
1370
|
+ additionalCharge.ItemName = item_name
|
853
|
1371
|
}
|
854
|
1372
|
|
855
|
|
-}
|
856
|
|
-func (c *HisApiController) GetCaseHistoryTemplate() {
|
857
|
|
- timeLayout := "2006-01-02"
|
858
|
|
- loc, _ := time.LoadLocation("Local")
|
859
|
|
- keyword := c.GetString("keyword")
|
860
|
|
- start_time := c.GetString("start_time")
|
861
|
|
- end_time := c.GetString("end_time")
|
862
|
|
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
863
|
|
- endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
864
|
|
- admin := c.GetAdminUserInfo()
|
865
|
|
- template, _ := service.GetHisPatientCaseHistoryTemplate(admin.CurrentOrgId, startTime.Unix(), endTime.Unix(), keyword)
|
866
|
|
- //history, _ := service.GetHisPatientCaseHistory(admin.CurrentOrgId)
|
867
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
868
|
|
- "template": template,
|
869
|
|
- //"history": history,
|
870
|
|
- })
|
871
|
|
-
|
|
1373
|
+ return 0
|
872
|
1374
|
}
|
873
|
1375
|
|
874
|
1376
|
func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo, json map[string]interface{}) int {
|
|
@@ -1520,6 +2022,8 @@ func (c *HisApiController) GetRegisterInfo() {
|
1520
|
2022
|
settlementValue, _ := c.GetInt64("settlement_value")
|
1521
|
2023
|
social_type, _ := c.GetInt64("social_type")
|
1522
|
2024
|
medical_insurance_card := c.GetString("medical_insurance_card")
|
|
2025
|
+ id_card_type, _ := c.GetInt64("id_card_type")
|
|
2026
|
+
|
1523
|
2027
|
timeLayout := "2006-01-02"
|
1524
|
2028
|
loc, _ := time.LoadLocation("Local")
|
1525
|
2029
|
birthdays, _ := time.ParseInLocation(timeLayout+" 15:04:05", birthday+" 00:00:00", loc)
|
|
@@ -1770,6 +2274,7 @@ func (c *HisApiController) GetRegisterInfo() {
|
1770
|
2274
|
Ctime: time.Now().Unix(),
|
1771
|
2275
|
Mtime: time.Now().Unix(),
|
1772
|
2276
|
Number: str,
|
|
2277
|
+ IdCardType: id_card_type,
|
1773
|
2278
|
}
|
1774
|
2279
|
service.CreateHisPatient(&hisPatient)
|
1775
|
2280
|
|
|
@@ -2411,3 +2916,77 @@ func (this *DialysisApiController) GetCallHisPrescription() {
|
2411
|
2916
|
return
|
2412
|
2917
|
}
|
2413
|
2918
|
}
|
|
2919
|
+
|
|
2920
|
+func (this *HisApiController) GetHisDayPrescription() {
|
|
2921
|
+ timeLayout := "2006-01-02"
|
|
2922
|
+ loc, _ := time.LoadLocation("Local")
|
|
2923
|
+ start_time := this.GetString("start_time")
|
|
2924
|
+ patient_id, _ := this.GetInt64("patient_id", 0)
|
|
2925
|
+ startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
2926
|
+ end_time := this.GetString("end_time")
|
|
2927
|
+ endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
2928
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
2929
|
+ dayHisPrescription, err := service.GetMonthHisPrescription(adminUserInfo.CurrentOrgId, patient_id, startime.Unix(), endtime.Unix())
|
|
2930
|
+ if err == nil {
|
|
2931
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2932
|
+ "day_prescription": dayHisPrescription,
|
|
2933
|
+ })
|
|
2934
|
+ return
|
|
2935
|
+ } else {
|
|
2936
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2937
|
+ return
|
|
2938
|
+ }
|
|
2939
|
+}
|
|
2940
|
+
|
|
2941
|
+func (c *HisApiController) GetHisChargePatientList() {
|
|
2942
|
+ record_date := c.GetString("record_date")
|
|
2943
|
+ timeLayout := "2006-01-02"
|
|
2944
|
+ loc, _ := time.LoadLocation("Local")
|
|
2945
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
2946
|
+ if err != nil {
|
|
2947
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2948
|
+ return
|
|
2949
|
+ }
|
|
2950
|
+ recordDateTime := theTime.Unix()
|
|
2951
|
+ adminInfo := c.GetAdminUserInfo()
|
|
2952
|
+ patients, _ := service.GetAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
2953
|
+ //var patients []*service.Patients
|
|
2954
|
+ //for _, item := range tempPatients{
|
|
2955
|
+ // if len(item.HisPrescription) > 0 {
|
|
2956
|
+ // patients = append(patients, item)
|
|
2957
|
+ // }
|
|
2958
|
+ //}
|
|
2959
|
+ //patients_two, _ := service.GetChargeHisPatientListTwo(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
2960
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2961
|
+ "list": patients,
|
|
2962
|
+ //"list_two": patients_two,
|
|
2963
|
+ })
|
|
2964
|
+}
|
|
2965
|
+
|
|
2966
|
+func (c *HisApiController) GetHisUnRegisterPatientList() {
|
|
2967
|
+ record_date := c.GetString("record_date")
|
|
2968
|
+ timeLayout := "2006-01-02"
|
|
2969
|
+ loc, _ := time.LoadLocation("Local")
|
|
2970
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
2971
|
+ if err != nil {
|
|
2972
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2973
|
+ return
|
|
2974
|
+ }
|
|
2975
|
+ recordDateTime := theTime.Unix()
|
|
2976
|
+ adminUser := c.GetAdminUserInfo()
|
|
2977
|
+
|
|
2978
|
+ tempPatients, _ := service.GetHisPatientList(adminUser.CurrentOrgId, "", recordDateTime)
|
|
2979
|
+
|
|
2980
|
+ var patients []*service.Patients
|
|
2981
|
+ for _, item := range tempPatients {
|
|
2982
|
+ if item.HisPatient.ID == 0 {
|
|
2983
|
+ patients = append(patients, item)
|
|
2984
|
+ }
|
|
2985
|
+ }
|
|
2986
|
+
|
|
2987
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2988
|
+ "list": patients,
|
|
2989
|
+ //"list_two": patients_two,
|
|
2990
|
+ })
|
|
2991
|
+
|
|
2992
|
+}
|