|
@@ -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"
|
|
@@ -39,10 +40,10 @@ func HisManagerApiRegistRouters() {
|
39
|
40
|
|
40
|
41
|
beego.Router("/api/doctorworkstation/casehistory/list", &HisApiController{}, "get:GetHisPatientCaseHistoryList")
|
41
|
42
|
beego.Router("/api/doctorworkstation/casehistory/get", &HisApiController{}, "get:GetHisPatientCaseHistory")
|
42
|
|
- beego.Router("/api/doctorworkstation/casehistory/create", &HisApiController{}, "post:CreateHisPatientCaseHistory")
|
43
|
|
- 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")
|
44
|
45
|
beego.Router("/api/doctorworkstation/casehistorytemplate/get", &HisApiController{}, "get:GetCaseHistoryTemplate")
|
45
|
|
- beego.Router("/api/doctorworkstation/printcasehistory/get", &HisApiController{}, "get:GetPrintHisPatientCaseHistory")
|
|
46
|
+ //beego.Router("/api/doctorworkstation/printcasehistory/get", &HisApiController{}, "get:GetPrintHisPatientCaseHistory")
|
46
|
47
|
|
47
|
48
|
beego.Router("/api/hisorder/list", &HisApiController{}, "get:GetHisOrderList")
|
48
|
49
|
|
|
@@ -468,25 +469,50 @@ func (c *HisApiController) CreateHisAdditionalCharge() {
|
468
|
469
|
}
|
469
|
470
|
|
470
|
471
|
func (c *HisApiController) CreateHisPatientCaseHistory() {
|
471
|
|
- diagnostic := c.GetString("diagnostic")
|
472
|
|
- temperature, _ := c.GetFloat("temperature")
|
473
|
|
- blood_sugar, _ := c.GetFloat("blood_sugar")
|
474
|
|
- pulse, _ := c.GetFloat("pulse")
|
475
|
|
- sbp, _ := c.GetFloat("sbp")
|
476
|
|
- dbp, _ := c.GetFloat("dbp")
|
477
|
|
- blood_fat, _ := c.GetFloat("blood_fat")
|
478
|
|
- height, _ := c.GetFloat("height")
|
479
|
|
- sick_type, _ := c.GetInt64("sick_type")
|
480
|
|
- symptom := c.GetString("symptom")
|
481
|
|
- sick_date := c.GetString("sick_date")
|
482
|
|
- 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)
|
483
|
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")
|
484
|
489
|
history_of_present_illness := c.GetString("history_of_present_illness")
|
|
490
|
+ is_infect, _ := c.GetInt64("is_infect")
|
|
491
|
+ fmt.Println("is", is_infect)
|
485
|
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)
|
486
|
496
|
personal_history := c.GetString("personal_history")
|
487
|
|
- 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)
|
488
|
510
|
record_date := c.GetString("record_date")
|
489
|
|
- 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)
|
490
|
516
|
timeLayout := "2006-01-02"
|
491
|
517
|
loc, _ := time.LoadLocation("Local")
|
492
|
518
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
@@ -503,14 +529,15 @@ func (c *HisApiController) CreateHisPatientCaseHistory() {
|
503
|
529
|
sickTimes := sickTime.Unix()
|
504
|
530
|
ctime := time.Now().Unix()
|
505
|
531
|
caseHistory := models.HisPatientCaseHistory{
|
506
|
|
- HisPatientId: patient_id,
|
|
532
|
+ HisPatientId: his_patient_id,
|
|
533
|
+ PatientId: patient_id,
|
507
|
534
|
Temperature: temperature,
|
508
|
|
- BloodSugar: blood_sugar,
|
509
|
|
- Pulse: pulse,
|
510
|
|
- Sbp: sbp,
|
511
|
|
- Dbp: dbp,
|
512
|
|
- Height: height,
|
513
|
|
- BloodFat: blood_fat,
|
|
535
|
+ BloodSugar: bloodsugarfloat,
|
|
536
|
+ Pulse: pulsefloat,
|
|
537
|
+ Sbp: sbpfloat,
|
|
538
|
+ Dbp: dbpfloat,
|
|
539
|
+ Height: heightfloat,
|
|
540
|
+ BloodFat: bloodfatfloat,
|
514
|
541
|
SickType: sick_type,
|
515
|
542
|
Symptom: symptom,
|
516
|
543
|
SickDate: sickTimes,
|
|
@@ -527,13 +554,26 @@ func (c *HisApiController) CreateHisPatientCaseHistory() {
|
527
|
554
|
Ctime: ctime,
|
528
|
555
|
Mtime: ctime,
|
529
|
556
|
RecordDate: recordDateTime,
|
|
557
|
+ DeliveryWay: delivery_way,
|
|
558
|
+ Breathing: breathingfloat,
|
|
559
|
+ DoctorAdvice: doctor_advice,
|
|
560
|
+ Remark: remark,
|
530
|
561
|
}
|
531
|
|
- err = service.SaveHisPatientCaseHistory(caseHistory)
|
532
|
|
- if err != nil {
|
533
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
534
|
|
- "msg": "保存成功",
|
535
|
|
- })
|
|
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
|
536
|
575
|
}
|
|
576
|
+
|
537
|
577
|
}
|
538
|
578
|
func (c *HisApiController) GetHisPatientCaseHistoryList() {
|
539
|
579
|
patient_id, _ := c.GetInt64("patient_id", 0)
|
|
@@ -558,25 +598,27 @@ func (c *HisApiController) GetHisPatientCaseHistory() {
|
558
|
598
|
}
|
559
|
599
|
func (c *HisApiController) CreateCaseHistoryTemplate() {
|
560
|
600
|
template_name := c.GetString("template_name")
|
|
601
|
+ fmt.Println("template_name22222222222222", template_name)
|
561
|
602
|
template_remark := c.GetString("template_remark")
|
562
|
603
|
doctor := c.GetAdminUserInfo().AdminUser.Id
|
563
|
604
|
diagnostic := c.GetString("diagnostic")
|
564
|
|
- chief_conplaint := c.GetString("chief_conplaint")
|
|
605
|
+ chief_conplaint := c.GetString("chief_conplain")
|
565
|
606
|
history_of_present_illness := c.GetString("history_of_present_illness")
|
566
|
607
|
past_history := c.GetString("past_history")
|
567
|
608
|
personal_history := c.GetString("personal_history")
|
568
|
609
|
family_history := c.GetString("family_history")
|
569
|
|
- record_date := c.GetString("record_date")
|
570
|
|
-
|
571
|
|
- timeLayout := "2006-01-02"
|
572
|
|
- loc, _ := time.LoadLocation("Local")
|
573
|
|
-
|
574
|
|
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
575
|
|
- if err != nil {
|
576
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
577
|
|
- return
|
578
|
|
- }
|
579
|
|
- 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()
|
580
|
622
|
|
581
|
623
|
ctime := time.Now().Unix()
|
582
|
624
|
|
|
@@ -591,14 +633,15 @@ func (c *HisApiController) CreateCaseHistoryTemplate() {
|
591
|
633
|
Status: 1,
|
592
|
634
|
Ctime: ctime,
|
593
|
635
|
Mtime: ctime,
|
594
|
|
- RecordDate: recordDateTime,
|
|
636
|
+ RecordDate: time.Now().Unix(),
|
595
|
637
|
TemplateName: template_name,
|
596
|
638
|
TemplateRemark: template_remark,
|
597
|
639
|
Creator: doctor,
|
598
|
640
|
Modifier: doctor,
|
|
641
|
+ UserName: user_name,
|
599
|
642
|
}
|
600
|
643
|
|
601
|
|
- err = service.SaveHisPatientCaseHistoryTemplate(template)
|
|
644
|
+ err := service.SaveHisPatientCaseHistoryTemplate(template)
|
602
|
645
|
|
603
|
646
|
if err == nil {
|
604
|
647
|
c.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -612,10 +655,19 @@ func (c *HisApiController) CreateCaseHistoryTemplate() {
|
612
|
655
|
|
613
|
656
|
}
|
614
|
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)
|
615
|
665
|
admin := c.GetAdminUserInfo()
|
616
|
|
- template, _ := service.GetHisPatientCaseHistoryTemplate(admin.CurrentOrgId)
|
|
666
|
+ template, _ := service.GetHisPatientCaseHistoryTemplate(admin.CurrentOrgId, startTime.Unix(), endTime.Unix(), keyword)
|
|
667
|
+ history, _ := service.GetHisPatientCaseHistory(admin.CurrentOrgId)
|
617
|
668
|
c.ServeSuccessJSON(map[string]interface{}{
|
618
|
669
|
"template": template,
|
|
670
|
+ "history": history,
|
619
|
671
|
})
|
620
|
672
|
|
621
|
673
|
}
|
|
@@ -830,9 +882,9 @@ func (c *HisApiController) GetRegisterInfo() {
|
830
|
882
|
|
831
|
883
|
}
|
832
|
884
|
|
833
|
|
-func (c *HisApiController) GetPrintHisPatientCaseHistory() {
|
834
|
|
-
|
835
|
|
-}
|
|
885
|
+//func (c *HisApiController) GetPrintHisPatientCaseHistory() {
|
|
886
|
+//
|
|
887
|
+//}
|
836
|
888
|
func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo, json map[string]interface{}) int {
|
837
|
889
|
|
838
|
890
|
if json["drug_name"] == nil || reflect.TypeOf(json["drug_name"]).String() != "string" {
|