|
@@ -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"
|
|
@@ -36,10 +37,10 @@ func HisManagerApiRegistRouters() {
|
36
|
37
|
|
37
|
38
|
beego.Router("/api/doctorworkstation/casehistory/list", &HisApiController{}, "get:GetHisPatientCaseHistoryList")
|
38
|
39
|
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")
|
|
40
|
+ beego.Router("/api/doctorworkstation/casehistory/create", &HisApiController{}, "get:CreateHisPatientCaseHistory")
|
|
41
|
+ beego.Router("/api/doctorworkstation/casehistorytemplate/create", &HisApiController{}, "get:CreateCaseHistoryTemplate")
|
41
|
42
|
beego.Router("/api/doctorworkstation/casehistorytemplate/get", &HisApiController{}, "get:GetCaseHistoryTemplate")
|
42
|
|
- beego.Router("/api/doctorworkstation/printcasehistory/get", &HisApiController{}, "get:GetPrintHisPatientCaseHistory")
|
|
43
|
+ //beego.Router("/api/doctorworkstation/printcasehistory/get", &HisApiController{}, "get:GetPrintHisPatientCaseHistory")
|
43
|
44
|
|
44
|
45
|
beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
|
45
|
46
|
beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
|
|
@@ -449,25 +450,50 @@ func (c *HisApiController) CreateHisAdditionalCharge() {
|
449
|
450
|
}
|
450
|
451
|
|
451
|
452
|
func (c *HisApiController) CreateHisPatientCaseHistory() {
|
452
|
|
- diagnostic := c.GetString("diagnostic")
|
453
|
|
- temperature, _ := c.GetFloat("temperature")
|
454
|
|
- blood_sugar, _ := c.GetFloat("blood_sugar")
|
455
|
|
- pulse, _ := c.GetFloat("pulse")
|
456
|
|
- sbp, _ := c.GetFloat("sbp")
|
457
|
|
- dbp, _ := c.GetFloat("dbp")
|
458
|
|
- blood_fat, _ := c.GetFloat("blood_fat")
|
459
|
|
- height, _ := c.GetFloat("height")
|
460
|
|
- sick_type, _ := c.GetInt64("sick_type")
|
461
|
|
- symptom := c.GetString("symptom")
|
462
|
|
- sick_date := c.GetString("sick_date")
|
463
|
|
- is_infect, _ := c.GetInt64("is_infect")
|
|
453
|
+
|
|
454
|
+ blood_fat := c.GetString("blood_fat")
|
|
455
|
+ bloodfatfloat, _ := strconv.ParseFloat(blood_fat, 64)
|
|
456
|
+ fmt.Println("33333333", bloodfatfloat)
|
|
457
|
+ blood_sugar := c.GetString("blood_sugar")
|
|
458
|
+ bloodsugarfloat, _ := strconv.ParseFloat(blood_sugar, 64)
|
|
459
|
+ fmt.Println(bloodsugarfloat)
|
464
|
460
|
chief_conplaint := c.GetString("chief_conplaint")
|
|
461
|
+
|
|
462
|
+ dbp := c.GetString("dbp")
|
|
463
|
+ dbpfloat, _ := strconv.ParseFloat(dbp, 64)
|
|
464
|
+ delivery_way, _ := c.GetInt64("delivery_way")
|
|
465
|
+ diagnostic := c.GetString("diagnostic")
|
|
466
|
+ fmt.Println("diagnostic", diagnostic)
|
|
467
|
+ family_history := c.GetString("family_history")
|
|
468
|
+ fmt.Println(family_history)
|
|
469
|
+ height := c.GetString("height")
|
465
|
470
|
history_of_present_illness := c.GetString("history_of_present_illness")
|
|
471
|
+ is_infect, _ := c.GetInt64("is_infect")
|
|
472
|
+ fmt.Println("is", is_infect)
|
466
|
473
|
past_history := c.GetString("past_history")
|
|
474
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
475
|
+ his_patient_id, _ := c.GetInt64("his_patient_id")
|
|
476
|
+ fmt.Println("patient_id", patient_id)
|
467
|
477
|
personal_history := c.GetString("personal_history")
|
468
|
|
- family_history := c.GetString("family_history")
|
|
478
|
+ pulse := c.GetString("pulse")
|
|
479
|
+ pulsefloat, _ := strconv.ParseFloat(pulse, 64)
|
|
480
|
+ sbp := c.GetString("sbp")
|
|
481
|
+ sbpfloat, _ := strconv.ParseFloat(sbp, 64)
|
|
482
|
+ heightfloat, _ := strconv.ParseFloat(height, 64)
|
|
483
|
+ sicktype := c.GetString("sick_type")
|
|
484
|
+ fmt.Println("sicketype", sicktype)
|
|
485
|
+ sick_type, _ := strconv.ParseInt(sicktype, 10, 64)
|
|
486
|
+ symptom := c.GetString("symptom")
|
|
487
|
+ sick_date := c.GetString("sick_date")
|
|
488
|
+ temperatures := c.GetString("temperature")
|
|
489
|
+ fmt.Println("temperatures", temperatures)
|
|
490
|
+ temperature, _ := strconv.ParseFloat(temperatures, 64)
|
469
|
491
|
record_date := c.GetString("record_date")
|
470
|
|
- patient_id, _ := c.GetInt64("patient_id")
|
|
492
|
+ breathing := c.GetString("breathing")
|
|
493
|
+ doctor_advice := c.GetString("doctor_advice")
|
|
494
|
+ remark := c.GetString("remark")
|
|
495
|
+ breathingfloat, _ := strconv.ParseFloat(breathing, 64)
|
|
496
|
+ fmt.Println("breathingfloat", breathingfloat)
|
471
|
497
|
timeLayout := "2006-01-02"
|
472
|
498
|
loc, _ := time.LoadLocation("Local")
|
473
|
499
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
@@ -484,14 +510,15 @@ func (c *HisApiController) CreateHisPatientCaseHistory() {
|
484
|
510
|
sickTimes := sickTime.Unix()
|
485
|
511
|
ctime := time.Now().Unix()
|
486
|
512
|
caseHistory := models.HisPatientCaseHistory{
|
487
|
|
- HisPatientId: patient_id,
|
|
513
|
+ HisPatientId: his_patient_id,
|
|
514
|
+ PatientId: patient_id,
|
488
|
515
|
Temperature: temperature,
|
489
|
|
- BloodSugar: blood_sugar,
|
490
|
|
- Pulse: pulse,
|
491
|
|
- Sbp: sbp,
|
492
|
|
- Dbp: dbp,
|
493
|
|
- Height: height,
|
494
|
|
- BloodFat: blood_fat,
|
|
516
|
+ BloodSugar: bloodsugarfloat,
|
|
517
|
+ Pulse: pulsefloat,
|
|
518
|
+ Sbp: sbpfloat,
|
|
519
|
+ Dbp: dbpfloat,
|
|
520
|
+ Height: heightfloat,
|
|
521
|
+ BloodFat: bloodfatfloat,
|
495
|
522
|
SickType: sick_type,
|
496
|
523
|
Symptom: symptom,
|
497
|
524
|
SickDate: sickTimes,
|
|
@@ -508,13 +535,26 @@ func (c *HisApiController) CreateHisPatientCaseHistory() {
|
508
|
535
|
Ctime: ctime,
|
509
|
536
|
Mtime: ctime,
|
510
|
537
|
RecordDate: recordDateTime,
|
|
538
|
+ DeliveryWay: delivery_way,
|
|
539
|
+ Breathing: breathingfloat,
|
|
540
|
+ DoctorAdvice: doctor_advice,
|
|
541
|
+ Remark: remark,
|
511
|
542
|
}
|
512
|
|
- err = service.SaveHisPatientCaseHistory(caseHistory)
|
513
|
|
- if err != nil {
|
514
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
515
|
|
- "msg": "保存成功",
|
516
|
|
- })
|
|
543
|
+
|
|
544
|
+ //查询该患者是否有病历
|
|
545
|
+ _, errcode := service.GetHisPatientCaseHistoryById(his_patient_id)
|
|
546
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
547
|
+ err = service.SaveHisPatientCaseHistory(caseHistory)
|
|
548
|
+ if err != nil {
|
|
549
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
550
|
+ "msg": "保存成功",
|
|
551
|
+ })
|
|
552
|
+ }
|
|
553
|
+ } else if errcode == nil {
|
|
554
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
555
|
+ return
|
517
|
556
|
}
|
|
557
|
+
|
518
|
558
|
}
|
519
|
559
|
func (c *HisApiController) GetHisPatientCaseHistoryList() {
|
520
|
560
|
patient_id, _ := c.GetInt64("patient_id", 0)
|
|
@@ -539,25 +579,27 @@ func (c *HisApiController) GetHisPatientCaseHistory() {
|
539
|
579
|
}
|
540
|
580
|
func (c *HisApiController) CreateCaseHistoryTemplate() {
|
541
|
581
|
template_name := c.GetString("template_name")
|
|
582
|
+ fmt.Println("template_name22222222222222", template_name)
|
542
|
583
|
template_remark := c.GetString("template_remark")
|
543
|
584
|
doctor := c.GetAdminUserInfo().AdminUser.Id
|
544
|
585
|
diagnostic := c.GetString("diagnostic")
|
545
|
|
- chief_conplaint := c.GetString("chief_conplaint")
|
|
586
|
+ chief_conplaint := c.GetString("chief_conplain")
|
546
|
587
|
history_of_present_illness := c.GetString("history_of_present_illness")
|
547
|
588
|
past_history := c.GetString("past_history")
|
548
|
589
|
personal_history := c.GetString("personal_history")
|
549
|
590
|
family_history := c.GetString("family_history")
|
550
|
|
- record_date := c.GetString("record_date")
|
551
|
|
-
|
552
|
|
- timeLayout := "2006-01-02"
|
553
|
|
- loc, _ := time.LoadLocation("Local")
|
554
|
|
-
|
555
|
|
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
556
|
|
- if err != nil {
|
557
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
558
|
|
- return
|
559
|
|
- }
|
560
|
|
- recordDateTime := theTime.Unix()
|
|
591
|
+ user_name := c.GetString("user_name")
|
|
592
|
+ //record_date := c.GetString("record_date")
|
|
593
|
+ //fmt.Println("record_date--------",record_date)
|
|
594
|
+ //timeLayout := "2006-01-02"
|
|
595
|
+ //loc, _ := time.LoadLocation("Local")
|
|
596
|
+ //
|
|
597
|
+ //theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
598
|
+ //if err != nil {
|
|
599
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
600
|
+ // return
|
|
601
|
+ //}
|
|
602
|
+ //recordDateTime := theTime.Unix()
|
561
|
603
|
|
562
|
604
|
ctime := time.Now().Unix()
|
563
|
605
|
|
|
@@ -572,14 +614,15 @@ func (c *HisApiController) CreateCaseHistoryTemplate() {
|
572
|
614
|
Status: 1,
|
573
|
615
|
Ctime: ctime,
|
574
|
616
|
Mtime: ctime,
|
575
|
|
- RecordDate: recordDateTime,
|
|
617
|
+ RecordDate: time.Now().Unix(),
|
576
|
618
|
TemplateName: template_name,
|
577
|
619
|
TemplateRemark: template_remark,
|
578
|
620
|
Creator: doctor,
|
579
|
621
|
Modifier: doctor,
|
|
622
|
+ UserName: user_name,
|
580
|
623
|
}
|
581
|
624
|
|
582
|
|
- err = service.SaveHisPatientCaseHistoryTemplate(template)
|
|
625
|
+ err := service.SaveHisPatientCaseHistoryTemplate(template)
|
583
|
626
|
|
584
|
627
|
if err == nil {
|
585
|
628
|
c.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -593,10 +636,19 @@ func (c *HisApiController) CreateCaseHistoryTemplate() {
|
593
|
636
|
|
594
|
637
|
}
|
595
|
638
|
func (c *HisApiController) GetCaseHistoryTemplate() {
|
|
639
|
+ timeLayout := "2006-01-02"
|
|
640
|
+ loc, _ := time.LoadLocation("Local")
|
|
641
|
+ keyword := c.GetString("keyword")
|
|
642
|
+ start_time := c.GetString("start_time")
|
|
643
|
+ end_time := c.GetString("end_time")
|
|
644
|
+ startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
645
|
+ endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
596
|
646
|
admin := c.GetAdminUserInfo()
|
597
|
|
- template, _ := service.GetHisPatientCaseHistoryTemplate(admin.CurrentOrgId)
|
|
647
|
+ template, _ := service.GetHisPatientCaseHistoryTemplate(admin.CurrentOrgId, startTime.Unix(), endTime.Unix(), keyword)
|
|
648
|
+ history, _ := service.GetHisPatientCaseHistory(admin.CurrentOrgId)
|
598
|
649
|
c.ServeSuccessJSON(map[string]interface{}{
|
599
|
650
|
"template": template,
|
|
651
|
+ "history": history,
|
600
|
652
|
})
|
601
|
653
|
|
602
|
654
|
}
|
|
@@ -797,9 +849,9 @@ func (c *HisApiController) GetRegisterInfo() {
|
797
|
849
|
|
798
|
850
|
}
|
799
|
851
|
|
800
|
|
-func (c *HisApiController) GetPrintHisPatientCaseHistory() {
|
801
|
|
-
|
802
|
|
-}
|
|
852
|
+//func (c *HisApiController) GetPrintHisPatientCaseHistory() {
|
|
853
|
+//
|
|
854
|
+//}
|
803
|
855
|
func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo, json map[string]interface{}) int {
|
804
|
856
|
|
805
|
857
|
if json["drug_name"] == nil || reflect.TypeOf(json["drug_name"]).String() != "string" {
|