|
@@ -9,6 +9,7 @@ import (
|
9
|
9
|
"encoding/json"
|
10
|
10
|
"fmt"
|
11
|
11
|
"github.com/astaxie/beego"
|
|
12
|
+ "github.com/jinzhu/gorm"
|
12
|
13
|
"io/ioutil"
|
13
|
14
|
"math/rand"
|
14
|
15
|
"net/http"
|
|
@@ -32,14 +33,21 @@ func HisManagerApiRegistRouters() {
|
32
|
33
|
beego.Router("/api/advice/delete", &HisApiController{}, "post:DeleteDoctorAdvice")
|
33
|
34
|
beego.Router("/api/project/delete", &HisApiController{}, "post:DeleteProject")
|
34
|
35
|
|
|
36
|
+ beego.Router("/api/hisprescription/list", &HisApiController{}, "get:GetHisPrescriptionList")
|
|
37
|
+ beego.Router("/api/hisprescription/info", &HisApiController{}, "get:GetHisPrescriptionInfo")
|
|
38
|
+
|
35
|
39
|
beego.Router("/api/hisprescription/create", &HisApiController{}, "post:CreateHisPrescription")
|
36
|
40
|
|
37
|
41
|
beego.Router("/api/doctorworkstation/casehistory/list", &HisApiController{}, "get:GetHisPatientCaseHistoryList")
|
38
|
42
|
beego.Router("/api/doctorworkstation/casehistory/get", &HisApiController{}, "get:GetHisPatientCaseHistory")
|
39
|
|
- beego.Router("/api/doctorworkstation/casehistory/create", &HisApiController{}, "post:CreateHisPatientCaseHistory")
|
40
|
|
- beego.Router("/api/doctorworkstation/casehistorytemplate/create", &HisApiController{}, "post:CreateCaseHistoryTemplate")
|
|
43
|
+ beego.Router("/api/doctorworkstation/casehistory/create", &HisApiController{}, "get:CreateHisPatientCaseHistory")
|
|
44
|
+ beego.Router("/api/doctorworkstation/casehistorytemplate/create", &HisApiController{}, "get:CreateCaseHistoryTemplate")
|
41
|
45
|
beego.Router("/api/doctorworkstation/casehistorytemplate/get", &HisApiController{}, "get:GetCaseHistoryTemplate")
|
42
|
|
- beego.Router("/api/doctorworkstation/printcasehistory/get", &HisApiController{}, "get:GetPrintHisPatientCaseHistory")
|
|
46
|
+ //beego.Router("/api/doctorworkstation/printcasehistory/get", &HisApiController{}, "get:GetPrintHisPatientCaseHistory")
|
|
47
|
+
|
|
48
|
+ beego.Router("/api/hisorder/list", &HisApiController{}, "get:GetHisOrderList")
|
|
49
|
+
|
|
50
|
+ beego.Router("/api/hisorder/get", &HisApiController{}, "get:GetHisOrder")
|
43
|
51
|
|
44
|
52
|
beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
|
45
|
53
|
beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
|
|
@@ -168,39 +176,48 @@ func (c *HisApiController) CreateHisPrescription() {
|
168
|
176
|
adminInfo := c.GetAdminUserInfo()
|
169
|
177
|
recordDateTime := theTime.Unix()
|
170
|
178
|
|
|
179
|
+ var randNum int
|
|
180
|
+ randNum = rand.Intn(10000) + 1000
|
|
181
|
+ timestamp := time.Now().Unix()
|
|
182
|
+ tempTime := time.Unix(timestamp, 0)
|
|
183
|
+ timeFormat := tempTime.Format("20060102150405")
|
|
184
|
+ number := timeFormat + strconv.FormatInt(int64(randNum), 10) + strconv.FormatInt(int64(adminInfo.CurrentOrgId), 10) + strconv.FormatInt(int64(patient_id), 10)
|
|
185
|
+
|
171
|
186
|
info, _ := service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, patient_id, recordDateTime)
|
172
|
187
|
if info.ID == 0 {
|
173
|
188
|
hpInfo := models.HisPrescriptionInfo{
|
174
|
|
- UserOrgId: adminInfo.CurrentOrgId,
|
175
|
|
- RecordDate: theTime.Unix(),
|
176
|
|
- PatientId: patient_id,
|
177
|
|
- Status: 1,
|
178
|
|
- Ctime: time.Now().Unix(),
|
179
|
|
- Mtime: time.Now().Unix(),
|
180
|
|
- Creator: adminInfo.AdminUser.Id,
|
181
|
|
- Modifier: adminInfo.AdminUser.Id,
|
182
|
|
- Diagnosis: diagnose,
|
183
|
|
- SickHistory: sick_history,
|
184
|
|
- Departments: department,
|
185
|
|
- RegisterType: reg_type,
|
|
189
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
190
|
+ RecordDate: theTime.Unix(),
|
|
191
|
+ PatientId: patient_id,
|
|
192
|
+ Status: 1,
|
|
193
|
+ Ctime: time.Now().Unix(),
|
|
194
|
+ Mtime: time.Now().Unix(),
|
|
195
|
+ Creator: adminInfo.AdminUser.Id,
|
|
196
|
+ Modifier: adminInfo.AdminUser.Id,
|
|
197
|
+ Diagnosis: diagnose,
|
|
198
|
+ SickHistory: sick_history,
|
|
199
|
+ Departments: department,
|
|
200
|
+ RegisterType: reg_type,
|
|
201
|
+ PrescriptionNumber: number,
|
186
|
202
|
}
|
187
|
203
|
service.SavePatientPrescriptionInfo(hpInfo)
|
188
|
204
|
|
189
|
205
|
} else {
|
190
|
206
|
hpInfo := models.HisPrescriptionInfo{
|
191
|
|
- ID: info.ID,
|
192
|
|
- UserOrgId: adminInfo.CurrentOrgId,
|
193
|
|
- RecordDate: info.RecordDate,
|
194
|
|
- PatientId: info.PatientId,
|
195
|
|
- Status: 1,
|
196
|
|
- Ctime: info.Ctime,
|
197
|
|
- Mtime: time.Now().Unix(),
|
198
|
|
- Creator: info.Creator,
|
199
|
|
- Modifier: adminInfo.AdminUser.Id,
|
200
|
|
- Diagnosis: diagnose,
|
201
|
|
- SickHistory: sick_history,
|
202
|
|
- Departments: department,
|
203
|
|
- RegisterType: reg_type,
|
|
207
|
+ ID: info.ID,
|
|
208
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
209
|
+ RecordDate: info.RecordDate,
|
|
210
|
+ PatientId: info.PatientId,
|
|
211
|
+ Status: 1,
|
|
212
|
+ Ctime: info.Ctime,
|
|
213
|
+ Mtime: time.Now().Unix(),
|
|
214
|
+ Creator: info.Creator,
|
|
215
|
+ Modifier: adminInfo.AdminUser.Id,
|
|
216
|
+ Diagnosis: diagnose,
|
|
217
|
+ SickHistory: sick_history,
|
|
218
|
+ Departments: department,
|
|
219
|
+ RegisterType: reg_type,
|
|
220
|
+ PrescriptionNumber: info.PrescriptionNumber,
|
204
|
221
|
}
|
205
|
222
|
service.SavePatientPrescriptionInfo(hpInfo)
|
206
|
223
|
}
|
|
@@ -452,25 +469,50 @@ func (c *HisApiController) CreateHisAdditionalCharge() {
|
452
|
469
|
}
|
453
|
470
|
|
454
|
471
|
func (c *HisApiController) CreateHisPatientCaseHistory() {
|
455
|
|
- diagnostic := c.GetString("diagnostic")
|
456
|
|
- temperature, _ := c.GetFloat("temperature")
|
457
|
|
- blood_sugar, _ := c.GetFloat("blood_sugar")
|
458
|
|
- pulse, _ := c.GetFloat("pulse")
|
459
|
|
- sbp, _ := c.GetFloat("sbp")
|
460
|
|
- dbp, _ := c.GetFloat("dbp")
|
461
|
|
- blood_fat, _ := c.GetFloat("blood_fat")
|
462
|
|
- height, _ := c.GetFloat("height")
|
463
|
|
- sick_type, _ := c.GetInt64("sick_type")
|
464
|
|
- symptom := c.GetString("symptom")
|
465
|
|
- sick_date := c.GetString("sick_date")
|
466
|
|
- is_infect, _ := c.GetInt64("is_infect")
|
|
472
|
+
|
|
473
|
+ blood_fat := c.GetString("blood_fat")
|
|
474
|
+ bloodfatfloat, _ := strconv.ParseFloat(blood_fat, 64)
|
|
475
|
+ fmt.Println("33333333", bloodfatfloat)
|
|
476
|
+ blood_sugar := c.GetString("blood_sugar")
|
|
477
|
+ bloodsugarfloat, _ := strconv.ParseFloat(blood_sugar, 64)
|
|
478
|
+ fmt.Println(bloodsugarfloat)
|
467
|
479
|
chief_conplaint := c.GetString("chief_conplaint")
|
|
480
|
+
|
|
481
|
+ dbp := c.GetString("dbp")
|
|
482
|
+ dbpfloat, _ := strconv.ParseFloat(dbp, 64)
|
|
483
|
+ delivery_way, _ := c.GetInt64("delivery_way")
|
|
484
|
+ diagnostic := c.GetString("diagnostic")
|
|
485
|
+ fmt.Println("diagnostic", diagnostic)
|
|
486
|
+ family_history := c.GetString("family_history")
|
|
487
|
+ fmt.Println(family_history)
|
|
488
|
+ height := c.GetString("height")
|
468
|
489
|
history_of_present_illness := c.GetString("history_of_present_illness")
|
|
490
|
+ is_infect, _ := c.GetInt64("is_infect")
|
|
491
|
+ fmt.Println("is", is_infect)
|
469
|
492
|
past_history := c.GetString("past_history")
|
|
493
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
494
|
+ his_patient_id, _ := c.GetInt64("his_patient_id")
|
|
495
|
+ fmt.Println("patient_id", patient_id)
|
470
|
496
|
personal_history := c.GetString("personal_history")
|
471
|
|
- family_history := c.GetString("family_history")
|
|
497
|
+ pulse := c.GetString("pulse")
|
|
498
|
+ pulsefloat, _ := strconv.ParseFloat(pulse, 64)
|
|
499
|
+ sbp := c.GetString("sbp")
|
|
500
|
+ sbpfloat, _ := strconv.ParseFloat(sbp, 64)
|
|
501
|
+ heightfloat, _ := strconv.ParseFloat(height, 64)
|
|
502
|
+ sicktype := c.GetString("sick_type")
|
|
503
|
+ fmt.Println("sicketype", sicktype)
|
|
504
|
+ sick_type, _ := strconv.ParseInt(sicktype, 10, 64)
|
|
505
|
+ symptom := c.GetString("symptom")
|
|
506
|
+ sick_date := c.GetString("sick_date")
|
|
507
|
+ temperatures := c.GetString("temperature")
|
|
508
|
+ fmt.Println("temperatures", temperatures)
|
|
509
|
+ temperature, _ := strconv.ParseFloat(temperatures, 64)
|
472
|
510
|
record_date := c.GetString("record_date")
|
473
|
|
- patient_id, _ := c.GetInt64("patient_id")
|
|
511
|
+ breathing := c.GetString("breathing")
|
|
512
|
+ doctor_advice := c.GetString("doctor_advice")
|
|
513
|
+ remark := c.GetString("remark")
|
|
514
|
+ breathingfloat, _ := strconv.ParseFloat(breathing, 64)
|
|
515
|
+ fmt.Println("breathingfloat", breathingfloat)
|
474
|
516
|
timeLayout := "2006-01-02"
|
475
|
517
|
loc, _ := time.LoadLocation("Local")
|
476
|
518
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
@@ -487,14 +529,15 @@ func (c *HisApiController) CreateHisPatientCaseHistory() {
|
487
|
529
|
sickTimes := sickTime.Unix()
|
488
|
530
|
ctime := time.Now().Unix()
|
489
|
531
|
caseHistory := models.HisPatientCaseHistory{
|
490
|
|
- HisPatientId: patient_id,
|
|
532
|
+ HisPatientId: his_patient_id,
|
|
533
|
+ PatientId: patient_id,
|
491
|
534
|
Temperature: temperature,
|
492
|
|
- BloodSugar: blood_sugar,
|
493
|
|
- Pulse: pulse,
|
494
|
|
- Sbp: sbp,
|
495
|
|
- Dbp: dbp,
|
496
|
|
- Height: height,
|
497
|
|
- BloodFat: blood_fat,
|
|
535
|
+ BloodSugar: bloodsugarfloat,
|
|
536
|
+ Pulse: pulsefloat,
|
|
537
|
+ Sbp: sbpfloat,
|
|
538
|
+ Dbp: dbpfloat,
|
|
539
|
+ Height: heightfloat,
|
|
540
|
+ BloodFat: bloodfatfloat,
|
498
|
541
|
SickType: sick_type,
|
499
|
542
|
Symptom: symptom,
|
500
|
543
|
SickDate: sickTimes,
|
|
@@ -511,13 +554,26 @@ func (c *HisApiController) CreateHisPatientCaseHistory() {
|
511
|
554
|
Ctime: ctime,
|
512
|
555
|
Mtime: ctime,
|
513
|
556
|
RecordDate: recordDateTime,
|
|
557
|
+ DeliveryWay: delivery_way,
|
|
558
|
+ Breathing: breathingfloat,
|
|
559
|
+ DoctorAdvice: doctor_advice,
|
|
560
|
+ Remark: remark,
|
514
|
561
|
}
|
515
|
|
- err = service.SaveHisPatientCaseHistory(caseHistory)
|
516
|
|
- if err != nil {
|
517
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
518
|
|
- "msg": "保存成功",
|
519
|
|
- })
|
|
562
|
+
|
|
563
|
+ //查询该患者是否有病历
|
|
564
|
+ _, errcode := service.GetHisPatientCaseHistoryById(his_patient_id)
|
|
565
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
566
|
+ err = service.SaveHisPatientCaseHistory(caseHistory)
|
|
567
|
+ if err != nil {
|
|
568
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
569
|
+ "msg": "保存成功",
|
|
570
|
+ })
|
|
571
|
+ }
|
|
572
|
+ } else if errcode == nil {
|
|
573
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
574
|
+ return
|
520
|
575
|
}
|
|
576
|
+
|
521
|
577
|
}
|
522
|
578
|
func (c *HisApiController) GetHisPatientCaseHistoryList() {
|
523
|
579
|
patient_id, _ := c.GetInt64("patient_id", 0)
|
|
@@ -542,25 +598,27 @@ func (c *HisApiController) GetHisPatientCaseHistory() {
|
542
|
598
|
}
|
543
|
599
|
func (c *HisApiController) CreateCaseHistoryTemplate() {
|
544
|
600
|
template_name := c.GetString("template_name")
|
|
601
|
+ fmt.Println("template_name22222222222222", template_name)
|
545
|
602
|
template_remark := c.GetString("template_remark")
|
546
|
603
|
doctor := c.GetAdminUserInfo().AdminUser.Id
|
547
|
604
|
diagnostic := c.GetString("diagnostic")
|
548
|
|
- chief_conplaint := c.GetString("chief_conplaint")
|
|
605
|
+ chief_conplaint := c.GetString("chief_conplain")
|
549
|
606
|
history_of_present_illness := c.GetString("history_of_present_illness")
|
550
|
607
|
past_history := c.GetString("past_history")
|
551
|
608
|
personal_history := c.GetString("personal_history")
|
552
|
609
|
family_history := c.GetString("family_history")
|
553
|
|
- record_date := c.GetString("record_date")
|
554
|
|
-
|
555
|
|
- timeLayout := "2006-01-02"
|
556
|
|
- loc, _ := time.LoadLocation("Local")
|
557
|
|
-
|
558
|
|
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
559
|
|
- if err != nil {
|
560
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
561
|
|
- return
|
562
|
|
- }
|
563
|
|
- recordDateTime := theTime.Unix()
|
|
610
|
+ user_name := c.GetString("user_name")
|
|
611
|
+ //record_date := c.GetString("record_date")
|
|
612
|
+ //fmt.Println("record_date--------",record_date)
|
|
613
|
+ //timeLayout := "2006-01-02"
|
|
614
|
+ //loc, _ := time.LoadLocation("Local")
|
|
615
|
+ //
|
|
616
|
+ //theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
617
|
+ //if err != nil {
|
|
618
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
619
|
+ // return
|
|
620
|
+ //}
|
|
621
|
+ //recordDateTime := theTime.Unix()
|
564
|
622
|
|
565
|
623
|
ctime := time.Now().Unix()
|
566
|
624
|
|
|
@@ -575,14 +633,15 @@ func (c *HisApiController) CreateCaseHistoryTemplate() {
|
575
|
633
|
Status: 1,
|
576
|
634
|
Ctime: ctime,
|
577
|
635
|
Mtime: ctime,
|
578
|
|
- RecordDate: recordDateTime,
|
|
636
|
+ RecordDate: time.Now().Unix(),
|
579
|
637
|
TemplateName: template_name,
|
580
|
638
|
TemplateRemark: template_remark,
|
581
|
639
|
Creator: doctor,
|
582
|
640
|
Modifier: doctor,
|
|
641
|
+ UserName: user_name,
|
583
|
642
|
}
|
584
|
643
|
|
585
|
|
- err = service.SaveHisPatientCaseHistoryTemplate(template)
|
|
644
|
+ err := service.SaveHisPatientCaseHistoryTemplate(template)
|
586
|
645
|
|
587
|
646
|
if err == nil {
|
588
|
647
|
c.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -596,10 +655,19 @@ func (c *HisApiController) CreateCaseHistoryTemplate() {
|
596
|
655
|
|
597
|
656
|
}
|
598
|
657
|
func (c *HisApiController) GetCaseHistoryTemplate() {
|
|
658
|
+ timeLayout := "2006-01-02"
|
|
659
|
+ loc, _ := time.LoadLocation("Local")
|
|
660
|
+ keyword := c.GetString("keyword")
|
|
661
|
+ start_time := c.GetString("start_time")
|
|
662
|
+ end_time := c.GetString("end_time")
|
|
663
|
+ startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
664
|
+ endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
599
|
665
|
admin := c.GetAdminUserInfo()
|
600
|
|
- template, _ := service.GetHisPatientCaseHistoryTemplate(admin.CurrentOrgId)
|
|
666
|
+ template, _ := service.GetHisPatientCaseHistoryTemplate(admin.CurrentOrgId, startTime.Unix(), endTime.Unix(), keyword)
|
|
667
|
+ history, _ := service.GetHisPatientCaseHistory(admin.CurrentOrgId)
|
601
|
668
|
c.ServeSuccessJSON(map[string]interface{}{
|
602
|
669
|
"template": template,
|
|
670
|
+ "history": history,
|
603
|
671
|
})
|
604
|
672
|
|
605
|
673
|
}
|
|
@@ -814,9 +882,9 @@ func (c *HisApiController) GetRegisterInfo() {
|
814
|
882
|
|
815
|
883
|
}
|
816
|
884
|
|
817
|
|
-func (c *HisApiController) GetPrintHisPatientCaseHistory() {
|
818
|
|
-
|
819
|
|
-}
|
|
885
|
+//func (c *HisApiController) GetPrintHisPatientCaseHistory() {
|
|
886
|
+//
|
|
887
|
+//}
|
820
|
888
|
func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo, json map[string]interface{}) int {
|
821
|
889
|
|
822
|
890
|
if json["drug_name"] == nil || reflect.TypeOf(json["drug_name"]).String() != "string" {
|
|
@@ -901,26 +969,22 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
|
901
|
969
|
}
|
902
|
970
|
|
903
|
971
|
func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionProject, json map[string]interface{}) int {
|
904
|
|
-
|
905
|
972
|
if json["id"] != nil || reflect.TypeOf(json["id"]).String() == "float64" {
|
906
|
973
|
id := int64(json["id"].(float64))
|
907
|
974
|
project.ID = id
|
908
|
975
|
}
|
909
|
|
-
|
910
|
976
|
if json["project_id"] != nil || reflect.TypeOf(json["project_id"]).String() == "float64" {
|
911
|
977
|
project_id := int64(json["project_id"].(float64))
|
912
|
978
|
project.ProjectId = project_id
|
913
|
979
|
fmt.Println(project_id)
|
914
|
980
|
fmt.Println(project.ProjectId)
|
915
|
981
|
}
|
916
|
|
-
|
917
|
982
|
if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
|
918
|
983
|
price := int64(json["price"].(float64))
|
919
|
984
|
formatInt_price := strconv.FormatInt(price, 10)
|
920
|
985
|
float_price, _ := strconv.ParseFloat(formatInt_price, 64)
|
921
|
986
|
project.Price = float_price
|
922
|
987
|
}
|
923
|
|
-
|
924
|
988
|
if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
|
925
|
989
|
total, _ := json["total"].(string)
|
926
|
990
|
totals, _ := strconv.ParseInt(total, 10, 64)
|
|
@@ -931,6 +995,23 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
|
931
|
995
|
medical_code, _ := json["medical_code"].(string)
|
932
|
996
|
project.MedListCodg = medical_code
|
933
|
997
|
}
|
|
998
|
+ if json["single_dose"] != nil && reflect.TypeOf(json["single_dose"]).String() == "string" {
|
|
999
|
+ single_dose, _ := json["single_dose"].(string)
|
|
1000
|
+ project.SingleDose = single_dose
|
|
1001
|
+ }
|
|
1002
|
+
|
|
1003
|
+ if json["delivery_way"] != nil && reflect.TypeOf(json["delivery_way"]).String() == "string" {
|
|
1004
|
+ delivery_way, _ := json["delivery_way"].(string)
|
|
1005
|
+ project.DeliveryWay = delivery_way
|
|
1006
|
+ }
|
|
1007
|
+ if json["execution_frequency"] != nil && reflect.TypeOf(json["execution_frequency"]).String() == "string" {
|
|
1008
|
+ execution_frequency, _ := json["execution_frequency"].(string)
|
|
1009
|
+ project.ExecutionFrequency = execution_frequency
|
|
1010
|
+ }
|
|
1011
|
+ if json["number_days"] != nil && reflect.TypeOf(json["number_days"]).String() == "string" {
|
|
1012
|
+ day, _ := json["number_days"].(string)
|
|
1013
|
+ project.Day = day
|
|
1014
|
+ }
|
934
|
1015
|
return 0
|
935
|
1016
|
}
|
936
|
1017
|
|
|
@@ -1008,6 +1089,11 @@ func (c *HisApiController) GetUploadInfo() {
|
1008
|
1089
|
data["doctor"] = patientPrescription.Doctor
|
1009
|
1090
|
data["dept"] = patientPrescription.Departments
|
1010
|
1091
|
|
|
1092
|
+ var ids []int64
|
|
1093
|
+ for _, item := range prescriptions {
|
|
1094
|
+ ids = append(ids, item.ID)
|
|
1095
|
+ }
|
|
1096
|
+
|
1011
|
1097
|
bytesData, _ := json.Marshal(data)
|
1012
|
1098
|
req, _ := http.NewRequest("POST", "http://127.0.0.1:9531/"+"gdyb/five", bytes.NewReader(bytesData))
|
1013
|
1099
|
resp, _ := client.Do(req)
|
|
@@ -1112,6 +1198,8 @@ func (c *HisApiController) GetUploadInfo() {
|
1112
|
1198
|
service.CreateOrderInfo(info)
|
1113
|
1199
|
}
|
1114
|
1200
|
|
|
1201
|
+ service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
|
|
1202
|
+
|
1115
|
1203
|
var total float64
|
1116
|
1204
|
for _, item := range prescriptions {
|
1117
|
1205
|
if item.Type == 1 { //药品
|
|
@@ -1179,3 +1267,67 @@ func (c *HisApiController) GetUploadInfo() {
|
1179
|
1267
|
|
1180
|
1268
|
}
|
1181
|
1269
|
}
|
|
1270
|
+
|
|
1271
|
+func (c *HisApiController) GetHisOrderList() {
|
|
1272
|
+ adminUser := c.GetAdminUserInfo()
|
|
1273
|
+ org_id := adminUser.CurrentOrgId
|
|
1274
|
+ order, err := service.GetHisOrderList(org_id)
|
|
1275
|
+ if err == nil {
|
|
1276
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1277
|
+ "order": order,
|
|
1278
|
+ })
|
|
1279
|
+ } else {
|
|
1280
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1281
|
+ return
|
|
1282
|
+ }
|
|
1283
|
+}
|
|
1284
|
+
|
|
1285
|
+func (c *HisApiController) GetHisOrder() {
|
|
1286
|
+ patient_id, _ := c.GetInt64("patient_id", 0)
|
|
1287
|
+ number := c.GetString("number")
|
|
1288
|
+ adminInfo := c.GetAdminUserInfo()
|
|
1289
|
+ order, err := service.GetHisOrder(adminInfo.CurrentOrgId, number, patient_id)
|
|
1290
|
+ prescriptions, _ := service.GetHisPrescriptionThree(adminInfo.CurrentOrgId, patient_id, order.SettleAccountsDate, order.Number)
|
|
1291
|
+
|
|
1292
|
+ if err == nil {
|
|
1293
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1294
|
+ "order": order,
|
|
1295
|
+ "prescription": prescriptions,
|
|
1296
|
+ })
|
|
1297
|
+ } else {
|
|
1298
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1299
|
+ return
|
|
1300
|
+ }
|
|
1301
|
+
|
|
1302
|
+}
|
|
1303
|
+
|
|
1304
|
+func (c *HisApiController) GetHisPrescriptionList() {
|
|
1305
|
+ adminInfo := c.GetAdminUserInfo()
|
|
1306
|
+ fmt.Println("11111dassdfs11")
|
|
1307
|
+ prescriptionOrder, err := service.GetHisPrescriptionOrderList(adminInfo.CurrentOrgId)
|
|
1308
|
+ fmt.Println(prescriptionOrder)
|
|
1309
|
+
|
|
1310
|
+ if err == nil {
|
|
1311
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1312
|
+ "order": prescriptionOrder,
|
|
1313
|
+ })
|
|
1314
|
+ } else {
|
|
1315
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1316
|
+ return
|
|
1317
|
+ }
|
|
1318
|
+}
|
|
1319
|
+
|
|
1320
|
+func (c *HisApiController) GetHisPrescriptionInfo() {
|
|
1321
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
1322
|
+ his_patient_id, _ := c.GetInt64("his_patient_id")
|
|
1323
|
+ adminInfo := c.GetAdminUserInfo()
|
|
1324
|
+ prescriptionOrder, err := service.GetHisPrescriptionOrderInfo(patient_id, his_patient_id, adminInfo.CurrentOrgId)
|
|
1325
|
+ if err == nil {
|
|
1326
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1327
|
+ "order": prescriptionOrder,
|
|
1328
|
+ })
|
|
1329
|
+ } else {
|
|
1330
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1331
|
+ return
|
|
1332
|
+ }
|
|
1333
|
+}
|