|
@@ -764,6 +764,7 @@ func (this *HisProjectApiController) SaveHisPatient() {
|
764
|
764
|
Phone: phone,
|
765
|
765
|
SocialType: social_type,
|
766
|
766
|
}
|
|
767
|
+
|
767
|
768
|
err := service.CreateHisPatient(&patient)
|
768
|
769
|
lastPatient, err := service.GetLastPatient(orgId)
|
769
|
770
|
timeStr := time.Now().Format("2006-01-02")
|
|
@@ -810,24 +811,33 @@ func (this *HisProjectApiController) SaveHisPatient() {
|
810
|
811
|
Status: 1,
|
811
|
812
|
IsReturn: 1,
|
812
|
813
|
}
|
813
|
|
- err := service.CreateHisPatient(&patient)
|
814
|
|
- lastPatient, err := service.GetLastPatient(orgId)
|
815
|
|
- timeStr := time.Now().Format("2006-01-02")
|
816
|
|
- timeArr := strings.Split(timeStr, "-")
|
817
|
|
- var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(lastPatient.ID, 10)
|
818
|
814
|
|
819
|
|
- hisPatient := models.HisPatient{
|
820
|
|
- Number: str,
|
821
|
|
- }
|
822
|
|
- err = service.UpdateHisPatient(lastPatient.ID, hisPatient)
|
823
|
|
- //fmt.Println("er", err)
|
824
|
|
- if err != nil {
|
|
815
|
+ //查询今日没有退号的患者是否已挂号
|
|
816
|
+ _, errcode := service.GetTodayHisPatient(nowtime, bloodPatient.ID, adminUserInfo.CurrentOrgId)
|
|
817
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
818
|
+ err := service.CreateHisPatient(&patient)
|
|
819
|
+ lastPatient, err := service.GetLastPatient(orgId)
|
|
820
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
821
|
+ timeArr := strings.Split(timeStr, "-")
|
|
822
|
+ var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(lastPatient.ID, 10)
|
|
823
|
+
|
|
824
|
+ hisPatient := models.HisPatient{
|
|
825
|
+ Number: str,
|
|
826
|
+ }
|
|
827
|
+ err = service.UpdateHisPatient(lastPatient.ID, hisPatient)
|
|
828
|
+ //fmt.Println("er", err)
|
|
829
|
+ if err != nil {
|
|
830
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
831
|
+ return
|
|
832
|
+ }
|
|
833
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
834
|
+ "patient": patient,
|
|
835
|
+ })
|
|
836
|
+ } else if errcode == nil {
|
825
|
837
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
826
|
838
|
return
|
827
|
839
|
}
|
828
|
|
- this.ServeSuccessJSON(map[string]interface{}{
|
829
|
|
- "patient": patient,
|
830
|
|
- })
|
|
840
|
+
|
831
|
841
|
}
|
832
|
842
|
}
|
833
|
843
|
|
|
@@ -1020,7 +1030,7 @@ func (this *HisProjectApiController) GetDoctorAdvicePrint() {
|
1020
|
1030
|
recordDateTime := theTime.Unix()
|
1021
|
1031
|
//prescription_id, _ := this.GetInt64("prescription_id")
|
1022
|
1032
|
adminUserInfo := this.GetAdminUserInfo()
|
1023
|
|
- advicePrint, err := service.GetDoctorAdvicePrint(patient_id, recordDateTime, idStrs)
|
|
1033
|
+ advicePrint, err := service.GetDoctorAdvicePrint(patient_id, recordDateTime, idStrs, adminUserInfo.CurrentOrgId)
|
1024
|
1034
|
projectlist, err := service.GetAllProjectList(adminUserInfo.CurrentOrgId)
|
1025
|
1035
|
//doctorPorject, err := service.GetDoctorProjectItem(patient_id, recordDateTime)
|
1026
|
1036
|
//patient, err := service.GetBloodPatientByPatient(patient_id)
|